On Tue, 2009-09-22 at 12:25 +0200, M.-A. DARCHE wrote: > Hello list, > > I have a need to do a customization but I would like this > customization to be clean. > > I would like to specific actions just once after a user > logs in. > > A straightforward solution would be to customize the > CPSDefault/skins/cps_default/logged_in.py script. > But by doing so one is then desynchronized with the CPS code, > and the smooth evolution of the portal is endangered.
In almost all the projects I've worked on, this script is overridden and a nightmare (true also for CPSDefault's, I must say). I haven't heard of a generic solution for this looooong-standing problem and don't believe in genericity other than at the programming level in this case. Part of the reason is that it mixes fairly common actions with application-specific logic. This can be thought as a natural consequence of inherent limitations of the Script (Python) system : no OO programming. Another reason is that the quick & dirty solution (customize as you say) works, at least for a while, so people don't complain too much. IMHO, the path to improvement in that case would be to replace it by a Zope 3/Five view. That's exactly what they've been made for. CPSDefault would define a base class, providing high level methods for redirection, last login update etc, and a default subclass. Project-specific code could inherit the base class and put whatever business logic they need. Of course the base class API has to stabilize for upgrades to stay smooth. There are more scripts like this one that everybody wants to customize or are way too generic (content_status_modify) and would highly benefit beeing rewritten in the Zope 3 style, but this one comes top of the list. What do you think ? Migrating this script wouldn't be a big deal for you (much less than writing some kind of post login actions tool) and you'd get as much free room as you want. Cheers, > > Is there already to your knowledge such a mechanism that > triggers registered actions when a user logs in or should I > try to develop one? > > Cheers, > _______________________________________________ cps-devel mailing list http://lists.nuxeo.com/mailman/listinfo/cps-devel
