Re: [Zope] adding another product during add product
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 instance 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 self.manage_addUserFolder() # create the Cookie Crumbler product instance, by default it # 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()
def create_login_forms(): addDTML(self, 'login_form','Pantalla de acceso', 'dtml/login_form') addDTML(self, 'logged_in', 'Pantalla de inicio', 'dtml/logged_in') addDTML(self, 'logged_out', 'Pantalla de salida','dtml/logged_out')
#Piece of code from Squishdot :-)
file_path=Globals.package_home(globals()) def addDTML(obj, id, title, file): f = open(file_path + '/' + file + '.dtml') file = 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 Cookie 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ó:
Hi, I have a custom product that requires a cookie crumbler instance in its parent folder to operate.
What do I have to do to be able to add cookie crumbler programmatically to a folder when I do an Add->MyProduct in that given folder??
TIA AM
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- ================================================================== Aseem Mohanty Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706 (R) 510 7696011 (M) 510 3014871 (O) 510 5279231 ================================================================== "I saw `cout' being shifted "Hello world" times to the left and stopped right there!!" -- Steve Gonedes ==================================================================
participants (1)
-
Aseem Mohanty