[Zope] organizational questions

Martijn Faassen M.Faassen@vet.uu.nl
Wed, 21 Apr 1999 17:03:37 +0200


Scott Lewis wrote:
 
> ok, i'm converted. i've started implementing in zope.

Cool! :)

[description of setup snipped]

> my question is how to structure this in zope. i started by creating a
> centers folder, and a subfolder for each center. i plan to place
> common DTML docs and SQL methods in the centers folder,
> letting each center acquire them. each center has an ID property,
> corresponding to its unique ID in the database. i just noticed this
> morning that this is the same way its done in the budget sample
> application in the HOWTO section. i must be going in the right
> direction.
> 
> i expect to have a number of DTML documents that are access
> restricted. for organizational clarity and ease of managing the
> permissions, i'd like to put them in a folder. but if i put them in a
> folder in the centers folder, then they are parallel to the individual
> centers and can't be acquired. does this mean i'm stuck putting
> them all in the centers folder? any suggestions?

Probably some mild level of Zope Zen is needed to realize fully that
*folders* are acquired by subfolders too -- recently I faced similar
organizational issues as well, and used this to good effect.

I had the same setup with a root folder and a number of sub folders, and
common SQL methods in the root folder so that they were acquired. As I
had quite a few SQL methods this started to get messy. So I made a
subfolder called 'sql' and moved all SQL methods to that place. Now I
have a nice and clean root folder.

Zen: All the sub folders acquire this SQL folder.

Of course I had to adapt my DTML documents in the subfolders from things
like:

<!--#call "insert_whatever(REQUEST)"-->

to:

<!--#call "sql.insert_whatever(REQUEST)"-->

so it's easier to set this up the right way in the beginning.

You can use the same strategy for any common documents.

> lets say i put a DTML document called dtViewTrainings in the
> centers directory. it uses a SQL method and an ID property to get
> trainings from the database. so the user views
> http://.../centers/roswell/dtViewTrainings and the ID is acquired
> from the roswell folder. everything's ok. but what if they browse to
> http://..centers/dtViewTrainings. there's an error because ID is not
> defined. that's fine, because the request makes no sense. but is
> this problem? it just kind of bugs me that the user could browse to
> this URL and get a meaningless error.

I think this is one of the disadvantages of acquisition; I don't know a
way around it. Perhaps the Real Gurus have some advice here. 

I think the main idea is that users who try to create their own URLs are
lucky if it works, more power to them, but when it fails they shouldn't
complain. Usually a user just clicks a button or hyperlink, and those
URLs should always be correct anyway.

I hope this helps!
 
Regards,

Martijn