[Zope] trying to do some developing
Dieter Maurer
dieter at handshake.de
Mon Jul 26 15:24:57 EDT 2004
Pupeno wrote at 2004-7-25 17:34 -0300:
> ...
>It seems I still don't get the philosophy of Zope/web application development.
>How do I know what objects exists when a script I wrote run,
Maybe some background reading could help you.
Did you read the Zope Book (2.6/2.7 edition; online).
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
might be helpful as well.
The most essential existing objects are the one that you
see in the ZMI (Zope Management Interface).
In many contexts, some of these objects are bound to names
such as "context", "container", "request", ...
The Zope Book tells you which names are bound to which objects
in the various contexts...
>and what classes
>those objects belong to
There is a convention in Zope (not enforced):
Zope's web site building classes have an attribute
"meta_type" which should be a human readable description
of the class.
This means: usually "object.meta_type" gives you an
indication towards the object's type/class.
It is not easy to learn the class itself.
You must be in trusted code (External Methods, Python Product code)
and you must use some magic: "object.aq_base.__class__".
>and what methods does classes have...
"DocFinder[EveryWhere]" can help you with this -- besides the
source of course.
<http://www.dieter.handshake.de/pyprojects/zope>
> ...
>My current questions are:
>1) How do I get my username and related information ?
It depends in what context you are.
You can access the current user (an instance of
"AccessControl.User.BasicUser") in
PageTemplate: via the predefined "user" variable
PythonScript/External Method/ Python Product code:
from AccessControl import getSecurityManager
user = getSecurityManager().getUser()
in DTML: via "getSecurityUser".
>2) How do I add more methadata to users, like name and e-mail ?
The standard UserFolder cannot do this.
Extended user folders provide this feature: e.g.
SimpeUserFolder, exUserFolder, ...
>3) How do I list folders that are owned by the logged in user ?
You must write a script that traverses your site ("ZopeFind" can help
you with this) and checks the "local role" "Owner" (read
the Zope Book to learn what a "local role" means).
>4) How do I redirect the browser to another page ?
You use the "redirect" method of the RESPONSE object.
--
Dieter
More information about the Zope
mailing list