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: [EMAIL PROTECTED]
W: http://www.lawick.com/

_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
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 )

Reply via email to