[z3-five] Question about skins usage

David Pratt fairwinds at eastlink.ca
Wed Jul 26 23:05:22 CEST 2006


Hi Philip. I had posted to the Z3 list a question about role based 
skinning. From this post it seems that all that is necessary is to 
obtain member role from request and use a traversal hook as you have 
suggested. The use case I have in mind is to present an admin skin for 
administrators of a site and a different skin to regular consumers of 
the site.

On another note, one thing I have appreciated with django is a means to 
construct urls in a sensible way. I'd like to better understand an 
approach to constructing urls in zope 3 that are not necessarily based 
on objects not being in a specific container. A blog url example is a 
good one to use for this. For a blog you may have a container for blog 
entries and then the blog entries themselves but you may want the 
articles to be reached like:

     *  Accessing /blog/ will show a list of all posts by reverse date order
     * Accessing /blog/<year>/, eg /blog/2006/ will show a listing of 
posts for just that year.
     * Accessing /blog/<year>/<month>/, eg /blog/2006/12/ will show a 
listing of posts for that month.
     * Accessing /blog/<year>/<month>/<day>/, eg /blog/2006/12/20/ will 
show all postings on that particular day
     * Accessing /blog/<year>/<month>/<day>/<article> will show a 
particular article.

Can you explain an approach to accomplish something similar in zope3. 
Many thanks.

Regards,
David


Philipp von Weitershausen wrote:
> Maciej Wiśniowski wrote:
>>> Will they get different domains? Then you can use rewrite rules:
>>>
>>>  www.car-shop.com  ->  http://localhost:8080/++skin++CarShop/carshop
>>>  www.usedcars.com  ->  http://localhost:8080/++skin++UsedCars/usedcars
>>>
>>> If they are part of the same domain, use traversal hooks as described
>>> above (www.car-shop.com vs. www.car-shop.com/usecars).
>>>  
>>>
>> We have many environments for our applications (developement, testing,
>> learning etc.)
>> so I think traversal hooks are better choice. I've never played with
>> them but
>> seems that I have to add  something like:
>>
>> def __before_publishing_traverse__(self, object, REQUEST):
>>    """ Pre-traversal hook.
>>    """
>>    # check if there is no skin already and
>>    # add/modify a skin to REQUEST['TraversalRequestNameStack'] or
>> REQUEST.path
> 
> Shrug! Don't mess with the traversal name stack. Simply use
> IMySkin.providedBy(request) for checking whether the request has your
> skin and zope.app.publisher.browser.applySkin(request, IMySkin) for
> applying the skin to the request.
> 
> Remember: Skins are just interfaces (that provide ISkin).
> 
> Philipp
> 
> _______________________________________________
> z3-five mailing list
> z3-five at codespeak.net
> http://codespeak.net/mailman/listinfo/z3-five


More information about the z3-five mailing list