Plone-Blog

Obstacles on the road towards Plone 2020

erstellt von Philip Bauer zuletzt geändert: 2017-11-10T10:54:41+01:00
A short story about debugging issues with test isolation

During the sprint at the Plone Conference 2017 in Barcelona, Plone achieved a major milestone towards what is often called "Plone 2020". This is basically the effort to modernize Plone's backend and achieve Python 3 compatibility. In 2020, support for Python 2.7 will officially end, hence Plone 2020.

A necessary part of that effort was to migrate Zope to Python 3, a daunting task that was only possible by a flurry of activity that combined the efforts of many stakeholders (not only the Plone Community). Learn more about that in Hanno Schlichting's talk once the video is on the website, and on many blog posts on the Gocept Blog.

Getting Plone to run on that newest version of Zope (currently Zope 4.0b2) was another story and took a lot of work (some details are in my post here. Finally in Barcelona, in a daring move we merged all the work that had been done for that PLIP https://github.com/plone/Products.CMFPlone/issues/1351 and decided that the result will be called Plone 5.2. But by that time not all tests were green (that's why it was daring). We worked hard to get the tests to pass and to fix some issues we found when testing manually.

By the way: At the same sprint we started to prepare Plone itself for Python 3 by fixing all imports to work in both Python 2 and Python 3. But that is a tale for another blog post.

So, despite out best efforts, even one week after the conference I was not yet able to fix all the tests, and so I created at ticket to track the remaining issues.

Here this story about two erroring tests in Products.CMFFormController actually begins. Here is the spoiler: I did not really solve the issue but finally worked around it. But I still think the approach I took might be of interest to some.

The two breaking tests, test_attacker_redirect and test_regression, were passing when I ran them in isolation or when I ran all test of Products.CMFFormController with ./bin/test -s Products.CMFFormController. To add insult to injury, Products.CMFFormController is basically dead code but is still used by some of our legacy ControllerPageTemplates.

So how could I find the issue since the traceback was not really helpful?

Here is the relevant part of the log from jenkins:

#### Running tests for group Archetypes ####
Running Products.Archetypes.tests.attestcase.Archetypes:Functional tests:

[...]

Running plone.app.testing.bbb.PloneTestCase:Functional tests:
  Tear down Testing.ZopeTestCase.layer.ZopeLite in 0.000 seconds.
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.z2.Startup in 0.101 seconds.
  Set up plone.app.testing.layers.PloneFixture in 9.722 seconds.
  Set up plone.app.testing.bbb.PloneTestCaseFixture in 2.628 seconds.
  Set up plone.app.testing.bbb.PloneTestCase:Functional in 0.000 seconds.


Error in test test_attacker_redirect (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Products.CMFFormController/Products/CMFFormController/tests/testRedirectTo.py", line 97, in test_attacker_redirect
    handle_errors=False,
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Zope/src/Testing/ZopeTestCase/functional.py", line 43, in wrapped_func
    return func(*args, **kw)
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Zope/src/Testing/ZopeTestCase/functional.py", line 127, in publish
    wsgi_result = publish(env, start_response)
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Zope/src/ZPublisher/WSGIPublisher.py", line 254, in publish_module
    with load_app(module_info) as new_mod_info:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Zope/src/Testing/ZopeTestCase/sandbox.py", line 73, in load_app
    with ZPublisher.WSGIPublisher.__old_load_app__(module_info) as ret:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Zope/src/ZPublisher/WSGIPublisher.py", line 220, in load_app
    app = app_wrapper()
  File "/home/jenkins/workspace/plone-5.2-python-2.7-at/src/Zope/src/App/ZApplication.py", line 78, in __call__
    return connection.root()[self._name]
  File "/home/jenkins/shiningpanda/jobs/2fa08faf/virtualenvs/d41d8cd9/lib/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'Application'



Error in test test_regression (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)
Traceback (most recent call last):

[...]

    raise KeyError(key)
KeyError: 'Application'

  Ran 68 tests with 0 failures, 2 errors and 0 skipped in 1.626 seconds.
Running plone.app.folder.tests.layer.plone.app.folder testing:Integration tests:
  Set up plone.app.folder.tests.layer.IntegrationFixture in 0.027 seconds.
  Set up plone.app.folder.tests.layer.plone.app.folder testing:Integration in 0.000 seconds.
  Ran 27 tests with 0 failures, 0 errors and 0 skipped in 9.033 seconds.

[...]

Tearing down left over layers:
  Tear down zope.testrunner.layer.UnitTests in 0.000 seconds.
Total: 733 tests, 0 failures, 2 errors and 0 skipped in 3 minutes 10.739 seconds.
#### Finished tests for group Archetypes ####

What? Why does connection.root() have no Application? This makes no sense to me, and a pdb there did not help to shed light on it at all.

First I reproduced the error by testing all packages in the test group Archetypes (where the error occurs):

./bin/test \
  -s Products.Archetypes \
  -s Products.CMFFormController \
  -s Products.MimetypesRegistry \
  -s Products.PortalTransforms \
  -s Products.statusmessages \
  -s Products.validation \
  -s plone.app.folder

Then I only used the test layers that actually got set up according to the output:

./bin/test --layer Products.Archetypes.tests.attestcase.Archetypes \
           --layer Products.PortalTransforms.testing.PortalTransformsLayer \
           --layer Testing.ZopeTestCase.layer.ZopeLite \
           --layer plone.app.testing.bbb.PloneTestCase \
           -s Products.Archetypes \
           -s Products.CMFFormController \
           -s Products.MimetypesRegistry \
           -s Products.PortalTransforms \
           -s Products.statusmessages \
           -s Products.validation \
           -s plone.app.folder

That worked, I see the error. But I will not try to read 733 tests and wait for more than 3 minutes each time I think I may have fixed something!

Thus I used the divide-and-conquer strategy to figure out which combination produced the failing tests: remove half of the packages layers and see if it still fails. If they pass, try the other half. Do the same with the layers.

Remember to keep --layer plone.app.testing.bbb.PloneTestCase and -s Products.CMFFormController in order not to skip the tests that expose the issue.

It turned out that the following combination reproduced the issue:

./bin/test \
    --layer Products.Archetypes.tests.attestcase.Archetypes \
    --layer Testing.ZopeTestCase.layer.ZopeLite \
    --layer plone.app.testing.bbb.PloneTestCase \
    -s Products.Archetypes \
    -s Products.CMFFormController

Still way too many tests to have a look, most of them in Products.Archetypes. So I removed (actually, moved the .py files to some temp folder) all python tests and kept the doctests (and their setup). The only reason was that I hate doctests and consequently it must be a doctest that created trouble. I was right.

So I kept only one doctest that produced the issue by commenting out the others in test_doctest.py of Products.Archetypes.

Now I needed to find a combination of three tests from these layers that still exposed the issue. To to that, I added the option -vv to the testrunner to see the names and python path of all tests that still ran.

./bin/test --layer Products.Archetypes.tests.attestcase.Archetypes --layer Testing.ZopeTestCase.layer.ZopeLite --layer plone.app.testing.bbb.PloneTestCase -s Products.Archetypes -s Products.CMFFormController -vv
Running tests at level 1
Running Products.Archetypes.tests.attestcase.Archetypes:Functional tests:
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.z2.Startup in 0.157 seconds.
  Set up plone.app.testing.layers.PloneFixture in 10.252 seconds.
  Set up plone.app.testing.bbb.PloneTestCaseFixture in 1.871 seconds.
  Set up Products.Archetypes.tests.attestcase.ATTestCaseFixture in 0.647 seconds.
  Set up Products.Archetypes.tests.attestcase.Archetypes:Functional in 0.000 seconds.
  Running:
    1/1 (100.0%) /Users/pbauer/workspace/coredev/src/Products.Archetypes/Products/Archetypes/tests/traversal_4981.txt

  Ran 1 tests with 0 failures, 0 errors, 0 skipped in 0.269 seconds.
Running Testing.ZopeTestCase.layer.ZopeLite tests:
  Tear down Products.Archetypes.tests.attestcase.Archetypes:Functional in 0.000 seconds.
  Tear down Products.Archetypes.tests.attestcase.ATTestCaseFixture in 0.010 seconds.
  Tear down plone.app.testing.bbb.PloneTestCaseFixture in 0.009 seconds.
  Tear down plone.app.testing.layers.PloneFixture in 0.065 seconds.
  Tear down plone.testing.z2.Startup in 0.004 seconds.
  Tear down plone.testing.zca.LayerCleanup in 0.001 seconds.
  Set up Testing.ZopeTestCase.layer.ZopeLite in 0.009 seconds.
  Running:
    1/5 (20.0%) test_parseXML_empty (Products.CMFFormController.tests.test_exportimport.CMFFormControllerImportConfiguratorTests)
    2/5 (40.0%) test_parseXML_with_info (Products.CMFFormController.tests.test_exportimport.CMFFormControllerImportConfiguratorTests)
    3/5 (60.0%) test_action_not_unicode (Products.CMFFormController.tests.test_exportimport.Test_importCMFFormController)
    4/5 (80.0%) test_normal (Products.CMFFormController.tests.test_exportimport.Test_importCMFFormController)
    5/5 (100.0%) test_partial (Products.CMFFormController.tests.test_exportimport.Test_importCMFFormController)

  Ran 5 tests with 0 failures, 0 errors, 0 skipped in 0.023 seconds.
Running plone.app.testing.bbb.PloneTestCase:Functional tests:
  Tear down Testing.ZopeTestCase.layer.ZopeLite in 0.000 seconds.
  Set up plone.testing.zca.LayerCleanup in 0.000 seconds.
  Set up plone.testing.z2.Startup in 0.092 seconds.
  Set up plone.app.testing.layers.PloneFixture in 7.227 seconds.
  Set up plone.app.testing.bbb.PloneTestCaseFixture in 2.087 seconds.
  Set up plone.app.testing.bbb.PloneTestCase:Functional in 0.000 seconds.
  Running:
    1/4 (25.0%) testCopy (Products.CMFFormController.tests.testCopyRename.TestCopyRename)
    2/4 (50.0%) testRename (Products.CMFFormController.tests.testCopyRename.TestCopyRename)
    3/4 (75.0%) test_attacker_redirect (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)


Error in test test_attacker_redirect (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/Users/pbauer/workspace/coredev/src/Products.CMFFormController/Products/CMFFormController/tests/testRedirectTo.py", line 97, in test_attacker_redirect
    handle_errors=False,
  File "/Users/pbauer/workspace/coredev/src/Zope/src/Testing/ZopeTestCase/functional.py", line 43, in wrapped_func
    return func(*args, **kw)
  File "/Users/pbauer/workspace/coredev/src/Zope/src/Testing/ZopeTestCase/functional.py", line 127, in publish
    wsgi_result = publish(env, start_response)
  File "/Users/pbauer/workspace/coredev/src/Zope/src/ZPublisher/WSGIPublisher.py", line 254, in publish_module
    with load_app(module_info) as new_mod_info:
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/pbauer/workspace/coredev/src/Zope/src/Testing/ZopeTestCase/sandbox.py", line 73, in load_app
    with ZPublisher.WSGIPublisher.__old_load_app__(module_info) as ret:
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/pbauer/workspace/coredev/src/Zope/src/ZPublisher/WSGIPublisher.py", line 220, in load_app
    app = app_wrapper()
  File "/Users/pbauer/workspace/coredev/src/Zope/src/App/ZApplication.py", line 78, in __call__
    return connection.root()[self._name]
  File "/Users/pbauer/workspace/coredev/bin/../lib/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'Application'

    4/4 (100.0%) test_regression (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)


Error in test test_regression (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 329, in run
    testMethod()
  File "/Users/pbauer/workspace/coredev/src/Products.CMFFormController/Products/CMFFormController/tests/testRedirectTo.py", line 71, in test_regression
    handle_errors=False,
  File "/Users/pbauer/workspace/coredev/src/Zope/src/Testing/ZopeTestCase/functional.py", line 43, in wrapped_func
    return func(*args, **kw)
  File "/Users/pbauer/workspace/coredev/src/Zope/src/Testing/ZopeTestCase/functional.py", line 127, in publish
    wsgi_result = publish(env, start_response)
  File "/Users/pbauer/workspace/coredev/src/Zope/src/ZPublisher/WSGIPublisher.py", line 254, in publish_module
    with load_app(module_info) as new_mod_info:
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/pbauer/workspace/coredev/src/Zope/src/Testing/ZopeTestCase/sandbox.py", line 73, in load_app
    with ZPublisher.WSGIPublisher.__old_load_app__(module_info) as ret:
  File "/usr/local/Cellar/python/2.7.13_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/pbauer/workspace/coredev/src/Zope/src/ZPublisher/WSGIPublisher.py", line 220, in load_app
    app = app_wrapper()
  File "/Users/pbauer/workspace/coredev/src/Zope/src/App/ZApplication.py", line 78, in __call__
    return connection.root()[self._name]
  File "/Users/pbauer/workspace/coredev/bin/../lib/python2.7/UserDict.py", line 40, in __getitem__
    raise KeyError(key)
KeyError: 'Application'


  Ran 4 tests with 0 failures, 2 errors, 0 skipped in 0.403 seconds.
Tearing down left over layers:
  Tear down plone.app.testing.bbb.PloneTestCase:Functional in 0.000 seconds.
  Tear down plone.app.testing.bbb.PloneTestCaseFixture in 0.010 seconds.
  Tear down plone.app.testing.layers.PloneFixture in 0.068 seconds.
  Tear down plone.testing.z2.Startup in 0.007 seconds.
  Tear down plone.testing.zca.LayerCleanup in 0.001 seconds.

Tests with errors:
   test_attacker_redirect (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)
   test_regression (Products.CMFFormController.tests.testRedirectTo.TestRedirectToFunctional)
Total: 10 tests, 0 failures, 2 errors, 0 skipped in 24.082 seconds.

24 seconds? I can work with that.

Still, I removed tests from each layer until I only had three tests left and reverted my changes to Products.Archetypes.

The result is the following:

./bin/test \
    --layer Products.Archetypes.tests.attestcase.Archetypes \
    --layer Testing.ZopeTestCase.layer.ZopeLite \
    --layer plone.app.testing.bbb.PloneTestCase \
    -s Products.Archetypes \
    -s Products.CMFFormController \
    -t test_parseXML_empty \
    -t traversal_4981 \
    -t test_attacker_redirect \
    -vv

Since more than one test still exposed the issue, I kept only very simple ones because I guessed that the issue is actually in the setup or teardown.

So next I changed the test test_parseXML_empty to a simple return. The error is still there. Trying the same with traversal_4981 makes it go away.

At this point I could skip reducing the layers since I only run three tests from two packages.

It was time to actually read what the remaining tests are doing. I stripped down all tests and their setup to the base minimum that still breaks the test run and could not find anything. I turn edCMFFormControllerImportConfiguratorTests into a ZopeTestCase and a PloneTestCase and realized that the error disappears when it is a PloneTestCase. Bad. Migrating the whole test to PloneTestCase or plone.app.testing would be a lot of work since CMFFormControllerImportConfiguratorTests inherits from Products.GenericSetup.tests.common.BaseRegistryTests and does a lot of additional magic.

So the test layers for the two tests that did not fail or error by themselves but triggered the issue in the failing tests (traversal_4981 and test_parseXML_empty) seemed to be out of the scope of what I could do so I took a closer look at the failing tests themselves. I quickly found that I hate them but what they do is actually quite simple. Why do I hate them? Because they use the publish method of ZopeTestCase.Functional. That method (and its evil doctest-cousin Testing.ZopeTestCase.zopedoctest.functional.http) are way too clever helper methods that make things harder, not easier. I prefer to use restrictedTraverse or the testbrowser any time since both are much closer to what actually happens in the application.

This was the moment when I decided to migrate the tests in question to proper plone.app.testing tests. It took me about 1 hour to create a pull-request which resolves the issue. The rest of the day was spent on a fruitless attempt to find the issue that must still be lurking somewhere between the three tests and their layers.

I hope that monster will never rear its ugly head again until CMFFormController is finally removed from the coredev. The PLIP 2092 by @esteele and me will remove the last remaining ControllerPageTemplates but there are some more left in Archetypes.

I fear it will be quite some time until all ZopeTestCase and PloneTestCase tests are migrated to plone.app.testing. The remaining happy thought is that many will not need to be migrated since they are part of Archetypes and will go awaaaaay with it.

Hello Thomas!

erstellt von Philip Bauer zuletzt geändert: 2017-03-02T15:56:48+01:00
We're excited to welcome Thomas Lotze to the team of Starzel.de.

Thomas has many years of experience developing complex web projects with Python, especially using Pyramid and Plone. His interests also include automated testing and questions of software infrastructure. He shares our dedication to Open Source and we are looking forward to many exciting projects in the future.

Aside from development, Thomas does trainings on subjects that he knows well from day-to-day work, in particular Python, Pyramid and pytest.

You can meet us next at World Plone Day and PyConWEB in Munich.

World Plone Day - 28. April 2017 - München

erstellt von Steffen Lindner zuletzt geändert: 2017-02-17T21:12:59+01:00
Der World Plone Day ist eine weltweite Initiative der großartigen Community des Open Source Content-Management-Systems Plone.

Merkt euch den 28. April 2017 in euren Kalendern vor, an diesem Tag findet der World Plone Day in München statt. Die Location steht schon fest: Uni München, Oettingenstraße, Raum L 155.

Wir werden uns den halben Tag (14 bis 18 Uhr) intensiv mit Plone beschäftigen. Jeder der sich für CMS, Plone, Python und das Web interessiert, ist eingeladen. Die Teilnahme ist kostenlos. Am Programm feilen wir noch, möglich sind diese Themen: Plone 5.1, Quaive, PLOG und Shopsysteme mit Plone.

Details zum Programm sind hier zu finden.

Bei schönem Wetter geht es danach in den Biergarten am Chinesischer Turm!

Eine Anmeldung schalten wir bis Ende Feburar auf plone.de online.

Stay tuned!

Towards Plone 6

erstellt von Philip Bauer zuletzt geändert: 2017-03-01T11:52:13+01:00
A report from the Alpine City Sprint in Innsbruck

Two of the main items on the Plone roadmap are the move to Python 3 and a more active role in the development of the underlying stack of Plone, namely Zope. After the recent uptake of activity in development of Zope (see here and here) it was a sensible first task to try to get Plone to run on the most recent Zope stack. What exactly does that mean?

There is a PLIP that proposes to upgrade Plone's Zope-related dependencies and is approval by the Plone Framework Team to be a part of Plone 6. As with all PLIPs, the point is not only to agree on a task and a implementation but also actually doing the work. After two smaller efforts at sprints last year where only 2 or 3 people were working on the task we finally got a critical mass of developers together for the Alpine City Sprint. 15 people sprinted and worked on this one task.

essen.jpg

Off to a good start

On the day before the sprint I rebased some of our branches and with a couple of quick and really dirty fixes I got Plone run on Zope 4. Many features were still not working but a working instance certainly provided motivation for this very dedicated sprint.

Bildschirmfoto 2017-02-13 um 11.43.41.png

WSGI replaces the ZServer

The ZServer is now a optional dependency and the new WSGI-Publisher is the default publisher making Plone fully WSGI-compliant! Thomas Schorr added some necessary buildout-parts to run Plone on uwsgi, waitress and gunicorn. Documentation is here and examples are here. Even the testbrowser used for all of Plone's functional tests now uses the WSGI-Publisher. The advantages of WSGI are obvious: It makes it easier to have interact Plone with other services and some features can be developed as WSGI-middleware. It'll be interesting to see if we will make more use of WSGI for Plone in the future than "simply" for serving.

ZCatalog 4 and ZODB 5

The result of the sprint is beyond what was originally proposed in the PLIP. We now not only use the master branch from Zope and the zope-toolkit packages (zope.interface, zope.component etc.) but also ZODB 5 and ZCatalog 4.

One change that required some work was that ZCatalog, as it now returns a empty list when you pass no query or a invalid query. Especially in the cases when you query the catalog for a non-existing index (portal_typos='foo') getting all brains from the Catalog seems like a bad idea. The down-side that change there is that there is no obvious way to walk through all brains in the catalog any more. Johannes Raggam added the convenience-method catalog_get_all for this.

The changes in ZODB are numerous but for Plone-developers nothing much really changes except that is supposed to be faster and supports Python >= 3.3 and 2.7. For the future it will be also interesting to discuss if switching to NewtDB would be a option. NewtDB runs ZODB 5 with RelStorage and stores data as json in Postgres.

Bildschirmfoto 2017-02-13 um 11.12.27.png

Python 3

The sprint did not try to move Plone to Python 3 yet but rather clear the way so we can do it. The last remaining blocker with C-code was RestrictedPython and Alexander Loechel and Michael Howitz continued working on the rewrite based on the Python AST module. At the end of the sprint they were happy to announce that it is no longer a blocker for our move to Python 3. All the other packages that rely on C-code that seems mysterious to mere Python-mortals (ExtensionClass, AccessControl, Acquisition, Persistence) were already ported to Python 3. RestrictedPython is a very useful tool that allows you to execute untrusted Python code that is loaded within a running Python program. It checks and modifies source code to only allow the execution of a restricted subset of Python.

What remains to be done?

  • jenkins_green.pngFix some failing tests (DONE): As of today we are down to 8 failing tests 6 failing tests 2 failing tests 0 failing tests!!! 
  • Update tasks and tickets
  • Merge changes: A lot of the changes were already merged in the master-branches for the current coredev (for Plone 5.1). But some merges will have to wait until Plone 5.1 is released because they only target Plone 6.0. Once all test are green and all our zope-related branches are merged we can make a release of Zope 4.0a3 and switch from using source-checkouts for everything (auto-checkout = *) to using released versions.
  • Documentation: We need to document what changed in Zope from the perspective of Plone. Most notably some lesser features of the ZMI are gone. These and other changes need to go into the upgrade-guide for the next Plone-Version. Also the new setup for various WSGI-Servers needs to be well-documented so that developers can  copy&paste best-practice configs into their buildouts. The documentation was started in a Google Doc where everyone can contribute. Once it's stable we'll move it to their respective places.
  • Upgrades: So far it seems like the changes we made did not make any upgrade-steps necessary. After adding a quick hack to work around the missing zope-controlpanel I was able to upgrade a existing Plone 5.0.6 site without any issues.
  • Profiling: Initial results with from plone.instanceprofiling indicate the speed of Plone has increased but we need more real-life tests before a final judgement. It will also be interesting to see the impact of Python 3 on speed.

Bildschirmfoto 2017-02-13 um 11.15.54.png

Inside the sprint

As usual during the sprint we ran into a bunch of blockers and hard nuts to crack. The hardest one was probably that the current users roles were mysteriously dropped during a request after running trough some C-code. Like the memory of a bad dream, the bug vanished in the light of the morning - actually someone switched to different branch of AccessControl. On the first day already, Matthew Wilkes had committed to a metaclass in Persistence (thankfully brown-bagging my terrible late-night hack and replacing it with something much more elegant), and installed gdb to debug the issue with the dropped roles.

Unfortunately many of our tests were broken since the testlayer did not use chameleon, thankfully after a lot of debugging the solution found by Thomas Schorr was pretty simple. Also tough was a issue that broke tests in weird ways. Gladly Jens Klein, our host, dug deep and found the culprit: Combining bundles modified the response's Content-Type header, surprise! A issue similar to https://github.com/plone/Products.CMFPlone/pull/1438.

Bildschirmfoto 2017-02-13 um 11.22.11.png

Shops!

By the way: We also had a demo of bda.plone.shop and a discussion about shop-solutions for Plone. bda.plone.shop has plenty of great features and seems really well thought-through. It still lacks some end-user documentation with screenshots and a new release but we will certainly use it in our next project that involves a shop.

Where do we go from here?

To the pool in Sorrento! Plone Open Garden (PLOG) in beautiful Sorrento is the perfect opportunity to discussing the further roadmap to Python 3 and continue working on this. PLOG will have a strong focus on the headless CMS project for which a Python 3-compatible Plone 6 will be a mayor milestone. Register now and enjoy a week at the pool with the Plone community.

2016-03-26 18.03.01.jpg

And then on to Finnland to the Midsummer Sprint! All the work on the backend needs to be balanced with some fun UX and UI work to enhance the content editors experience.

Summary

We worked on many important parts of the Plone Roadmap: Removing unused components, clean up the code base, moving to Python 3, and making Plone WSGI compliant. There is now a good chance that Plone will be on Python 3 this or next year. A great sprint, dedicated and smart people, good beer and food and nice mountains. Thanks to the organizers of Klein und Partner who worked hard to keep us fed, fueled and entertained and thanks to all the sprinters who dedicated so much of their time for such a great open source project!

Update (19.02.2017)

  1. Last week gocept announced there will be another Zope sprint in Mai with the goal to port Zope to Python 3. Already 11 developers signed up.
  2. David Glick fixed the remaining failing tests (mosty issues with the new handling of exceptions).

 

Push coverage report out of an Gitlab CI Runner

erstellt von Steffen Lindner zuletzt geändert: 2017-02-06T17:26:17+01:00
For our Plone/Python projects we often generate coverage reports as HTML sites, this posts show how you can push this report out of the Gitlab CI Runner.

 Save FTP Password & Login as secret variables in Gitlab > Settings > Variables. They can be accessed in the .gitlab-ci.yml as $FTPLOGIN & $FTPPASSWORD.

 gitlab_variables.png

Here is our .coveragerc file, which sets the output directory:

 [report]
include =
    src/plone.site/*
omit =
    */test*
    */upgrades/*
    */browser/dummy.py
[html]
directory = parts/test/htmlreport
title = Plone Project

And our .gitlab-ci.yml:

before_script:
    - /usr/bin/virtualenv .
    - ./bootstrap_ci.sh
job1:
  script:
     - export DISPLAY=:99
     - ./bin/code-analysis
     - ./bin/coverage erase
     - ./bin/coverage run -p --source=src bin/test || exit 1
     - ./bin/coverage combine
     - ./bin/coverage html
     - ./bin/coverage report
        # Stage robot
     - ./bin/test --all -t 'robot' || exit 1
     - cd parts/test/htmlreport/ && find . -type f -exec curl --ftp-create-dirs -T {} -u $FTPLOGIN:$FTPPASSWORD ftp://45.54.45.54/uhlmann/$CI_BUILD_ID/{} \;
  artifacts:
        expire_in: 1 week
        paths:
            - parts/test/

The interesting part is the curl one, it uploads all coverage files to a FTP server.

If your static webserver is public accessible use basic auth with a .htaccess file:

htpasswd -c .htpasswd starzel

.htaccess file:

AuthUserFile /var/www/htdocs/.htpasswd
AuthGroupFile /dev/null
AuthName "Please Enter Password"
AuthType Basic
Require valid-user

Better integration into Gitlab coming soon as Gitlab Pages see this Pull Request.

Todo:

  - Cron to delete old directories.

  - Upload files if robot / code-analysis failed.

 

Fix failing parallel running browser tests with Gitlab & Robotframework

erstellt von Steffen Lindner zuletzt geändert: 2017-01-25T16:41:19+01:00
One of our project is organized in sprints where all developer work on the same code at the same time. We use one Gitlab CI server with a simple shell executer and had random failing builds with Robotframwork & Firefox.

Our Gitlab CI Runner can run three shell executer at the same time. Sometimes two Robotframework (Selenium) tests run in parallel and one of them fails with this error:

error: [Errno 98] Address already in use

That means Firefox is already in use (by the other build) and the CI job failed and blocked our process. Gitlabs automerge -feature does not happen and the code-reviewer needs to manually start the job again since it is marked as a fail.

We solved the problem with a little shell script isfirefoxinuse.sh that waits if a Robot process is running:

#!/bin/sh

while :
do

RESULT=`pgrep -f robot`

if [ "${RESULT:-null}" = null ]; then
echo "Robot not running, starting "
./bin/test --all -t robot || exit 1
break
else
echo "running"
fi
sleep 20
done

Our .gitlab-ci.yml file looks like this:

before_script:
- export PATH=$PATH:bin/
- export DISPLAY=:99

build_project:
# stage: build
script:
# Stage: build
- /usr/bin/virtualenv .
- ./bootstrap_ci.sh
# Stage test
- ./bin/code-analysis
- ./bin/i18nize_all && ./bin/podiff_all
- ./bin/coverage erase
- ./bin/coverage run -p --source=src bin/test || exit 1
- ./bin/coverage combine
- ./bin/coverage html
- ./bin/coverage report
# Stage robot
- ./bin/isfirefoxinuse.sh || exit 1
artifacts:
expire_in: 1 week
paths:
- parts/test/

The call to start the robot tests (./bin/test --all -t robot) is wrapped into the ./bin/isfirefoxinuse.sh script.

If you are a buildout user, this might be useful to get the script integrated:

parts +=
isfirefoxinuse
...

recipe = collective.recipe.cmd
on_install = true
on_update = true
cmds = cp ${buildout:directory}/templates/isfirefoxinuse.in ${buildout:bin-directory}/isfirefoxinuse.sh

 Hope this helps someone!

Plone 5 Release Party and the Plone Theming Sprint

erstellt von Philip Bauer zuletzt geändert: 2015-09-12T13:03:42+01:00
Let's celebrate the release of Plone 5! On September 16 there is a release party taking place at Kitchen2Soul, Schlörstraße 4, Munich.

Eric Steele, our beloved release manager, is going to highlight some of the main features. Afterwards there is food, drink and fun.

The party is also the kick-off to the Plone 5 Theming Sprint in Munich on 16 - 20 September 2015

The main task of the sprint is to document and improve the theming-story for Plone 5. So...

  • if you want to learn about theming and customization with Plone
  • if you do theming and customization with Plone
  • if you want to upgrade a existing theme to Plone 5
  • if you want others to have a great theming and customization-experience with Plone

...please consider coming to the sprint. Everybody is welcome!

During the sprint we are going to have several talks related to theming:

  • Wednesday at 1 p.m.: An introduction to Plone 5 Theming. By Víctor Fernández de Alba
  • Thursday at 6 p.m.: The Plone intranet initiative and its design first. By Philip Bauer and Alexander Pilz
  • Friday at 6 p.m.: Patternslib and Mockup. The javascript libraries that bring webdesign and development together. By J.C. Brand


You can find all the details here: http://www.coactivate.org/projects/plone-5-theming-sprint-munich

Details about the Party: plone5.de

  • 6 p.m. in Kitchen2Soul, Schlörstraße 4
  • 7 p.m. presetation of Plone 5 by the Release Manager - Eric Steele
  • Afterwards Party - Open End
  • Please let us know if you are coming using the form at http://plone5.de/#contact


Test Plone 5 now: demo.plone.de
Learn more about Plone: plone.com

Magic templates in Plone 5

erstellt von Philip Bauer zuletzt geändert: 2017-03-01T12:22:05+01:00
Due to the new rendering-engine chameleon it is fun again to write templates

Plone 5 uses Chameleon a its rendering engine. Did you know that because of that you can put a pdb in a template? If you saw the keynote by Eric Steele on Plone 5 you probably do.

But did you also know that the variable econtext holds all current variables up to the moment the pdb is thrown?

Let's put a pdb in newsitem.pt:

(...)

<metal:content-core fill-slot="content-core">
    <metal:block define-macro="content-core"
          tal:define="templateId template/getId;
                      scale_func context/@@images;
                      scaled_image python: getattr(context.aq_explicit, 'image', False) and scale_func.scale('image', scale='mini')">

<?python import pdb; pdb.set_trace() ?>

    <figure class="newsImageContainer"
         tal:condition="python: scaled_image">
        <a href="#"
           tal:define="here_url context/@@plone_context_state/object_url;
                       large_image python: scale_func.scale('image', scale='large');"
           tal:attributes="href large_image/url">
          <img tal:replace="structure python: scaled_image.tag(css_class='newsImage')" />

(...)

When rendering a News Item the variable scaled_image is accessible as econtext['scaled_image']:

> /Users/philip/workspace/test/f56e9585b89e34318d1171acc17f531a7a428a1f.py(132)render_content_core()
(Pdb) econtext['scaled_image']
<plone.namedfile.scaling.ImageScale object at 0x110073b90>
(Pdb) econtext['scaled_image'].width
200 

You can inspect the whole econtext:

(Pdb) from pprint import pprint as pp
(Pdb) pp econtext
{'__convert': <function translate at 0x10fb4d7d0>,
 '__decode': <function decode at 0x10fb4d578>,
 '__slot_content_core': deque([]),
 '__slot_javascript_head_slot': deque([]),
 '__translate': <function translate at 0x10fb4d7d0>,
 'ajax_include_head': None,
 'ajax_load': False,
 'args': (),
 'body_class': 'template-newsitem_view portaltype-news-item site-Plone section-super-news userrole-manager userrole-authenticated userrole-owner plone-toolbar-left-default',
 'checkPermission': <bound method MembershipTool.checkPermission of <MembershipTool at /Plone/portal_membership used for /Plone/super-news>>,
 'container': <NewsItem at /Plone/super-news>,
 'context': <NewsItem at /Plone/super-news>,
 'context_state': <Products.Five.metaclass.ContextState object at 0x10db00910>,
 'default': <object object at 0x100291bf0>,
 'dummy': None,
 'here': <NewsItem at /Plone/super-news>,
 'isRTL': False,
 'lang': 'de',
 'loop': {},
 'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x102e31b48>,
 'nothing': None,
 'options': {},
 'plone_layout': <Products.Five.metaclass.LayoutPolicy object at 0x10db00310>,
 'plone_view': <Products.Five.metaclass.Plone object at 0x10db00dd0>,
 'portal_state': <Products.Five.metaclass.PortalState object at 0x10fbe8d50>,
 'portal_url': 'http://localhost:8080/Plone',
 'repeat': {},
 'request': <HTTPRequest, URL=http://localhost:8080/Plone/super-news/newsitem_view>,
 'root': <Application at >,
 'scale_func': <Products.Five.metaclass.ImageScaling object at 0x10c2bf390>,
 'scaled_image': <plone.namedfile.scaling.ImageScale object at 0x110073b90>,
 'site_properties': <SimpleItemWithProperties at /Plone/portal_properties/site_properties>,
 'sl': False,
 'sr': False,
 'target_language': None,
 'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x10fff3ed0>,
 'templateId': 'newsitem.pt',
 'toolbar_class': 'pat-toolbar initialized plone-toolbar-left',
 'translate': <function translate at 0x10fb4d7d0>,
 'traverse_subpath': [],
 'user': <PropertiedUser 'adminstarzel'>,
 'view': <Products.Five.metaclass.SimpleViewClass from /Users/philip/workspace/test/src-mrd/plone.app.contenttypes/plone/app/contenttypes/browser/templates/newsitem.pt object at 0x10cd93910>,
 'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x10f5cc190>,
 'wrapped_repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x10ffba1b0>}

Using n you can actually walk down the template and inspect new variables as they appear. After pressing n about 11 times the variable large_image appears as econtext['large_image'].

(Pdb) econtext['large_image'].width
768

The pdb-session you are in is no restricted python but real python. This means you can do the following:

(Pdb) from plone import api
(Pdb) portal = api.portal.get_tool('portal_memberdata')
(Pdb) memberdata = api.portal.get_tool('portal_memberdata')
(Pdb) memberdata.getProperty('wysiwyg_editor')
'kupu'

Hey, what is kupu doing there? I found that in some of our sites that were migrated from Plone 3 this old setting prevented TinyMCE to work in static portlets. But that is a different story, let's just get rid of it.

(Pdb) memberdata.wysiwyg_editor = 'TinyMCE'
(Pdb) import transaction; transaction.commit()

This is a full-grown pdb and you can inspect and modify your complete site with it.

But there is more: You can actually have complete code-blocks into templates:

<?python

from plone import api
catalog = api.portal.get_tool('portal_catalog')
results = []
for brain in catalog(portal_type='Folder'):
    results.append(brain.getURL())

?>

<ul>
    <li tal:repeat="result results">
      ${result}
    </li>
</ul>

Quick and dirty? Maybe dirty but really quick! It is still very true that having logic in templates is bad practice but I think in some use-cases it is ok:

  • Debugging
  • When you customize a existing template (with z3c.jbot or plone.app.themingplugins) and need some more logic
  • When you quickly need to add some logic to a browser-view that only has a template but no class of it's own

Have fun templating with Plone 5! If you want to learn more about Plone 5 you can still register for the training "Mastering Plone 5 Development" in March 2.-6. (http://www.starzel.de/leistungen/training/)

Update:

As disucced here you can add the econtext to the the locals() by using the following stanza:

<?python locals().update(econtext); import pdb; pdb.set_trace() ?>

 

Plone Conference 2014: The Highlights

erstellt von Philip Bauer zuletzt geändert: 2017-03-01T12:22:06+01:00
The Plone Conference has once again proven its value. There were many excellent talks and everyone had a great time. In Open Spaces and during many discussions between talks the current state and the future of Plone became much clearer.

Plone 5

The main thing is Plone 5. It look great, is a huge step forward in terms of user experience and brings tons of important improvements. The keynote of Plone's release manager Eric Steele showcases all these things.

Getting Plone 5 ready for a beta-release is the top item on everyone’s agenda. That effort not only involves finishing projects such as mockup, the new theme and contenttypes but also writing documentation for end-users, the upgrade-guide for developers and testing.

The Plone Roadmap

The second biggest thing was the roadmap-discussion. Discussions about the a new Roadmap started in October 2013 at the Plone Conference in Brazil under the catchy title "Plone Roadmap 2020". The initial topic was the future of Zope within Plone's ecosystem, but it turned into a broader discussion about all the things that the community wants to change in Plone, not forgetting the whys and hows.

Roadmap progress in Bristol 2014

First we looked at reasons why we use Plone. The following motivations were mentioned the most:

  • The Plone Community
  • Fully-featured user friendly product that is directly usable
  • Flexibility of the software architecture
  • It creates jobs
  • Best security-record
  • Open source

As Martin Aspelli put it so eloquently: If we are going to change Plone, can we please not mess any of the above up?

Next we compiled a list of things that we want to change in Plone in the next five years.

  • python-api
  • json-api
  • Improve end user experience
  • Documentation and training: Document the recommended way to do things
  • Improve TTW-story in theming, templating and customization
  • Simplify code base, reduce number of eggs, remove legacy technologies
  • Remove dependency on CMF
  • Roadmap communication

Not a single person advocated a rewrite since it is clear that a rewrite would mess with some things on the first list.

When looking closer at the aims it becomes clear that all of these things are already being worked on:

  • python-api: There is now a Plone Improvement Proposal to ship plone.api with Plone and also use it in the core. There will be further discussions about what we need from an api to further isolate Plone from parts that we might want to replace in the future.
  • json-api: The community is already working on a RESTful json-api for Plone that will allow isolating the front-end from the backend and experiment with various javascript-frameworks. With this api Plone will be better suited for for web-applications where Plone is "only" used as the backend and will be a friendly citizen in a world of mixed technologies.
  • UX: Plone 5 will already be a huge step in the right direction but there will always be room for improvement. The enthusiastic reaction to the efforts of the Plone Intranet Consortium showed how important a good UX is.
  • Documentation: The new docs.plone.org are much better than anything Plone had in the past. During the sprint the documentation was already being cleaned of examples that use grok. Also the documentation for the Mastering Plone Training teaches always the recommended ways to do things and will be expanded and upgraded for Plone 5.
  • TTW-Story: Although Mosaic (the new name for Deco) looks extremely promising this is surely one of the areas where Plone still needs to invest more. For template-customization we still rely on old technologies: The only way to customize a viewlet within Plone is to use the ZMI (not recommended!). The community will have to agree on achievable solutions to have some real progress. But do not forget that Plone already has a great TTW-story: Dexterity and the Diazo theme-editor are powerful features and blow the competition out of the water.
  • Simplify code base, reduce number of eggs: Many technologies (formlib, portal_skins, plone-tools, cpy/cpt) are already deprecated and the code is migrated to browserviews and z3c.form (*cough*) in Plone 5. There is also a PLIP that aims to move many plone.app-packages into the core-package Products.CMFPlone [https://dev.plone.org/ticket/13283].
  • Remove dependency on CMF: Without a python-api we cannot remove parts of CMFCore and Zope. Having that api will give us the options we need to replace/remove stuff. We'll need some experiments and even more discussions about what we want to remove and what to replace it with.
  • Roadmap communication: The discussion on a the Plone Roadmap will be continued. The next Plone Open Garden (April 2015 in Sorrento) will probably be turned into a Plone Strategic Planning Summit. Communicating the community's strategic vision of Plone in the short, mid and long term to the public is almost as important as agreeing on a roadmap and implementing it.

Since there is no official roadmap-team these kind of meetings are where the future of Plone is actually agreed on. This is where Plone happens and everyone who takes part is part of the roadmap-team.

The Plone Intranet Consortium

One of the most anticipated talks of the conference was about the Plone Intranet Consortium. Since its foundation last year, the consortium (of which Starzel.de is a founding member) is working on a competitive Social Intranet solution. One of the aims is to evolve and strengthen the position of Plone in a commoditized market. The design-first approach and the fact that Plone-companies put their resources together allows for high expectations. See the talk:

 

The sprint

As usual after the conference there were two days to actually work on Plone. The hotel had to quickly open another big room to accommodate all sprinters since many more people showed up this time than  expected. On saturday morning you could see the titanpad exploding when people started adding the topics they wanted to work on. I worked with a great team of developers on the default contenttypes of Plone 5, mainly focusing on making it easy to migrate the content of existing websites to Dexterity. Other results can be seen at the titanpad and here.

In 2015 the Plone Conference will be in Bucharest. I wouldn't miss it for the world.

 

Extended Mastering Plone Training in Munich in Spring 2015

erstellt von pgerken — zuletzt geändert: 2014-11-11T19:16:14+01:00
We love to teach more than what is possible in two or three days. Because of this, we will offer an extended Plone training in wonderful Munich in spring 2015

When we prepare a training, we always create more material than what we can walk through in the short amount of time we have available.

We decided that we want to offer you more by extending the training period to 5 days. In 5 days we can cover the material deeper have more exercises and additional topics.

The additional topics include:

  • How to work with relations
  • How to test everything using plone.app.testing and robot-framework
  • Building forms and control-panels with z3c.form

We would love to have you with us.

More information is available on our dedicated training page.

Update: By popular demand we moved this training from november 2014 to 2. - 6. March 2015. We will  inform everyone who contacted us about the training about the new date.  

A reminder about catalog-indexes

erstellt von Philip Bauer zuletzt geändert: 2014-05-21T05:56:13+01:00
We often create new indexes to make content searchable in Plone. Many developers still do it wrong.

Most new sites we create contain facetted search based on eea.facetednavigation. Thus we often create new indexes to make content searchable. One example is www.idea-frankfurt.eu where attributes and relations of projects are used to make them searchable in a useful way.

Almost everything that is to be said about indexes can be found in http://docs.plone.org/develop/plone/searching_and_indexing/indexing.html

But there was a known pitfall when registering indexes in catalog.xml that was only fixed in Plone 4.3.2. Even though Maurits van Rees warned about this in a blogpost which is also reference in the documentation I often see developers making that mistake.

Unless working with Plone 4.3.2+, you should never register a index in catalog.xml because the index will be purged when reinstalling your package. Instead register new indexes in your setuphandlers.py. This was fixed in GenericSetup 1.7.4.

I firmly believe that addons have to be reinstallable without ruining a site.

I extended the method written by Maurits to separate the name of the index and the indexed method (useful when dealing with old code):

# -*- coding: UTF-8 -*-
import logging
from Products.CMFCore.utils import getToolByName
PROFILE_ID = 'profile-my.package:default'


def setupVarious(context):

    # Ordinarily, GenericSetup handlers check for the existence of XML files.
    # Here, we are not parsing an XML file, but we use this text file as a
    # flag to check that we actually meant for this import step to be run.
    # The file is found in profiles/default.

    if context.readDataFile('bgp.webcode_various.txt') is None:
        return

    # Add additional setup code here
    logger = context.getLogger('my.package')
    site = context.getSite()
    add_catalog_indexes(site, logger)


def add_catalog_indexes(context, logger=None):
    """Method to add our wanted indexes to the portal_catalog.

    @parameters:

    When called from the import_various method below, 'context' is
    the plone site and 'logger' is the portal_setup logger.  But
    this method can also be used as upgrade step, in which case
    'context' will be portal_setup and 'logger' will be None.
    """
    if logger is None:
        # Called as upgrade step: define our own logger.
        logger = logging.getLogger('my.package')

    # Run the catalog.xml step as that may have defined new metadata
    # columns.  We could instead add <depends name="catalog"/> to
    # the registration of our import step in zcml, but doing it in
    # code makes this method usable as upgrade step as well.  Note that
    # this silently does nothing when there is no catalog.xml, so it
    # is quite safe.
    setup = getToolByName(context, 'portal_setup')
    setup.runImportStepFromProfile(PROFILE_ID, 'catalog')

    catalog = getToolByName(context, 'portal_catalog')
    indexes = catalog.indexes()
    # Specify the indexes you want, with
    # ('index_name', 'index_type', 'indexed_attribute')
    wanted = (('myindex', 'FieldIndex', 'getMyAttribute'),
              )
    indexables = []
    for name, meta_type, attribute in wanted:
        if name not in indexes:
            if attribute:
                extra = {'indexed_attrs': attribute}
                catalog.addIndex(name, meta_type, extra=extra)
            else:
                catalog.addIndex(name, meta_type)
            indexables.append(name)
            if not attribute:
                attribute = name
            logger.info("Added %s '%s' for attribute '%s'.", meta_type, name, extra)
    if len(indexables) > 0:
        logger.info("Indexing new indexes %s.", ', '.join(indexables))
        catalog.manage_reindexIndex(ids=indexables)

By the way: Besides many other amazing features the package ftw.upgrade also has methods catalog_rebuild_index, catalog_add_index and catalog_remove_index you an use in your upgrade-steps.


Mastering Plone

erstellt von Philip Bauer zuletzt geändert: 2014-05-20T16:47:00+01:00
A three-day introduction into customizing and developing websites with Plone

tl;dr: We're giving our three-day "Mastering Plone" training in Munich (in english)

During the course of this three-day training we will teach how to

  • ... wield the awesome features of Plone for maximum effect.
  • ... customize and extend Plone to make it do exactly what you want.
  • ... use the current best-practices to become a Plone rockstar.

In the first part we'll teach the fundamentals needed to setup and manage your own website using the many build-in features of Plone.

The second part will focus on customizations that may be done through-the-web.

The third and longest part will be devoted to Plone-development. Here we focus on current best-practices like Dexterity and Diazo that make developing with Plone fun and accessible.

The training is for people who are new to Plone or used to work with older versions of Plone and want to learn the current best-practices. Basic Python and HTML/CSS skills are a requirement.

The course is an updated and expanded version of the trainings we held at the international Plone-Conferences in Arnhem and Brasilia. The documentation for these can be found at http://starzel.github.io/training

As always, we give the training as a team of two Trainers. This way you'll receive a 1on1 training as soon as something works differently than expected. Something that is not possible with a single trainer and something that adds a lot of insight when something did not work as expected.

If you're interested call us at +49 (0)89 - 189 29 533 or send a mail to

Date:
26. - 28. May 2014

Time:
9:00 - 18:00

Location:
EineWeltHaus
Schwanthalerstr. 80
80336 München

Trainers:
Philip Bauer
Patrick Gerken

Language:
English

Cost:
EUR 1000.- per person plus 19% MwSt (VAT)
Please talk to us if you might be eligible to a discount (Student, Member of the international Plone-community and so on...)

Photo: https://www.flickr.com/photos/mindonfire/4447448937

Update (20.05.2014):
Due to illnesses we currently have three open slots for the training. Talk to us if you are interested.

We are working hard on updating the training. Here are some highlights:

  • We now use plone.app.contenttypes from the beginning
  • More dexterity-types (without grok)
  • Custom search using eea.facetednavigation
  • Infos about debugging
  • We now teach the use of plone.api
  • ...

Sprinting towards Plone 5

erstellt von Philip Bauer zuletzt geändert: 2017-03-01T12:22:06+01:00
The drive towards Plone 5 is gaining momentum as the goal seems to be in a reachable distance.

For the first time there actually is a state of Plone 5 that is can be shown to people who are interested in the future of Plone. The essential building-blocks of Plone 5 are starting to look presentable: The new barceloneta-theme is really nice and comes with the new toolbar and the new widgets.

Don't get me wrong, there is still quite some work to be done before a final release but the first alpha-release is in the making and the current state can actually be shown. These screenshots are from a fresh build of the coredev.buildout.

plone5-left-2.png plone5-top-2.png plone5-edit-2.png

To reach Plone 5 the Plone-community is organizing a staggering number of sprints. My sprint-plan for 2014 looks like this: Cologne, Munich, Munich (again), Sorrento, Berlin, Bristol.

I recently attended the cathedral-sprint in Cologne, organized by the tireless Timo Stollenwerk and generously sponsored by GFU Cyrus AG. Timo, whose sole purpose in life sometimes seems to be to keep Jenkins happy, organized another impressive display of the spirit of the Plone-community as 30 people from around the world gathered there to work in groups on pushing Plone 5 towards readiness. It is great to see so many originally separate efforts coming together smoothly and making a whole new thing that will be at the core of Plone 5.

Together with Johannes Raggam, Wolfgang Thomas and some help from others I was continuing the work on plone.app.contenttypes and we made good progress. The current version 1.1b2 of the new default-content-types for Plone 5 has a multitute of bugfixes and some relevant changes compared to version 1.0:

  • Collections are now a behavior that can be enabled on any content-type. The collection-type is basically a folder with that behavior.
  • The shiny new event-type now uses the behaviors provided by plone.app.event including support for recurring events and timezones.
  • Richtext-fields are now a behavior shared by most types.
  • We now have migrations from 14 different content types to the new types including migrations for four (!) iterations of the event-type.

I have been using plone.app.contenttypes since before the project officially existed and I think every plone-developer should give it a try and report any issues especially regarding migrations to make it safe to ship with Plone 5.

It was a real pleasure being reunited with old friends and making new ones. It is especially encouraging that even at sprints there are always new people showing up and contributing to Plone.

The next big sprint on my agenda is the Wine-and-Beer-Sprint in Munich. For the second time we are organizing this sprint together with our friends from Syslab.com and again it is a double-sprint with a leg in Munich and one in Capetown. We will continue working towards Plone 5. The necessary tasks to get Plone 5 out of the door are summarized in this ticket: https://github.com/plone/Products.CMFPlone/issues/184.

Register now since we only have a limited amount of places! If you really need additional incentive to attend, here they come: A fine selection of Single Malt Whiskeys, a great sprint-location that is accessible 24h, Sichuan Hot Pot and white sausages (not to be mixed).

The Wine and Beer-sprint is is preceded by the DocSprint (also in Munich) that focuses on consolidating, improving and versioning(!) the documentation for Plone.

See you in Munich and elsewhere!

How to handle unknown meta_type in GS

erstellt von pgerken — zuletzt geändert: 2013-05-15T09:21:27+01:00
We were lost when supporting multiple Plone versions with generic setup and the typeinfo step. Soon there won't be the Topic type any more. Removing declarations for the Topic type and leaving users of old Plone-Versions behind is no option. We found a way to handle it in a single profile.

Our package collective.noticeboard should work with somewhat older Plone sites and new and shiny ones that ditch AT in favor of using DX all the way down.

Therefore we must declare an available view for Topics even though Topics might not exist in the targeted Plone sites.

Trying to import our profile in such a case results in a traceback like that:

Module Products.GenericSetup.utils, line 509, in _importBody
Module Products.CMFCore.exportimport.typeinfo, line 210, in _importNode
Module Products.GenericSetup.utils, line 570, in _initObjects
- __traceback_info__: ('Topic', '')
ValueError: unknown meta_type ''

We don't want to create confusion by adding multiple profiles and we don't want to enable different profiles in zcml based on import statements, because if you have a Topic or not is decided during runtime.

Fortunately there is an undocumented feature hidden in GS: You can declare your type declaration as deprecated. This way, GS does not try to initialize the object and does not try to create the type information object if it does not exist.

Be careful about this directive, this works for the typeinfo step, you have to test, if it does not miss important actions when used in other steps.

This is our new types.xml:

<?xml version="1.0"?>
<object name="portal_types"
        meta_type="Plone Types Tool">

    <object name="Folder"/>
    <object name="Topic" deprecated="True"/>
    <object name="Collection"/>
    <object name="Plone Site"/>

</object>

World Plone Day 2013 in Munich

erstellt von Steffen Lindner zuletzt geändert: 2013-04-12T13:07:48+01:00
On April 24 another WPD is upon us. We'll meet in the Seidlvilla in the heart of Munich-Schwabing.

On April 24 another WPD is upon us. We'll meet in the Seidlvilla in the heart of Schwabing.

This year Starzel.de will be presenting three talks (in german):

  • "What is Plone", a presentation of features, use-cases and the roadmap by Philip Bauer.
  • "The Plone eco-system", a wild ride through the architechture underlying Plone and how it relates to other technologies by Steffen Lindner and Patrick Gerken
  • "Pimp my Plone", a very biased presentation of favorite addons by Philip Bauer

The complete Programm can be found here. There is plenty of time for questions and discussions that can be continued into the evening when we move to a beergarden.

Attendance is free, there will be food, but sadly no cupcakes (picture taken from http://davidjb.com/blog/2010/04/good-morning-world-plone-day)

Back from the Plone Open Garden in Sorrento

erstellt von Philip Bauer zuletzt geändert: 2013-04-09T19:08:30+01:00
If you do Plone, come to PLOG next year. Bring your family.

A poster I once designed for World Plone Day said "There is no place like Plone".

wpd.png

The community surrounding Plone is in fact like family for many of us. The Plone Open Garden in Sorrento is one of the events where the Plone-family meets the Plonistas family. It was a near-perfect mixture between a holiday, a sprint and a conference.

Imaging sitting under palmtrees drinking a nice cappucino and doing some light coding while the former president of the Plone foundations splashed around in the pool with his daughter. Add to that the sight of Vesuvius, loads of italian food, great presentations and many people to have engaged discussions with. Bliss.

plog_hiking.jpg

You can even go hiking in the hills above Sorrento

It was also a very productive week. We managed to get a lot of work done  in plone.app.contenttypes that should make it ready for Plone 4.4. I gave a short talk about its state. The slides are not too informative without the demo. But I encourage everyone to use it for your next project or even try migrating a website. A new release will be out in a couple of days.

Thanks to the guys from Abstract for organizing PLOG, special thanks go to Maurizio for his infectious enthusiasm and optimism.

In short: If you do Plone, come to PLOG next year. Bring your family.

See you next year. Be prepared to meet my family :-)

wpd.countdown portlet - Counting days to World Plone Day

erstellt von Steffen Lindner zuletzt geändert: 2013-02-22T19:58:00+01:00
wpd.countdown is a portlet for promoting the upcoming World Plone Day 2013.

To support the upcoming World Plone Day, we created wpd.countdown, a portlet counting down the days to the World Plone Day - 24.4.2013.

Help us spread the word about the World Plone Day and embed the portlet into your Plone site. The installation is easy and documented on PyPi. The portlet has a nice configlet for customizing the date and the linked URL. If you host an WPD Event, put your link in.

The code is in the collective on Github. We already added the Portlet on plone.de and starzel.de :)

wpd.countdown was developed by Starzel.de based on wpd.mmxi.countdown by Simples Consultoria.

collective.noticeboard - a noticeboard for Plone

erstellt von Philip Bauer zuletzt geändert: 2013-02-05T16:10:11+01:00
collective.noticeboard is a Plone add-on for fancy virtual noticeboards. The board handles as intuitively like its real-live cousin.

Once you install collective.noticeboard, any folder or collection (even the site itself) can be viewed as a noticeboard. It displays the content of that folder/collection as colored sticky notes that can be moved, resized and edited.

collective.noticeboard comes with a per-board-configuration where you can select the note-type (news-items by default) and the content-types that should be displayed on the board. You can also enable adding new notes when clicking on the canvas and create an archive for outdated notes.

The advantages to websites that offer a similar features as a service are obvious:

  • The data lives only on your server, which is non-negotiable for intranets.
  • The code is open source, you can adapt it to your needs.

The board works with archetypes and dexterity-types. Yes, you can use it with plone.app.contenttypes!

Since the content has the default workflow, notes are usually not published after creating when using Plone out-of-the-box. We included an option to auto-publish new notes to work around this. Use it with care.

Most of the board-functionality is in javascript using backbone.js and jQueryUI. Feel free to copy that code and integrate it into other backends. To create sticky notes you'd only need a few lines of javascript and jQueryUI (see this jsfiddle for the full example):

$(function () {
$(".notewrapper")
.resizable()
.draggable();           
});

Our javascript-code is a little more complex since we have to deal with a lot more UI, overlays, TinyMCE and so on.

The code can be found on GitHub. The package is on PyPi.

Starzel.de developed collective.noticeboard for the German Institute for International Educational Research (DIPF).

Report from the Munich-leg of the Wine-and-Beer-Sprint

erstellt von Philip Bauer zuletzt geändert: 2013-01-30T13:39:12+01:00
tl;dr: Successful Plone Sprint roundup mentioning wormhole, beer, white sausages and huge progress in the plone.* namespace :)

Last week about 40 people met from Thursday to Sunday in Syslab's Office in Munich for the Wine and Beer Sprint to push Plone forward. I was awed by the large number of people willing to attend, we actually had to close the list a few days before the event since having more than 40 people in the office would have been too bad for air-quality. As it turned out, Syslabs office is a great location to host a sprint since it not only has one huge room but also several smaller ones where groups of people could work in conclave.

We had a mixed crowd of seasoned (2/3) and first-time (1/3) sprinters. What was especially great was the attendance of some people from the local Python user group (that recently merged with the Plone user group), one of them a django-guy who took his first steps with Plone.

Munich was frozen solid during the sprint, a fact that was driven home by the people from the other leg of the sprint (in Capetown, South Africa) who were sitting in the sun wearing t-shirts grinning at us through the wormhole we set up to link the sprints. From what we could understand (wormhole-technology is still only in alpha-state) they had a great time even though they could not get ice for their drinks by stepping outside.

The sprint was very productive, here are some noteable results:

  • The team working on plone.app.multilingual managed to get a release-candidate out. The next-generation translation machinery (that works for Dexterity and Archetypes) is production-ready. At Starzel.de we've been using early stages of it in production together with plone.app.contenttypes for over a year now and are very happy.
  • Together with Timo Stollenwerk I was trying to get people to work on plone.app.contenttypes since I believe that Plone with dexterity-based default-types is a huge win for users (who can extend their types without paying a developer) and developers (who can focus on more challenging tasks than creating simple content-types). We managed to release 1.0b1, although not all features made it into the release and the documention needs more love. Thanks to the work of many (inluding Carsten Senger, Pavel Bogdanovic, Manuel Reinhardt, Tom Blockley, David Glick and my dear coworkers Patrick Gerken and Steffen Lindner) the package now has migrations from Archetypes, working indexes, robot-framework-tests and much more. Timo and me will work on a PLIP for it.
  • A group around the tireless Nejc Zupan managed to release Version 1.0rc1 of plone.api, an effort started at the Plone Konferenz 2012 in Munich (with a "k").
  • Some people worked on Patterns, a javascript-framework aiming to bring webdesign and development together. They fixed a ton of bugs and revamped their website. Rok Garbas worked on making patterns useable in Plone, most noteably plone.app.toolbar and plone.app.widgets.
  • Domen Kožar worked on mr.bob [http://mrbob.readthedocs.org/en/latest/], a successor to paster.
  • Besides working on plone.app.contenttypes Timo Stollenwerk also worked on getting rid of formlib and portal tools. Now all control panels have been migrated to either plone.autoform or plone.app.registry. Timo also held a tutorial on test-driven-development in which he started collective.ploneboard, a rewrite of Products.Ploneboard from scratch with Dexterity and plone.app.discussion. Plus: Timo learned that Augustiner Edelstoff is really good beer :-)
  • Plone.de and the Website of the Python Software Verband have been updated, enhanced and their code moved to github.
  • We saw a very promising sneak preview of new designs and mockups for Plone.com and Plone.org.
  • After the last report-out with South-Africa I even managed to give a short plone-development tutorial by showing collective.team a workspace-ish behavior for Dexterity-folders, that sadly did not see any progress during the sprint.

The non-coding part of the sprint was also a success. The mountain of white sausages that we prepared for the Weisswurstfrühstück will stay in my memory forever. Contrary to the title of the sprint, coffee, Club Mate and Single Malt Whiskey were more popular than beer.

Thanks to Alex Pilz and Florian Friesdorf who not only volunteered their offices to the sprint but also did most of the organizing and were great hosts. Thanks to the Python Software Verband for sponsoring beverages and food.

The biggest thanks goes to the many sprinters who chose to spend their time to come to the sprint to improve Plone when they could have done so many other things. The spirit of friendship and the dedication of people in the Plone Community to give back continues to humble me and makes me glad and greatful to be part of that.

Last Preparations for PloneConf

erstellt von pgerken — zuletzt geändert: 2012-10-02T12:52:07+01:00
Philip and I are doing our last steps for the plone training. Also, we ask each other what else we could forget, did you miss any of these?

We are in the last steps for our two-day Training "Mastering Plone". As far as I can tell we'd still welcome more people. We just sent our a mail to the participants about how to prepare a virtual machine with vagrant for the conference. It installs Plone's unified installer in a ubuntu 12.4-box with puppet using the systems python 2.7. Hopefully everyone should have the same Plone running on their laptops even before the training starts on Monday morning.

Apart from that, don't forget:

  1. Internet in Hotels can be slow. It might be better to get a local card than to disable roaming on your phone. Here is a list of dutch sim card providers with data plans: http://prepaidwithdata.wikia.com/wiki/The_Netherlands
  2. Don't trust WiFi! From what I have heard, it has happened in the past that Wifi routers have been stolen during the conference, hacked for data sniffing and reinserted into the conference LAN, probably with key loggers. I am pretty sure you access your customers plone sites via https only (wink, wink!), but what about your phone apps, you know they won't transmit your password in clear text? Don't take any risks, use a VPN! http://vpnreviews.com/
    I have had bad experiences with HideMyAss btw, as soon as I was in brazil, they thought my VPN account was used for fraud and asked for some details I didn't have with me, to not cancel my account. Apparently they want you to use HMA from home only.
  3. Sleep as much as you can before you go. You won't get any sleep during the conference.

See you in Arnhem!

Security Patch Party auf der PyCon DE

erstellt von pgerken — zuletzt geändert: 2011-09-29T21:18:25+01:00
Während unserer Plone Schulung auf der PyCon DE wird ein Security Patch für Plone veröffentlicht. Wir machen eine Patch Party draus.

Pünktlich zu der deutschen Python Konferenz in Leipzig wird einer der seltenen Security Patches für Plone veröffentlicht.

Dieses wurde im Vorfeld angekündigt, damit sich alle Anwender von Plone vorbereiten können, um den Patch zeitnah zur Veröffentlichung einzuspielen. Wer ganz auf Nummer sicher gehen möchte, fährt seine Dienste kurz vor der Veröffentlichung runter, installiert sofort nach Veröffentlichung den Patch und fährt danach Plone wieder hoch. Dank der guten Vorbereitung durch das Plone Security Team sind diese Schritte bei den letzten Patches immer reibungslos verlaufen.

Dieses mal findet die Veröffentlichung lustigerweise gegen Ende unseres Plone-Tutorials auf der PyCon DE statt. Wir haben uns daher kurzfristig dazu entschlossen, im Anschluss an unser Tutorial eine Patch Party zu machen. Jeder der auch Plone Seiten patchen muss ist herzlich eingeladen am Dienstag den 4.10. ab etwa 16:45 zu unserer Plone Schulung zu kommen. Dieses Angebot gilt sowohl für alte Hasen die genau wissen was sie tun als auch für Neulinge die sich unsicher sind, ob sie den Patch ohne Probleme einspielen können. Die alte Hasen können den neuen Hasen dann helfen ihre Seiten zu patchen.

Falls notwendig erklären wir bis 17:00, wie man den Patch vorbereiten muss und geben Tipps um zu prüfen, ob man beim Patchen mit Problemen rechnen muss. Zudem verraten wir wie wir all die Seiten, die wir auf den verschiedensten Servern betreuen, weitgehend automatisiert patchen.

Happy Patching!

World Plone Day 2011

erstellt von Philip Bauer zuletzt geändert: 2011-07-14T16:13:12+01:00
Am Mittwoch, den 27. April ist es wieder soweit: Der inzwischen vierte World Plone Day steht an und wird in München wie gehabt in der Seidlvilla stattfinden. Vormittags gibt es Einführungsvorträge und nachmittags auch solche, die selbst gestandenen Plone-Kennern und Plone-Könnern etwas spannendes bieten.

Der fast schon traditionelle 'Pimp my Plone'-Vortrag wird diesmal ausfallen, weil ich mit Vorträgen über Deliverance, Through-the-web-development und die Zukunft von Plone mehr als ausgelastet bin. Doch gerade in letzterem zeige ich ein paar Funktionen künftiger Plone-Versionen, die getrost unter diese Kategorie fallen könnten. Also doch:

Pimp my Plone

Das beste wird trotzdem wie immer der Ausklang bei hoffentlich schönem Wetter im Biergarten sein.

Wer sich für Content Management-Systeme interessiert oder einfach nur wissen will ob Plone vielleicht eine gute Lösung für eine geplante Webseite ist sollte einen Blick riskieren. Die Münchner Plone-Usergruppe ist sich nicht zu schade alle Fragen zu beantworten.

Programm

Anmeldung

Plonator-sprint - report on day one

erstellt von Philip Bauer zuletzt geändert: 2011-04-04T08:28:58+01:00
Yesterday the Plonator-Sprint kicked off. We got some way to establish a common website for the german, austrian and swiss plone-communities.

The plonator-sprint takes place at the department of informatics at the University of Munich and aims at improving the visibility of the plone-community.

The munich plone-user-group managed to get plone.de online since January 2011 after a year of back and forth about the domain. We plan to run plone.at and plone.ch on the same site. To enable the austrian and swiss communities to excert some control over the page yesterday I wrote a view that forwards visitors to country-specific landing-pages. Visitors of plone.de will end up at www.plone.de/de and visitors of www.plone.at at www.plone.at/at - de and at being folders with a collection as default_page and custom teaser-images.

At the moment we are knee-deep in a discussion about plone, open-source and marketing. This afternoon we'll visit the munich strong-beer festival…

Securing Plone-Sites with https and nginx

erstellt von Philip Bauer zuletzt geändert: 2015-10-04T15:26:28+01:00
At the plonator-sprint I finished a nginx-config to secure all authenticated traffic via https.

Some noteable things:

  • There is more than one login-form. In fact I counted at least six different login-forms. Ever heard of 'failsafe_login_form'? Searching for /login_form will not be enough.
  • The page you get after logging out has it's own login-form. Since I use this page to switch back to http I chose to remove the form by customizing the template 'logged_out.pt'.
  • Since I redirect to https when Plone' s Authentication-cookie '__ac' is present calling '/logged_out' while still logged-in would result in an infinite recursion. That's why I break before the rule is called when '__ac' is still set.
  • Don't use the login-portlet since I don't see how it can be delivered via https if you want to deliver the site with normal http.
  • Never ever expose your zope-root or login using the zope-admin-Account via http since the zope-admins password is only uuencoded in a cookie!

Here is my config:

upstream myzope {
server localhost:8080;
}

ssl_certificate      /home/starzel/nginx/starzel.crt;
ssl_certificate_key  /home/starzel/nginx/starzel.key;

# http
server {
listen myserver.com:80;
server_name www.mysite.com;
access_log /var/log/nginx/mysite.com_access.log;
rewrite ^(.*)(/login_|/require_login|/failsafe_login_form)(.*) https://$server_name$1$2$3 redirect;
if ($http_cookie ~* "__ac=([^;]+)(?:;|$)" ) {
rewrite ^(.*) https://$host/$1 redirect;
}

location / {
proxy_pass http://myzope/VirtualHostBase/http/www.mysite.com:80/Plone/VirtualHostRoot/;
}
}

# https
server {
listen myserver.com:443 default ssl;
server_name www.mysite.com;
access_log /var/log/nginx/mysite.com_access.log;
if ($http_cookie ~* "__ac=([^;]+)(?:;|$)" ) {
# prevent infinite recursions between http and https
break;
}
rewrite ^(.*)(/logged_out)(.*) http://$server_name$1$2$3 redirect;
location / {
proxy_pass http://myzope/VirtualHostBase/https/www.mysite.com:443/Plone/VirtualHostRoot/;
}
}

# zmi
server {
listen myserver:443 ssl;
server_name manage.mysite.com;
access_log /var/log/nginx/heeschmusik_zmi.de_access.log;
location / {
proxy_pass http://myzope/VirtualHostBase/https/manage.myserver.com:443/VirtualHostRoot/;
}
}

The cookie-regex explained (thanks to Hanno Schulz and Vlad Vorobiev for their wisdom): $http_cookie (which is a string) is searched for anything containing '__ac=' followed by 1 or more characters which is not ';' (which would mean the cookie has no value), followed by either an ';' (signaling the beginning of another cookie) or the end of the line. If you are as ignorant of regex as me you might consider keeping this regex-cheatsheet close.

By the way, this site neither uses nginx nor is it not secured. But this one is: www.heeschmusik.de. I plan to move most sites to nginx in the near future.

Feeback appreciated.

World Plone Day 2010 in Munich. Register now!

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:03:36+01:00
Tuesday night at the usergroup-meeting we finalized the program for World Plone Day 2010 in Munich. I'm pretty exited about what I think will be the best World Plone Day ever.

This year the we mainly focus on how Plone enables communes and other public institutions to create complex portals and intranets. Therefore we have a very loooong session on the inclusion of various aspects of various stuff. LDAP, SQL-databases, design, internal applications like room-planners and content are normally already in-place when Plone comes along. So we try to show how to make all these things work together nicely without throwing them away or reinventing the wheel.

I also get a chance to give a updated version of my all-time-favorite presentation about some amazing add-ons for Plone that exists through the hard work of others. I was thinking about calling it "Plone — straight or on-the-rocks?" but stuck with "Pimp-my-Plone".

We have some non-technical talks about Plone in the morning and some more in-depth talks in the afternoon. Plus case-studies and enough time for discussions. And: we go to a pub afterwards :-)

Check out the full programm and register now at http://muenchen.worldploneday.de/anmeldung

How to get a different look for some pages of a plone-site

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:03:27+01:00
It's pretty easy to attach a special look to whole sections. Styling only some pages is a different story.

I'm currently working on a site where the customer wanted some pages to look differently than others.

(I should really not do the "Hey you could also do this and that" when my time is limited!)

The pages should have a additional css and a line of text above the heading. I wanted it to look like this:

foo

Here "what if foo..." is the Name of the folder that contains the document "...hits the bar?", being the h1.

Since the old trick with body.section-foo only works for whole sections and I needed the additional text (what if foo...) anyway I decided to go with the beloved marker interfaces.

Here is how it works:

1. Add a marker interface

In your theme-product edit your browser/interfaces.py and add:

class IMySpecialStyle(Interface): 
    """Marker Interface for  Documents with a special style
    """

 

2. Register a viewlet pinned to the Interface

In your browser/configure.zcml add:

<browser:viewlet 
   name="myspecialstyle.viewlet " 
   manager="plone.app.layout.viewlets.interfaces.IAboveContentTitle" 
   template="templates/myspecialstyle_viewlet.pt" 
   layer=".interfaces.IThemeSpecific" 
   for=".interfaces.IMySpecialStyle" 
   permission="zope2.View" 
   /> 

<browser:resource 
   name="myspecialstyle.css" 
   file="resources/myspecialstyle.css" 
   /> 

The line for=".interfaces.MySpecialStyle" activates the viewlet only for content which have the marker-interface. The viewlet-manager IAboveContentTitle inserts the viewlet just before the h1-tag of the targeted document.

 

3. Add content and styles

Now add a file browser/templates/myspecialstyle_viewlet.pt containing:

<link href="myspecialstyle.css" rel="stylesheet" type="text/css" 
      tal:attributes="href string:${context/portal_url}/++resource++myspecialstyle.css"/>

<div id="myspecialstyle-viewlet">
   <h2 class="myspecialstyle-header" 
       tal:content="python: context.getParentNode().title">
          what if foo ...
   </h2>
</div>

Instead of "getParentNode.title" I could also enter the expected line of text by hand. But like this I can reuse it for other folders.

Keep in mind that for default-pages you might want the 'grandparent‘, so you could use this

tal:define="is_default_page context/@@plone_context_state/is_default_page"

to check if it's a default page, and

tal:condition="is_default_page"
tal:content="python context.getParentNode().getParentNode().title"

to get the grandparents title.

Now create browser/resources/myspecialstyle.css and add:

#myspecialstyle-viewlet {
	position: absolute;
}

.myspecialstyle-header {
	bottom:1.45em;
	font-family: "Arial Black";
	font-size: 500%;
	font-weight: bold;
	left:-22px;
	color: #e1e1e1 !important;
	position:relative;
	z-index: 0;
}

h1.documentFirstHeading {
	z-index: 1;
	position: relative;
	padding-top: 10px;
}

 

4. Use it

Restart Zope. In ZMI go to the page in question (or rather add /manage_interfaces to it's url), select IMySpecialStyle from the available Marker Interfaces and add it.

If you remove everything from the viewlet except for the <link ...>-stuff you get a really simple way to style some selected pages.

 

 

Pydev Extensions now Open Source!

erstellt von Philip Bauer zuletzt geändert: 2014-06-30T13:03:12+01:00
A great tool for python (and Zope/Plone)-development just got better

The good News:

Pydev is a great eclipse-Plugin for which I primarily use for Plone- and Zope-Development. Pydev 1.5 now includes the formerly closed-source Pydev Extensions. Check out it's amazing features.

Learn more about Plone-Development with Eclipse and Pydev at my talk at the dzug-conference in Munich next week.

 

The bad news:

It happend only two weeks after I renewed my License for Pydev-Extensions :-(

Custom search forms for plone-sites

erstellt von Philip Bauer zuletzt geändert: 2015-10-04T15:45:59+01:00
Sites with a lot of content profit hugely from custom searches. Until recently adding a custom search to a Plone-Site was cumbersome and nothing your average editor or site-admin could do.

Ever since Ross Patterson wrote collective.formcriteria all will be well.

Stop writing search forms for each and every special case by hand and start thinking of search-forms as content just like collections are custom search-results as content. Ross saved us a lot of hassle by extending these almost all-powerfull collections to create custom forms searching through the collections content. And as added value displaying the results in a much nicer and more useful way than the default search.  

Say, you want a searchfield in your site only to search through the press-releases of all your departments.

  • First add collective.formcriteria to your buildout and install it via quickinstaller.
  • Create a new collection "Press-Releases".
  • Select "summary view" as Form Results Layout in the edit-tab of your collection (thus giving you the added value of preview-images being shown if the searchable content type has a image-field, e.g. news-items).
  • Edit the collections criteria and add the contenttype "News Item" (or the folder where you put the press-releases if you don't use a special contenttype) as a criterion.
  • Use "relevance" to sort the results.
  • Add "Searchable text" as criterion without entering a text (if you choose to enter something it'll populate the search-field as default-value) and select this field to show as "Form Fields".

Your new collection now shows you all your news items. Yawn! But when you switch the display to "Search form" the content of your collection disappears and a new search field is shown. Nice!

I prefer search-forms in portlets: Create a "Search form portlet", connect it to your collection. Voilá: custom search - whereever you want it. And that was a only an easy example.

More goodness in the most recent version include:

  • The "Content"-tab now works just like with a folder, meaning you can use content-actions like copy, rename, change state and such for your search results even if they are in different folders. With that collective.formcriteria outperforms the default search in almost every aspect.
  • The new "export"-Action allows you to save the results to CSV. You can specify the used columns via in the collection's "Table Columns" fields.

For custom searches using operators such as OR or NOT you still need to write your own search-forms using AdvancedQuery (and possibly anthill.querytool). But an implementation of these operators using subcollections is already on the ToDo-List.

Get it here: http://pypi.python.org/pypi/collective.formcriteria/

Interaktiver Stadtplan "Topographie des Nationalsozialismus in München"

erstellt von Philip Bauer zuletzt geändert: 2012-06-13T10:29:31+01:00
OpenLayers und Plone sind ein gutes Team zur Darstellung von geografischen Informationen.

Starzel.de hat für das geplante NS-Dokumentationszentrum München seit einiger Zeit einen interaktiven Stadtplan entwickelt der nun endlich online gegangen ist. Der Plan zeigt einen Querschnitt von historisch bedeutsamen Orten, die zwischen 1918 und 1945 Schauplätze von Aufstieg und Herrschaft des Nationalsozialismus waren sowie Orte die mit Resistenz und Widerstand gegen das NS-Regime verknüpft sind.

Erweiterungen um weitere Karten, z.B. zu Erinnerungsorte an den Nationalsozialismus in München sowie Orte der künstlerischen Auseinandersetzung sind in Vorbereitung. Für den ThemenGeschichtsPfad "Der Nationalsozialismus in München" entsteht zudem eine Online-Variante mit Audioguide-Einbindung.

Eine Vorversion der Software auf Basis von scriptaculous ohne Anbindung an Mapserver (d.h. mit statischen Bildern) haben wir u.a. für eine Seite über Bayerische Berufsschulen verwendet.

Developing Plone on Ubuntu 9.04 with virtualenv

erstellt von bleicher — zuletzt geändert: 2011-02-18T15:52:24+01:00
Technical notes to overcome some obstacles

Ubuntu 9.04 "Jaunty Jackalope" removed python 2.4 libraries from the distribution, which are necessary to run Zope/Plone.

To work in a more defined environment, where other as the system libraries are installed for a specific python, people use virtualenv.

Install virtualenv, python-2.4 from the distribution repository.

Create a 

virtualenv -p python2.4 --no-site-packages myappdir

In myappdir,

source bin/active

sets some environment variables.

I use zsh with the "nounset"-Option, which the script doesn't work with, so I had to

unsetopt nounset

Install ipython or zc.buildout or other eggs you need

easy-install ipython

PIL aka python-imaging is not longer available in a a 2.4 version in Ubuntu 9.04, but contains a lot of binary code so I didn't want to build it myself.  3 options: Install an old python-imaging-2.4-package,

Install it by hand - easy_install --find-links http://download.zope.org/distribution PILwoTK or untar and python setup.py install and before that, you have to install some other image handling libs to get all the features as explained here  http://sam.stainsby.id.au/blog/?p=28

sudo apt-get install libjpeg-dev libfreetype6-dev (zlib?)

or. what I did, install the current package and link to it from the virtualenv.

In myappdir/lib/site-packages

ln -s /usr/lib/python2.5/site-packages/PIL PIL

Python complains about differing C API versions, but it seems to work.

This all looks less than perfect, esp. the PIL link hack.

Too many packaging tools.