Connect devpi to your docker container

You’re running pip install, buildout or your automated tests within a docker container and after running it multiple times you’ve become tired of waiting for it to finally complete? Then it’s time to connect a devpi server. Docker installation required Docker must be installed on your system. $ docker version Client: Docker Engine - Community Version: 19.03.5 API version: 1.40 Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:22:34 2019 OS/Arch: darwin/amd64 Experimental: false Server: Docker Engine - Community Engine: Version: 19.03.5 API version: 1.40 (minimum version 1.12) Go version: go1.12.12 Git commit: 633a0ea Built: Wed Nov 13 07:29:19 2019 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.2.10 GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339 runc: Version: 1.0.0-rc8+dev GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657 docker-init: Version: 0.18.0 GitCommit: fec3683 You’ll need a working directory where docker-compose.yml file and certificates are stored in, so please create a folder my-devpi as shown below: ...

January 7, 2016 · 2 min · 424 words · dw

Plone 6.0: What I expect

We’re still working on Plone 5.0 but for PLOG 2015 I put all my thoughts together and want to share with you what I expect Plone 6.0 to include. Legacy, redundancy and why forcing a style guide Plone has a lot of legacy code and this results in several different ways of doing things. Some developers prefer the old style some try to figure out a new way. Since we had no style guides in the past (we’re working hard on that) it was up to the developers themselves how to implement a piece of code. ...

March 31, 2015 · 4 min · 742 words · Daniel

Image filesize validator for dexterity content types in Plone

When using Plone 4.3 with plone.app.contenttypes you might want to limit max filesize for images by implementing a custom z3c.form validator. In ATCT we were able to limit max image filesize by overwriting ATCT config file or setting in portal_atct tool. Using webserver The simplest way to achieve a max-upload size is to just limit client_max_body_size in nginx webserver (or simliar in apache). But my current solution is really different. It creates a validator for a special fieldtype, in our special case a INamedBlobImageField. ...

May 31, 2013 · 1 min · 203 words · dw

Use Babel to translate your python package

I use egg-containing buildouts for all my Plone packages. Since i18ndude does not extract msgids from zcml files, i tried Babel and succeeded. Problem You want to translate titles in Plone’s diplay menu by adding browser:menuItem in your zcml file as shown here. <configure xmlns="http://namespaces.zope.org/zope" xmlns:browser="http://namespaces.zope.org/browser" xmlns:plone="http://namespaces.plone.org/plone" xmlns:i18n="http://namespaces.zope.org/i18n" i18n:domain="my.package"> <browser:page for="plone.folder.interfaces.IOrderableFolder" name="a_new_view" class=".demo_view.DemoView" permission="zope2.View" template="templates/demo_view.pt" /> <!-- Entry in display menu --> <browser:menuItem for="plone.folder.interfaces.IOrderableFolder" menu="plone_displayviews" title="A new view" action="@@a_new_view" description="I want a view with translated title and description" i18n:attributes="title; description" /> </configure> i18ndude does not extract message ids from zcml files, so i tried a diffent solution using Babel. ...

April 1, 2013 · 3 min · 594 words · Daniel

Turbo twitter Bootstrap theming for Plone using Diazo

When building a new Plone theme based on Twitter Bootstrap without modifying core templates you have to do a lot of xsl-styling. Hopefully this article can help you getting started. Building a diazo theme You should have basic knowledge of how to build a diazo theme in Plone. So you will have a file called rules.xml and hopefully your Twitter Bootstrap javascript and css code already plugged into Plone resource registries. An installable Plone product is available here. ...

December 11, 2012 · 3 min · 441 words · dw

Plone test development with robotframework and RIDE

Running acceptance tests in Plone Test driven development (TDD) can be a pain. If you are working with Zope and Plone most of time gets consumed starting up Zope running setUp method and rolling back transaction in tearDown method. So why not use a running already set-up instance for test-development? Today I will show you how to reach that goal. It’s not as hard as it seems. Use buildout Of course we use buildout to get a custom script which we can run through RIDE. I configured a new pybot script, the basic idea has been implemented in plone.act1 module already. ...

November 29, 2012 · 2 min · 256 words · dw

Howto use buildout version pins?

When using Plone with buildout you want to be able to reproduce your environment with the same set of eggs, even if there were some new releases in between. buildout 2.x For buildout 2.x they implemented a lot of improvements for pinning versions. allow-picked-versions allow buildout to download pinned packages only. Not pinned but required packages will raise an Exception. show-picked-versions shows a summary of picked versions after your first buildout run. You can copy'n'paste this into a versions.cfg file. buildout 1.x Manually Without pinning your eggs it will be impossible to reproduce the deployed buildout configuration in future. Use a this buildout extension for future projects to avoid this pitfall: ...

November 14, 2012 · 2 min · 238 words · dw

Change minute_step in Archetypes DateTimeWidget

Sometimes you need minutes which could not be divided by 5 which Plone doesn’t select you by default. You don’t need to rewrite core components in Archetypes DateTimeWidget to change this. Prerequisites You need your own BrowserLayer (a skin or theme product) or a contenttype with at least one marker interface to customize on. Howto Create a file called datecomponents.py in your browser directory with following content: from plone.app.form.widgets import datecomponents class DateComponents(datecomponents.DateComponents): def result(self, date=None, use_ampm=False, starting_year=None, ending_year=None, future_years=None, minute_step=5): # Change minute steps to 1 return super(DateComponents, self).result(date, use_ampm, starting_year, ending_year, future_years, 1) … and register it for you browserlayer (replace IThemeSpecific by your layer interface) or for a type you want to customize its widget (replace for='*' with your types interface), thats it. ...

August 31, 2010 · 1 min · 141 words · dw

Howto send mails from localhost through a smarthost on macOS

You’re getting weird errors like “Connection refused” from your smtp library? By reconfiguring your local mailer to send mails through a smarthost you can solve this issue. Setting up a smarthost Setting up your macOS to use a smarthost to forward mails to is not very hard. I found a nice tutorial on fuerstnet.de which was the base of this blog post. Copy the lines: $ sudo postconf -e relayhost=your.isps.mailserver smtp_use_tls=yes smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/smtp_auth tls_random_source=dev:/dev/urandom smtp_sasl_security_options=noanonymous $ sudo sh -c 'echo "your.isps.mailserver username:password" >> /etc/postfix/smtp_auth' $ sudo chown root:wheel /etc/postfix/smtp_auth $ sudo chmod 600 /etc/postfix/smtp_auth $ sudo postmap hash:/etc/postfix/smtp_auth Problems I noticed postfix is quitting after 60 seconds. So if you send yourself a test email using: echo "test" | mail -s "test" your@email the postfix daemon will quit after 60 seconds and you’ll get these errors when trying to send mails through localhost in (for example) Plone: ...

April 7, 2010 · 2 min · 357 words · dw

Howto use custom color for collective.captcha?

How to use your custom color with collective.captcha and Plone? This tutorial shows you an easy way to customize it using your own BrowserLayer. collective.captcha uses a BrowserView to display it’s captcha image. Therefore it’s very easy to customize it for your own theme because you can subclass that BrowserView for your own theme layer which is a BrowserLayer. You can change colors and/or fonts as you need it for your custom theme without doing any code change on the original collective.captcha package. ...

April 23, 2009 · 2 min · 275 words · dw