[Zope] Storing Data inside Zope
J Cameron Cooper
jccooper@jcameroncooper.com
Mon, 02 Jun 2003 14:45:31 -0500
>
>
>Just how bad an idea is it to use Zope object Properties to store
>numeric/text application data?
>
Depends. See below for a less glib response.
>My first Linux (or otherwise) Zope app will be a gratis case tracking system
>for a friend's small (himself plus 3 staff) law office. Other than setting
>up new clients and cases (maybe a few a day) the most frequent data changes
>will be adding new activity detail records which are small. Only a couple
>of reports are run each day. Overall transactions will be few and small.
>
>My initial idea was to use MySQL or PostgreSQL for data storage. While
>developing the framework of the app I want to be able to store/retrieve a
>few records for testing. Since every bit of Zope (HTML, DTML, Python, etc.)
>is new to me, every time I start to do something I have to learn something
>else first. ...
>
>
Unless you already have a relational database or your data is terrbily
relational, I recommend not using an external database. Things become
simpler that way.
Zope objects are a good place to store data, but you should be
thoughtful about how it is done. Which is to say, you should design
object-orientedly and not expect to use Zope objects like tables.
If you make one object to store a large set of data, you'll run into
problems. Not the least of which is a rapidly growing storage due to the
undo mechanisms. So factor your data space down to sets of properties or
natural objects, and make those, either as a product or (as previously
suggested) a PropertiesObject/Abracadabra system. You could also use
ZClasses, but I wouldn't: they are, shall we say, problem prone.
In your case you'll probably have a Client, which will have Cases, which
will contain ActivityDetailRecords. A Client might have name, address,
and whatnot properties, a Case might have description, judge, dates, etc
properties, and ActivityDetailRecords might have date and contents
properties. (I am of course just guessing about these.) This way you get
a clean containment, plus most of the objects are immutable or rarely
changed, so you only store the data you actually need to store.
--jcc