[Zope] how to define a class for use in scripts

Istvan Albert ialbert at mailblocks.com
Fri Jan 9 17:07:24 EST 2004


Hello Folks,

here is a problem that I was so far unable to make any
notable progress.
I want to be able to use a custom class in my python scripts.

in python I would create a file say User.py and put in it:

class User:
   set(self, user_id):
     self.user_id = user_id

In my scripts I want to be able to do a:

import User
user = User.User()
user.set(1) 	

I do not need a product! I think I understood how do those
work and I have made some simple products myself. But those
need to be added individually. ZCLasses seem to be no good
either. These also seem to be static objects that are instantiated
once and then only their properties change.


This user class needs to be created as an instance and multiple 
instances may be present if there are multiple users.
I've read a  lot of documentation and still have no clue whether it is 
possible to do this without tinkering with the internals of
the system.

I have full access to any part of Zope, what I'm hoping is to be
able to put this file in a place that allows Zope to use it.
Is there such a place?

thanks for the help folks,

Istvan.






More information about the Zope mailing list