[prev in list] [next in list] [prev in thread] [next in thread]
List: zope-dev
Subject: [Zope-dev] script location and traversal question
From: Joost van Lawick <joost () lawick ! nl>
Date: 2002-09-29 9:48:57
[Download RAW message or body]
Hi,
Suppose you have have your products in a folder Main, scripts in a subfolder Scripts
and object instances in a subfolder Things, i.e. something like this:
Main
----
|___ Scripts
|
|___ Things
Now call a script doit on an object Obj:
http://localhost/Main/Scripts/Things/Obj/doit
If I want to redirect this call, and context is Obj, I do it like this:
url = context.restrictedTraverse('Scripts').absolute_url() + '/' + \
context.absolute_url(relative=1) + '/doit'
return context.REQUEST.REDIRECT(url)
The first line creates: http://localhost/Main/Scripts/
the second line Things/Obj/doit
It works but is it good code? Is there a better way to doit?
Maybe the problem is more in the organization of Zope scripts and objects. For now,
I group scripts into Folders directly under Main and things of users of the site in
Main/Members/...
If a member wants to access some script, I have to include the script Folder into the
path, which leads to more 'complex' code. If I stuff all scripts into Main directly, without
subfolders, I don't have to insert the first line, but then I end up with a Main directory
loaded with scripts. How should one handle this?
Cheers,
Joost
--
Fights between cats and dogs are prohibited by statute in Barber, North
Carolina.
--
Joost van Lawick
E: joost@lawick.com
W: http://www.lawick.com/
_______________________________________________
Zope-Dev maillist - Zope-Dev@zope.org
http://lists.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://lists.zope.org/mailman/listinfo/zope-announce
http://lists.zope.org/mailman/listinfo/zope )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic