donderdag 2 juli 2009

How do Plone's expiration/publication dates work?

It's simple enough, but worth a summary:


  • When an item is past its expiration date, it's marked "expired" in red in its document byline when viewed.

  • An item whose publication date is before the current date doesn't get extra text in its byline.

  • In both cases, the item is "unpublished", which is not to be confused with a workflow state.

  • It merely means the item doesn't show up in listings and searches.

  • These listings include folder listings.

  • However, the owner of the item will keep seeing it, which is handy because you like to know what you have lying around in your site.

  • Expired items in a folder are marked as such when viewing the folder_contents.

  • There's no quick way of seeing if items in a folder listing are not yet published.

  • When you set an unpublished item as the default view for a folder, that item will be shown.

  • Unpublishing an item doesn't have any effect for admins. They will always see unpublished items in their listings and searches.

  • Giving another regular users rights ("can add", can edit", "can review") on the item doesn't make it any less unpublished for those users.

  • A practical way for a non-admin user to access an unpublished item is directly through its URL.


vrijdag 19 juni 2009

Countdown shell (bash) script


function countdown () {
a=$1
while [ $a -gt 0 ]; do
echo $a;
a=$(($a-1));
done
}
for i in `countdown 10`; do echo $i; sleep 0.1; done

donderdag 18 juni 2009

How to change Plone's default folder listing sort order

The easy, all-Plone way to do this is to create a Collection (or Smart Folder, or Topic) which you can configure through the web to display items from wherever you please, in whatever order you please. I think you should consider using a Collection first. For example, look how the "News" folder is set up in in a fresh Plone install. It contains a Collection which is used as the default view for the folder.

See the documentation on using Collections.

And now, the entering-a-world-of-pain way:

The folder_listing and folder_contents views use the script getFolderContents (in CMFPlone) to get brains objects.

If you want to modify the default order in which items are listed in your site, you can customize this script by adding these lines:

# Modification to alter sort order
contentFilter['sort_on'] = "modified"
contentFilter['sort_order'] = "descending"


If you wanted a different sort order for different folders, you could place the script in the folder itself. Acquisition should take care of that. (Haven't tried this myself yet.)

I have tested this on Plone 2.5, but it should work equally well on Plone 3.2.2, as the getFolderContents script is still present there.

Note that this will disable the feauture that allows you to sort the folder by hand!

maandag 15 juni 2009

Creating a Plone 2.5 buildout with slideshowfolder 4.0

Slideshowfolder 4.0 can work on Plone 2.5, but it requires plone.app.form.

The default buildout from paster create -t plone2.5_buildout requires some tweaking. I checked out http://svn.plone.org/svn/plone/plone.app.form/branches/plone-2.5 in develop-eggs/ and used the buildout.cfg below. Note that you have to explicitly include Five 1.4.4 (Zope ships with a 1.3 version) and CMFonFive.

[buildout]
parts =
plone
zope2
productdistros
instance
zopepy


# Add additional egg download sources here. dist.plone.org contains archives
# of Plone packages.
find-links =
http://dist.plone.org
http://download.zope.org/ppix/
http://download.zope.org/distribution/
http://effbot.org/downloads

# Add additional eggs here
# elementtree is required by Plone
eggs =
elementtree
plone.app.form
Products.slideshowfolder

# Reference any eggs you are developing here, one per line
# e.g.: develop = src/my.package
develop =
develop-eggs/plone.app.form

[plone]
# For more information on this step and configuration options see:
# http://pypi.python.org/pypi/plone.recipe.distros
recipe = plone.recipe.distros
urls = http://launchpad.net/plone/2.5/2.5.5/+download/Plone-2.5.5.tar.gz
nested-packages = Plone-2.5.5.tar.gz
version-suffix-packages = Plone-2.5.5.tar.gz

[zope2]
# For more information on this step and configuration options see:
# http://pypi.python.org/pypi/plone.recipe.zope2install
recipe = plone.recipe.zope2install
fake-zope-eggs = true
additional-fake-eggs =
ZODB3
url = http://www.zope.org/Products/Zope/2.9.10/Zope-2.9.10-final.tgz

# Use this section to download additional old-style products.
# List any number of URLs for product tarballs under URLs (separate
# with whitespace, or break over several lines, with subsequent lines
# indented). If any archives contain several products inside a top-level
# directory, list the archive file name (i.e. the last part of the URL,
# normally with a .tar.gz suffix or similar) under 'nested-packages'.
# If any archives extract to a product directory with a version suffix, list
# the archive name under 'version-suffix-packages'.
[productdistros]
# For more information on this step and configuration options see:
# http://pypi.python.org/pypi/plone.recipe.distros
recipe = plone.recipe.distros
urls =
http://codespeak.net/z3/five/release/Five-1.4.4.tgz
http://codespeak.net/z3/cmfonfive/release/CMFonFive-1.3.4.tgz
nested-packages =
version-suffix-packages =

[instance]
# For more information on this step and configuration options see:
# http://pypi.python.org/pypi/plone.recipe.zope2instance
recipe = plone.recipe.zope2instance
zope2-location = ${zope2:location}
user = admin:admin
http-address = 1235
debug-mode = on
verbose-security = on

# If you want Zope to know about any additional eggs, list them here.
# This should include any development eggs you listed in develop-eggs above,
# e.g. eggs = Plone my.package
eggs =
${buildout:eggs}


# If you want to register ZCML slugs for any packages, list them here.
# e.g. zcml = my.package my.other.package
zcml =
plone.app.form

products =
${buildout:directory}/products
${productdistros:location}
${plone:location}

[zopepy]
# For more information on this step and configuration options see:
# http://pypi.python.org/pypi/zc.recipe.egg
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = zopepy
extra-paths = ${zope2:location}/lib/python
scripts = zopepy

donderdag 11 juni 2009

Testing cookies with wget

I noticed an odd behaviour on one of our websites, hosted by an external party: When cookies exceeded a certain length, our Plone site didn't get any cookies in the request.

An excellent way to find the point of failure here is to use wget in combination with a script which prints the cookies it gets. Create a file cookie.txt:
your.domain.com  FALSE  / FALSE 0 cookie_id "SomeCookieValue"

This file must be tab-separated! Wget will not display error messages if your cookie file is corrupt.

Next, run
wget -qO - --load-cookie cookie.txt http://your.domain.com/showCookies

where showCookies is a page that wil simply print the cookies it gets. (-O - sends output to terminal instead of file, q turns off other info.)

In my case, i used several cookie files: for each domain, a short cookie (8 chars value) and a long one (2000 characters). This way, i was able to determine that the current Debian/Ubuntu (Intrepid) Pound package (version 2.4.3) doesn't deal well with cookies: when cookie data exceeds about 500 bytes, the cookies aren't passed to the application. Hand-compiling version 2.4.4 remedies this.

Update: More info on limited cookie(s) size with Pound.

zondag 17 mei 2009

Competitie Drachten

Debuut op de steeplechase.







Niet geblesseerd, gefinisht en het leverde meer punten op dan de 800 meter van de vorige keer.

dinsdag 28 april 2009

Gedachten na de Bata

- Volgend jaar nachtploeg
- Siem porren
- Veluweloop meedoen
- Meer nieuwe mensen erbij