Thursday, October 30, 2008

strange "decoder jpeg not available"

well its obious what is wrong. pil was not compiled with jpeg support.

i'm currently setting up plone buildout on some centos box (for gentooista - like me - this is like having only one hand to type). i created virtual environment with --no-site-packages as usual. that means i need to install pil manualy.

?> wget
?> tar zxvf Imaging-1.1.6.tar.gz
?> cd Imaging-1.1.6
?> python install

the i've looked at build summary
version 1.1.6
platform linux2 2.4.3 (#1, May 24 2008, 13:57:05)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)]
*** TKINTER support not available
*** JPEG support not available
*** ZLIB (PNG/ZIP) support not available
*** FREETYPE2 support not available

well next steps were obvious. i need to install libjpeg, zlib and freetype2, and then reinstall pil.

?> yum install libjpeg-devel zlib-devel freetype-devel
?> python install

and build summary is now
version 1.1.6
platform linux2 2.4.3 (#1, May 24 2008, 13:57:05)
[GCC 4.1.2 20070626 (Red Hat 4.1.2-14)]
*** TKINTER support not available
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok

so i installed it right? WRONG!! if you test you plone instance you'll see that you can not upload image. even deleting pil from site-packages and reistalling didnt helped. problem is that you need to have fresh unpacked (untouched) version of pil when you install it.

?> cd ..
?> rm Imaging-1.1.6/* -R && rmdir Imaging-1.1.6
?> tar zxvf Imaging-1.1.6.tar.gz
?> cd Imaging-1.1.6
?> python install

i think i saw some guy/girl asking ppl on #plone why there is no pil support even if build summary shows that there is. well i think this was the case or at least this save my day.

Tuesday, October 21, 2008

my favorite buildout recipes

i'd like to share my experience with recipes. which one i use and which i found very exciting. and for the end which recipe i miss.
  1. zerokspot.gitrecipe
    since git is dvcs of my choice this recipe provides nice integration with git, when my code is not published yet.
  2. collective.buildbot
    i must admit that i didnt have chance to setup it up and give it a test. i heard ppl are really satisfied with it. well why shouldn't they be, setting up buildbot is super-easy now. i'm just searching time to setup buildbot to monitor my published projects.
  3. collective.recipe.backup
    use it constantly really useful recipe for your production. i would say this is a must in your production configuration.
  4. collective.recipe.sphinxbuilder
    great recipe for building your plone documentation with sphinx. it has some problems with recent 0.4.3, but i prepared some patch for it (need to tell tarek about it), should be included in next release.
  5. collective.recipe.supervisor
    i didn't use this recipe, but could become next thing to ship my deployment configuration with. i use simple (bellow) zc.recipe.egg:scripts recipe to ship with supervisord. then i have configuration files for supervisord separated from the buildout configuration, which is not so nice. for my next deployment i'll definitely look into this.
    recipe = zc.recipe.egg:scripts
    egg = supervisor
  6. gocept.nginx
    since i use nginx in 99% of my cases i like to ship also the configuration code for it within the buildout.
  7. iw.recipe.sendmail
    just found out about this one. i always add sendmail configuration code inside project i use which is then hard to switch to developing environment. well from tomorrow on i'll be using this. this is useful when you want to deploy Singing&Dancing with plone.
  8. plone.recipe.deliverance
    i'm really sorry not to have time to test this nice recipes. deliverence is "next plone generation themeing engine". i read all the docs/tutorials/reviews i could found about deliverence. i hope there will be some project in future that i could try it. maybe this recipe will make me try it since configuration is really easy.
  9. plone.recipe.varnish (plone.recipe.squid)
    i use varnish, but heard really nice words from ppl using squid. configuration of this to recipes is not similar, but is *identical*, so i might give squid a try just from my own curiosity . but before that i would need to learn some more about catching in plone. this is the area i lack knowledge most.
i also found more recipes which i didn't have time to look closer into. i'll just list them for me to test them later. if you used some of this please share your experience.
well i spoke till now only about what recipes we already have. but there is one recipe i would really like to see.

since i'd like to provide client with up-to-date, bug less as possible code in short time and not to wait for next releases of packages i often patch them. it would be nice to have this kind of tool possible to use from within buildout. maybe this will speed up (or at least make it easier) patch testing in plone core development. that would maybe lead to patches tested not only from one person but from more, maybe this patches are already used in production environment before they reach plone core which is big plus i think. so to sum up: recipe (collective.recipe.patch) that would apply patch to certain python package version. possible to pin this patch to specific version of python package)

maybe tonight is the night to produce this recipe. lets go cooking...

Sunday, October 12, 2008

generate your own z3c.form docs

recently was down. for some of us who are using it extensivly that was just like someone pull a hat over my eyes. well since z3c.form ppl are using sphinx to generate this lovely documentation you can also create it on you own.

rok@bestia ~/Projects $ svn co svn:// z3cform-doc
rok@bestia ~/Projects $ cd z3cform-doc/
rok@bestia ~/Projects/z3cform-doc $ virtualenv --no-site-packages ./
rok@bestia ~/Projects/z3cform-doc $ source bin/activate
(z3cform-doc)rok@bestia ~/Projects/z3cform-doc $ python
(z3cform-doc)rok@bestia ~/Projects/z3cform-doc $ buildout

(z3cform-doc)rok@bestia ~/Projects/z3cform-doc $ docs
(z3cform-doc)rok@bestia ~/Projects/z3cform-doc $ firefox parts/docs/z3c.form/build/index.html

and you have it, simple a? this is the way official plone documentation should be, by my opinion.

z3c.recipe.sphinxdoc have some dependecy problem so you might have outdated email python package. if your buildout fails just update it with "easy_install email" and rerun buildout.

Thursday, October 9, 2008

optional auto login in plone3

having optional auto login in plone2.5 was easy. well maybe not easy but at least it was documented (it would be nice if somebody with rights would update that documentation with working example for plone3). i recently post on plone-users mailing list regarding this issue and got a tip to look into cookie plugins for PAS.

follow all instructions as desribed here. this mean:
* you will adapt setAuthCookie script
* change login_form and login portlet
* set auth_cookie_length in site_properties

after that go to acl_users and add "Extended Cookie Auth Helper", give it some id/title and choose all functionalities for it.

Challenge (challenge)
Reset Credentials (resetCredentials)
Update Credentials (updateCredentials)
Extraction (extractCredentials)

and that should be it. except in my case this solution is not working, because i use email as username. and that gives error when username is trying - for some unknown reason to me - to decode credentials:
creds['login'] = login.decode('hex')
creds['password'] = password.decode('hex')
when i removed decoding auth started to work as expected. did i found a bug. as i see jens is last commiter for PAS (no commit in last 12months). i'll propose a fix on next plone tuneup or please explain me why this decoding is neccessary and how to address my problem with email as username. until then i'm patching PAS. (hmm is there any patching recipe out there, could come useful)

Monday, October 6, 2008

date/datetime widget for plone.z3cform

today i created calendar widget for plone.z3cform. its using mighty jquery datepicker plugin. for now i just made it functional, but there are some nice options i could include. well see it for your self. i hope i'll have some time to add test, add all functionality that archetype calendar widget has plus more.

did you notice jquery ui library (extension for jquery). it offers some useful stuff. maybe we should implement it into plone (as addon). any thoughts? ideas of implementation? did you use this jquery extension somewhere, your experiences?