[Zope-CMF] Re: How-To: Automatically Add Objects at CMF Member Creation Time
josh@pdxbands.com
josh@pdxbands.com
Thu, 23 Aug 2001 09:05:29 -0700
Greg,
I would like this objects to be inside the ZODB as then I could give the=
m
ID's and work with them in other ways. Also, then the manager user(admin=
)
could also see them without having to go to the FS to see what was availa=
ble
or to add to them.
I need to look at skins a bit more but how would you go about making
attributes on the users? I can use skins to design the layout of the sit=
e
but how do you modify it to have additional properties for the users? Th=
ese
values would have to travel with the users. So, if you moved the user yo=
u
would always have the values. That was why I thought to put them with th=
e
user. Maybe there is another way but looking around I just found if I ad=
ded
a new property to that user then I could access the value easier.
These new questions I haven't found an answer to. I was given the code s=
nip
from another user and looked into it and found that I need to plan a bit
more.
The thought being, I'm setting this up for someone else(who is not a
programmer but designer) to use. They would like to use a system that is
easy to grab values and alter for his purpose of display. I'm writing th=
e
python scripts and setting up the base so that it is as flexible as possi=
ble
for him(and me).
As for the afterAdd section I tried to place a small bit of code in there
that I thought would throw an error but it didn't even do that. Makes me
think that maybe it didn't even compile. I'm looking into that. I may ha=
ve
to go with your solution which could solve my problem it makes it difficu=
lt
for the manager user to add and configure in the future. I like things t=
hat
are easy to change. Is it possible for you to access an object in the ZO=
DB
from your __init__.py file? That is, instead of reading them in from the=
FS
you could read through all objects in a particular directory inside the Z=
ODB
and use those names as the names to create the new defaults for the new
user?
Again, thanks for the help and suggestions. It has taken me a bit of tim=
e
to read up on Zope and Python and find time away from my java web
programming to resolve this. I do want to move everything to Zope as a
solution for the items I'm working on but having a configurable easy to
admin solution is something I need as well.
Josh
-----Original Message-----
From: Gr=E9goire Weber [mailto:gregoire.weber@switzerland.org]
Sent: Wednesday, August 22, 2001 12:42 AM
To: zope-cmf@zope.org
Cc: josh@pdxbands.com
Subject: RE: [Zope-CMF] Re: How-To: Automatically Add Objects at CMF
Member Creation Time
The same message, but now also copied to the list :-)
Hi Josh,
I've had a short look into the code and I am not 100% sure when and
in which context this afterAdd method gets called.
Did you put something into this method and it didn't work? What did
you do exactly? What do you mean with administrator -- the manager
user? Do you want to put all theses objects as files in the filesystem
or in the ZODB (I would prefer a skin directory [1])?
I am wondering if it is the right place to put the things you want.
Normaly (in the Zope core) these kind of afterAdd method are called
to catalog objects etc.
Perhaps this is a question for Tres? Or was this question answered in
former list contributions already? I am sure he already has an idea
where to put this feature you and a lot of other people want.
I could investigate on this a little, but not before the begin of
next week. What I would do is drawing a kind of 'calling tree' upon
member creation.
Greg
[1] Exactly, I would prefer a dropdown list in the Metadata Tool in the
ZMI (Zope Management Interface) where I can first choose a skin from a li=
st
of all available skins and second the skin directory containing the objec=
ts
I want to be copied upon member creation time.
At 21:15 21.08.01 -0700, you wrote:
> Greg,
>
> I have been trying to get this to work correctly. I have been having
> trouble getting it called. I think I don't quite understand how to get=
a
> method called in the afterAdd method. I thought I could just put some c=
ode
> there and it would always run for me. Evidently this is not the case.
>
> What I would really like to achieve with this is to have it run when e=
ver
a
> user is created. More so, it would go through a directory that is read=
ily
> available to an administrator who could add items to the list he would
like
> to see populate at creation. This would include/exclude things like:
>
> index_html
> image
> document
>
> or any other valid object type. Then he could then decide which items =
the
> user could or could not modify.
>
> Next I would also like to see in this directory a default user. This u=
ser
> object would be special in that you could modify this object and it wou=
ld
be
> template for all users create afterwards. The advantage here is that I
> could add an attribute to all newly created users of the name email. T=
hen
I
> could populate that attribute when I create the user or have the user
modify
> it. This would allow for me to have it go with the user. Currently I
don't
> see how I would achieve this. Ideas?
>
> This is how I envision how it would work. I'm trying to design it so t=
hat
> anyone(admin level) could modify one directory and that would change al=
l
new
> users. This person would then know which objects to expect to be prese=
nt.
>
> Any suggestions welcomed.
>
> Josh
>
_____________________________________
Gr=E9goire Weber
Rigistr. 31
CH-8006 Z=FCrich
Switzerland
phone: +41-(0)1-361 66 11
mobile: +41-(0)79-44 11 457
mailto:gregoire.weber@switzerland.org