[Zapp-cvs-commit] ZApp/help ZApp.stx,1.3,1.4
Brought to you by:
sspickle
|
From: Steve S. <ssp...@us...> - 2006-01-03 20:00:35
|
Update of /cvsroot/zapp/ZApp/help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15148/help Modified Files: ZApp.stx Log Message: start on new docs Index: ZApp.stx =================================================================== RCS file: /cvsroot/zapp/ZApp/help/ZApp.stx,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ZApp.stx 28 Mar 2003 20:38:25 -0000 1.3 --- ZApp.stx 3 Jan 2006 20:00:23 -0000 1.4 *************** *** 1,22 **** ! ZApp ZPatterns Application Helper ! ! ZApp provides ZPatterns developers with tools that facilitate application ! development with ZPatterns. ! ! Imagine you could have an Application API that: ! ! 1 Works ! ! ZApp has four primary parts that work together: ! ! 1 ZApp_Base.py provides a base class that can be subclassed to create components of ZApp_Applications ! ! 1 ZApp_Specialist provides management features that help keep track of ZApp_Base objects. ! 1 ZApp_Application contains a hierarchy of ZApp_Specialists, and provides a set of Levers, and a simple UI. ! 1 ZApp_LeverMethods provides automated query/management functions for various backend systems --- 1,126 ---- ! ZApp Introduction ! ZApp is an collection of application development objects that live on top of Zope ! and ZPatterns. The concept is to make it easier to develop applications ! in an object oriented way using a variety of "back end" data storages ! along with transactions, triggers, and other useful technologies. ! This document assumes you're familiar with Zope, ZPatterns and some ! back-end database (we use postgresql, but others are OK). ! ! ZApp adds six main ingredients to ZPatterns: ! ! * ZApp Base Class (subclass of DataSkin) ! ! * ZApp Specialist (subclass of Specialist) ! ! * ZApp Application (central controller-like object) ! ! * ZApp Relationship subclasses (for building relational structures) ! ! * ZApp Misc Data (for attaching arbitrary misc data to objects) ! ! * ZApp CMF Content (for including ZApp objects in CMF) ! ! Of these the first three (ZAppBase, ZAppSpecialist and ZAppApplication) are core objects ! that are required to do much of anything with ZApp. The last three are optional, but ! can be very helpful. ! ! This intro consists of documentation on each of these six ingredients in the ! form of a tutorial/example that describes each of the objects/classes in turn. ! (There is more conventional class oriented documentation in Zope itself after ! you install ZApp). ! ! How to get ZApp ! ! You can get ZApp from CVS. Just type the following:: ! ! cvs -z3 -q -d :pserver:ano...@cv...:/cvsroot/zapp login ! cvs -z3 -q -d :pserver:ano...@cv...:/cvsroot/zapp co ZApp ! ! from sourceforge: http://sourceforge.net/projects/zapp ! ! ! Example Application: Keeping track of People ! Let's start with the simplest possible application. Let's say we want to ! keep track of some people. Each person will have an id, and some ! basic information (first, last and middle names, gender, birthdate). ! These people will form a 'collection' in our application. This collection ! will be managed by a 'Specialist' who knows all about people (how to find them, ! how to add them, delete them, change them, etc.). We'll call our Specialist ! 'People' so we remember which obejcts the specilist handles. ! ! The first thing we need to do is to create the Person class. There is a handy utility ! called ZAppStart (cvs -z3 -q -d :pserver:ano...@cv...:/cvsroot/zapp co ZAppStart). ! ! Put the ZAppStart folder in the same directory where you store Zope Products. ! ! type:: ! ! python ZAppTransformer.py --help + Usage: ZAppTransformer.py [-a|--action actionName] [-p|--pdb] + + -p, --pdb : break at options.. + -d, --debug [debugVal] : turn on some debugging + -a, --action actionName:arg1:arg2 : perform a templating function.. + + valid actions are: + display -- display: (Display the Product's Current Settings.) + newCMFClass -- newCMFClass:className:superClass=ZApp_CMFBase (Add a Class to an existing Product.) + newClass -- newClass:className:superClass=ZApp_Base (Add a Class to an existing Product.) + newProduct -- newProduct:productName:productAbbreviation (Build a peer directory with this script, and all the templates in it..) + rebuild -- rebuild: (Rebuild the class files..) + removeClass -- removeClass:className (Remove a from an existing Product.) + setProductName -- setProductName:productName:projectAbbreviation (Set(Change?) a Product Name) + + this will display the help info for the command line. Basically you can specify a command with arguments + separate by colons. To create a new product, use the 'newProduct' command:: + + python ZAppTransformer.py -a newProduct:PersonTracker:PTRK + + This creates a new directory (PersonTracker), as a sibling of the ZAppStart directory. + You now have an empty "PersonTracker" product. All of the PersonTracker classes can/will + be defined in this product. If you 'cd' to that directory you can continue building your + class(es) there. Let's add a new class, 'Person', to our product:: + python transform -a newClass:Person + + Now if you check in the directory you'll see something like:: + . + .. + PTRK_Person.py + __init__.py + classes.db + templates -> ../ZAppStart/templates + transform -> ../ZAppStart/ZAppTransformer.py + + The Person class is defined in the PTRK_Person.py file. The __init__.py file is the "Product init file." It's + used to register the classes used by the Product into Zope. Let's look at the PTRK_Person.py file:: + + # + # Use ZApp_Base as a base class to make details easier.. template for PTRK_Person + # + + from Products.ZApp import ZApp_Base + from Products.PageTemplates.PageTemplateFile import PageTemplateFile + + lpcol = ZApp_Base.LeverPropertyCollection + lprop = ZApp_Base.LeverProperty + + props = lpcol([ + lprop(id='person_property'), + ] + ) + + class PTRK_Person( ZApp_Base.ZApp_Base ): + + meta_type = 'PTRK Person' + + ZApp_Base.extendProperties( PTRK_Person, props ) + + def initialize(context): + context.registerBaseClass(PTRK_Person) + This is a bare-bones template that you can expand on to build your class. \ No newline at end of file |