[3411 total ]
Zea Partners: Come see Plone at IMS 2009 in London Dec 2nd - 4th

Once again, Plone will be exhibiting at the IMS 2009 Expo. IMS, together with the Online Information 2009 conference, takes place the 2nd - 4th December at Earls Court Olympia, London.

Roberto Allende: Five years’ entrepreneurship with Free Software

During the first forum of University Expansion of the School of Mathematics, Astronomy and Physics (FaMAF) of the National University of Cordoba, I gave a talk on entrepreneurship in which I discussed the ground covered during the last five years.
Menttes is an undertaking formed by FaMAF graduates and students.

Lennart Regebro: Review: Veda Williams – Plone 3 Theming

I got a review copy of Veda Williams book “Plone 3 Theming“, which I have now finally read. I was positively surprised about the depth and detail of the book, it contains information not only on skinning, but explanations of how the Zope ... [More] Component Architecture works, and how to override a portlet view. That means the book is useful all the way up until you start actually developing new products yourself. It also means that Packt Publishing has covered the Plone development spectrum, with Practical Plone 3 as an introduction into using and managing Plone, Plone 3 Theming to cover how to start making modifications, and finally Professional Plone Development when it’s time to go hardcore. Practical Plone 3 and Plone 3 theming also works to teach a beginning developer those skills needed to really grasp Professional Plone Development, which is a tersely written book that doesn’t explain much, but relies on code examples to teach you what you need. Efficient, but not easy.

There is a big caveat emptor with Veda Williams Plone 3 Theming, though. Recently in the Plone world, a new technique for theming sites known as Deliverance or XDV has started to get popular. Using Deliverance is a completely different technique and mindset from the old way of theming a Plone site, and although Plone 3 Theming has a chapter on this, it’s very brief. That’s understandable because it’s a new technique where people haven’t yet discovered all the pitfalls and best procedures, but  it does mean that of you are handed a new project today, and need to theme that site, this book may not be what you are looking for.

However, the depth of detail and clear explanations in Veda Villiams books means that it’s going to work well for anybody who have an ongoing Plone 3 project or need to take over an Plone 3 site that is in production and needs to know how to theme that site. I also think it’s a good book for somebody who has read “Practical Plone 3″ and wants to know more of what is going on behind the scenes of Plone, but find Martin Aspelis book too hardcore.

Posted in plone, theming [Less]

Zea Partners: Plone wins 2009 Best Other Open Source CMS award

After three months of intensive nominations and voting, Packt Publishing is pleased to announce that Plone has won the Best Other Open Source CMS Category in the 2009 Open Source CMS Award.

Zea Partners: Questioning EC leadership on interoperability

Open Forum Europe (OFE) has reacted strongly against a leaked draft of the revision to the European Interoperability Framework (EIF), expressing deep disappointment with the new wording and serious doubts about the transparency of the process that ... [More] led to it. Letters have been sent to the responsible Commissioner Kallas and Director General Garcia-Moran, and to the CIOs of all Member States calling for a withdrawal of the document. It has also contrasted it to the statement made by the Swedish Presidency last week. [Less]

Reinout van Rees: Tempfile path normalisation in doctests

Tempfile doctest problem
In doctests, I often need a temporary directory for the duration of the test.
In the test setup/teardown code, I create it and clean it up afterwards. So
the test setup/teardown methods looks something ... [More] like:

import tempfile
import shutil

def setup(test):
test.tempdir = tempfile.mkdtemp()
# other stuff
test.globs.update({'tempdir': test.tempdir})

def teardown(test):
shutil.rmtree(test.tempdir)

In the doctests, I can now use the tempdir variable that got injected into
the test globs (=globals):

The test setup created a temp directory for us:

>>> print tempdir
/tmp/kdf34klsdj3200880f/

This directory is placed inside the default
temporary directory on our os, which is:

>>> import tempfile
>>> tempfile.gettempdir()
'/tmp'

Well, not quite. The name of the tempdir is different all the time. And
/tmp can be /var/tmp. And on osx it is something like
/var/folders/qC/qC6d69l0EDe-sx-yyKchqU TI/-Tmp- and sometimes
/private/var/folders/qC/qC6d69l0EDe-sx-yyKchqU TI/-Tmp-.

