Zope Products newbie question.

Duncan Booth me at privacy.net
Thu Jul 22 10:51:17 CEST 2004

mir4uu at yahoo.com (mir nazim) wrote in 
news:425cc8d1.0407212145.2cf59ff at posting.google.com:

> Hi,
> I am a PHP developer. i am currently studying Zope and want to migrate
> to it. I have developed a school management system in PHP. but now I
> want to implement it in Zope. I have worked through The Zope Book 2.6
> and Zope Developers Guide quickly(not thoroughly). My problem is that
> I am confused where to start.
> I am giving a brief account of what I want to do.
> I have Identified Following class structure.
> class Person(Persistent): 
>     # inherits from Persistence.Persistent. to be stored in ZODB
>     # Data Members:
>         self.firstName
>         self.midName
>         self.lastName
>         self.sex
>         self.dob
>         # And other data members like address, city, phone etc.
>     # Methods:
>         getFistName(self)
>         getMidName(self)
>         getLastName(self)
>         getSex(self)
>         getDob(self)
>         setFistName(self)
>         setMidName(self)
>         setLastName(self)
>         setSex(self)
>         setDob(self)
> class Student(Person):
>     # inherits from Person.
>     # Data Members specific to students like;
>         # Fee Status, class, course etc.
>     # Data Members:
>         # method for accessing and modifying attribute of student
>     System is supposed to admit students and assign unique ids to
> them. student object will be stored in ZODB. searching on id, first,
> mid and last names and possibly on other attributes like sex, date of
> birth etc has to be provided. system is to be used by end users and
> not zope administrators.
>     Now the problem is that I am confused how to implement these
> classes. Should I implement them as ZClass or in External methods or
> as a Zope Product. Please Clarify. Also tell me how, actually, am I
> supposed to start. small code sample can be a of great help. Links to
> similar free projects undertaken on zope can be useful.
These days, I would start off using Plone and Archetypes. There is even a 
tool (ArchgenXML) which will allow you to start off by drawing a UML 
diagram of exactly what you have above and will then automatically convert 
this into the Python code to produce the appropriate Zope/Plone objects. 
Attributes in UML become attributes on the Zope objects, and operations in 
the UML can become views, forms, actions or simply methods in Zope. 
References between objects are also carried across into Zope: every 
archetypes object automatically gets assigned a unique id which is used to 
maintain the references between objects.

Archetypes works on the basis that you define a schema for each object, 
this describes the fields in the object and which editing widgets you want 
to use in forms. The accessors and mutators are generated automatically, so 
unless you need to change the default behaviour you can ignore them. The 
schema lets you specify not just the type of values but whether they are 
indexed for searching, the allowed vocabulary, validation rules and so on.

You can create and edit your Archetypes objects using a standard form which 
is generated based on the fields in the schema. As a minimum you need to 
write a Zope page template to display each object.

For an introduction to Archetypes see 
html and for an example of the UML modelling see 
(go up one level to http://plone.org/documentation/archetypes for the main 
archetypes documentation)

More information about the Python-list mailing list