[Zope] adding another product during add product
Aseem Mohanty
aseem@neurobehavioralsystems.com
Mon, 24 Jun 2002 21:54:31 -0700
Just so others can find it on the list.....
This was great. Thanks a lot.
AM
Antonio Beamud Montero wrote:
>I will describe how I solved "making my own authentication form" :-)
>Well my product is based in folders, and I need when create a instan=
ce
>of my product automagically create a user folder, a cookie mecanism =
and
>the login forms, but I don't want to touch the cookie crumbler login
>forms... I will do that:
>from Products.CookieCrumbler.CookieCrumbler import CookieCrumbler,
>manage_addCC
>
>class MyProduct(Folder):
> .....
> def create_user_logins(self):
> """ Create the user login forms, etc..."""
> # Create the built-in user folder =20
> self.manage_addUserFolder()
> # create the Cookie Crumbler product instance, by default it =
=20
> # doesn't create login forms
> manage_addCC(self,'Cookies')
> # Example. How to create a user from an external method
> self.acl_users.userFolderAddUser('exuser','exuser',['Manager'],=
'')
> # Create our login forms
> self.create_login_forms()
> =20
> def create_login_forms():
> addDTML(self, 'login_form','Pantalla de acceso', 'dtml/login_fo=
rm')
> addDTML(self, 'logged_in', 'Pantalla de inicio', 'dtml/logged_i=
n')
> addDTML(self, 'logged_out', 'Pantalla de salida','dtml/logged_o=
ut')
>
>#Piece of code from Squishdot :-)
>
>file_path=3DGlobals.package_home(globals())
>def addDTML(obj, id, title, file):
> f =3D open(file_path + '/' + file + '.dtml')
> file =3D f.read()
> f.close()
> obj.manage_addDTMLMethod(id, title, file)
> return getattr(obj, id)
>
>Inside my dtml directory I have three methods: login_form, logged_in=
,
>logged_out, in this moment are the login forms that comes with Cooki=
e
>Crumbler product, but you can put all that you want...
>
>I hope that this howto help you...
>
>
>El mar, 25-06-2002 a las 06:04, Aseem Mohanty escribi=F3:
>
>>Hi,
>>I have a custom product that requires a cookie crumbler instance in=
its=20
>>parent folder to operate.
>>
>>What do I have to do to be able to add cookie crumbler programmatic=
ally=20
>>to a folder when I do an Add->MyProduct in that given folder??
>>
>>TIA
>>AM
>>
>>--=20
>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
>> Aseem Mohanty=09=09=09=09=09=09=09 =20
>> Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706=
=20
>> (R) 510 7696011 (M) 510 3014871 (O) 510 5279231=09=09 =09
>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=09=09=09=09=09=09=09=09 =09
>> "I saw `cout' being shifted "Hello world" times to the left and =
=20
>> stopped right there!!" -- Steve Gonedes =
=20
>>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=20
>>
>>
>>
>>
>>_______________________________________________
>>Zope maillist - Zope@zope.org
>>http://lists.zope.org/mailman/listinfo/zope
>>** No cross posts or HTML encoding! **
>>(Related lists -=20
>> http://lists.zope.org/mailman/listinfo/zope-announce
>> http://lists.zope.org/mailman/listinfo/zope-dev )
>>
--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Aseem Mohanty=09=09=09=09=09=09=09 =20
Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706=
=20
(R) 510 7696011 (M) 510 3014871 (O) 510 5279231=09=09 =09
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=09=09=09=09=09=09=09=09 =09
"I saw `cout' being shifted "Hello world" times to the left and =
=20
stopped right there!!" -- Steve Gonedes =
=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=20