So you can opt to use ..., the doctest standard placeholder for
"something". But that can hide something:

The ... matches a lot:

>>> delete_files_but_not_too_much()
deleted ...
deleted ...

So we think we just deleted two files, but the ... also matches
complete sets of lines, so the following test could also pass:

>>> delete_files_but_not_too_much()
deleted ...
deleted ...
deleted ...
deleted ...

Oops.

Partial solution: normalize tempdir
You can pass a doctest output normalizer to your testrunner. For instance:

from zope.testing import renormalizing

checker = renormalizing.RENormalizing([
# tempfile.gettempdir() is the OS's base tempdir
(re.compile(re.escape(tempfile.gettempdir())),
'TMPDIR')])
# Don't forget to pass the checker to the testrunner.

This grabs the default base temporary directory where tempfile creates its
items. So tempfile.mkdtemp() creates a temporary directory inside the
tempfile.gettempdir() folder. Your doctests can be more explicit this
way:

TMPDIR is the base temporary directory

>>> delete_files_but_not_too_much()
deleted TMPDIR/...
deleted TMPDIR/...

Full solution: normalization with temp prefixes
You can do one better by also normalizing the actual created temporary
directory. The trick here is to call mkdtemp() with a prefix option:

...
def setup(test):
test.tempdir = tempfile.mkdtemp(prefix='mytest')
...

This creates directories like /tmp/mytest888d987f3uewer/. We cannot
directly use the created tempdir's name in a normalizer regex as the tempdir
is normally created in the setup method and the normalizer method is outside
it. The prefix helps us however in doing it anyway:

checker = renormalizing.RENormalizing([
# Normalize tempdirs. For this to work reliably, we need
# to use a prefix in all tempfile.mkdtemp() calls. We
# look for the base tempdir, followed by the prefix,
# followed by several non-slash characters.
(re.compile(
'%s/mytest[^/] ' % re.escape(tempfile.gettempdir())),
'MYTEST'),
# We probably also still need TMPDIR. Place it after
# the more specific checks otherwise it matches first...
(re.compile(re.escape(tempfile.gettempdir())),
'TMPDIR')])

Tadah, the doctest can now be really specific with no chance of erroneous
hiding of lines:

MYTEST is the tempdir the setup prepared for us

>>> delete_files_but_not_too_much()
deleted MYTEST/file1.txt
deleted MYTEST/file4.txt

OSX comment
In rare cases, osx "prepends" /private to the normal /var... base
tempdir. Mostly when you call the python executable from within your
doctest. So I had to add an extra normalizer to also detect that variant... [Less]

Repoze: repoze.bfg 1.1.1 Released

Happy Thanksgiving folks.

repoze.bfg 1.1.2 has been released. Install it via:

easy_install -i http://dist.repoze.org/bfg/1.1/simple repoze.bfg
Or via PyPI.

It is a pure bugfix release. The changelog ... [More] follows:

1.1.2 (2009-11-26)

Bug Fixes

When two views were registered with the same accept argument,
but were otherwise registered with the same arguments, if a request
entered the application which had an Accept header that accepted
either of the media types defined by the set of views registered
with predicates that otherwise matched, a more or less "random" one
view would "win". Now, we try harder to use the view callable
associated with the view configuration that has the most specific
accept argument. Thanks to Alberto Valverde. (backport from
trunk).

The ACL authorization policy debugging output when
debug_authorization console debugging output was turned on
wasn't as clear as it could have been when a view execution was
denied due to an authorization failure resulting from the set of
principals passed never having matched any ACE in any ACL in the
lineage. Now in this case, we report deny> as the ACE
value and either the root ACL or ACL found on any object in
model lineage> if no ACL was found. (backport from trunk). [Less]

Reinout van Rees: EOL end-of-line style fixer

A couple of years ago I got a script from Guido Wesdorp for cleaning up EOL
styles in svn. I've long kept a private (modified) copy of that file and only
later found out that it was from the pypy ... [More] project:
http://codespeak.net/pypy/dist/pypy/tool/fixeol (made by Holger Krekel).

The script fixes two things.

First fix: The script goes through a directory structure and fixes
non-native EOL endings in non-binary files. So the windows line endings are
gone if you work on linux (and probably vice versa, though I didn't try).

When you use svn and you work with programmers both on windows and unix, you
can get EOL differences. Windows uses \r\n, unix/osx only \n.
There's a simple fix to prevent any problems: use subversion's native EOL
style support, see for instance zope's svn explanation
on how to do it and why it is a good idea.

If you don't have it set (mostly programmers working on linux) and you add a
file, it doesn't get the svn eol-style=native setting automatically. Once
a windows programmer makes a checkout and saves it with his windows
lineendings and you re-open it on unix, you get unneeded extras at the end of
your line.

Second fix: The script goes through an svn directory structure and sets
an svn eol-style=native property on every file that does not yet have it.

I've now packaged up the script with a setup.py and released it on pypi. The source code is on bitbucket. [Less]

RedTurtle: A cloud of colors in Plone

A small customization to Vaporisation's template, an excellent product for viewing tagcloud.

Four Digits: Changing your Plone theme/skin based on the object's portal_type: Part II

In the beginning of August 2009, Roel and me started working on a new assignment: Making a site for a volunteers oganisation called Humanitas.

Humanitas
The Humanitas Association stands for a society in which people feel active and ... [More] responsible for themselves, but also take responsibility for living together. The association lends the less fortunate a helping hand, so they can move on on their own. Humanitas supports about 35.000 people in over 500 projects with over 10.000 volunteers.

Organisation structure
The structure of the organisation is leveled in four levels, from top to bottom:

Headquarters
Districts
Department
Local Project

We had to make the site for the department of Eindhoven and all there local projects. They wanted to use all the information from there projects in the department ( and later in their district ).

Plone layout:

Humanitas-nl
->
District South
-> Department Eindhoven
-> Project Home-Start
-> Project Doorstart
-> Project X..
-> Department X
-> Project X
Everything is in the same Plone site so we can use all content in all levels. Creating collections and getting all the news in the District site will show all news items form Departments and Projects, etc.

Webmaster powers
The webmaster has the power to create new Project sites, giving them different colors and logos images so they all look slightly different, but feel the same. There is no need for him to get any help for us to create new (project) sites. We are currently expanding this to the district level, so the webmaster can create new departments, from where on he can create more local projects.

Multiple projects/departments using same layout but different look.
All the projects and departments have the same layout, so we built a normal plone theme. We created a custom content-type for the projects including 3 color fields using: Products.SmartColorWidget

The edit screen for a project and changing the colors for every project:

http://maatjescontact.humanitaseindhoven.nl/

 

 

http://home-start.humanitaseindhoven.nl/

 

The py file for calling the projects.css file:

def __call__(self, *args, **kw):
"""Return a dtml file when calling the view (more easy thx to Gillux)"""
Project_props = self.getProjectCssProperties()
csscontent = template(context,
project_properties = Project_props,
portal_url = self.getPortalUrl(),
)
return  CSSPacker('safe').pack(csscontent)

def getPloneCssProperties(self) :
context = aq_inner(self.context)
dict_properties = {}
bp = context.base_properties
bpdict = bp.propdict()
for k,v in bpdict.items() :
if bp.hasProperty(k):
dict_properties[k] = bp.getProperty(k)

return dict_properties
Part of the project.css DTML file

/* <dtml-with project_properties mapping> */

/* colors */
<dtml-if hoofdnavigatieachtergrondkleur>
.documentFirstHeading {
color: &dtml-hoofdnavigatieachtergrondkleur;;
}
.projecttitle {
color: &dtml-hoofdnavigatieachtergrondkleur;;
}
<dtml-else>
.documentFirstHeading {
color: #fff;
}
</dtml-if>

/* </dtml-with> */
Also see part 1 for some more information.

Results
The department website is live and currently has 10 projects, all having a different color schema.
You can see it for yourself at: www.humanitaseindhoven.nl

The department Eindhoven is showing all the projects and news from there own department and projects below.

I gave a litte live demo on the Dutch Plone User day and the Plone Conference 2009 where I named it skin switcher. [Less]