Flat Database/ZPatterns api, performance ?
Flat Database (was ListMate) is just what I need to whip up an interface for non-technical administrators - thanks. So I migrated two data tables ("workshops" & "registrations") from gadfly to flatdb instances using the CSV import feature, and the admin interface is working fine. I'm having a hard time, though, figuring out how to access the data programmatically. I scavenged the docs (zpatterns wiki very helpful, as far as it went; not much available for flatdb), searched the lists (nothing) and grovelled around in the code. I'd appreciate any comments or advice on the following. 1. how can I look up a row in the table by column value, other than searching the whole table: ? <dtml-in "workshops.entryValues()"> <dtml-if "getProperty('col_workshopid') == workshop"> <dtml-var "getProperty('col_description')"> </dtml-if> </dtml-in> 2. how can I add an entry to a table ? I tried this: <dtml-let entry="registrations.manage_addEntry()"> <dtml-call "entry.manage_addProperty('col_workshopid','string','TEST')"> <dtml-call "entry.manage_addProperty('col_firstname','string','TEST')"> <dtml-call "entry.manage_addProperty('col_lastname','string','TEST')"> ... </dtml-let> and it seems to create a number of spurious rows with only the first field set. This didn't work either: <dtml-call "registrations.manage_addEntry().manage_changeProperties( col_workshopid='TEST', col_firstname='TEST', col_lastname='TEST', ... )"> 3. displaying table contents seems quite slow. On this P100 with 48Mb ram doing nothing but zope, no load and generally snappy, generating the 50-row, 20-column registrations table listing takes 15 seconds. Any ideas about where this comes from ? 4. this is my first encounter with the mighty zpatterns. I wonder how one might add a thing (data plugin ?) so that FlatDb could read the data out of zgadfly or something faster, instead of migrating it as I did ? Many thanks! -Simon
Simon Michael wrote:
Flat Database (was ListMate) is just what I need to whip up an interface for non-technical administrators - thanks. So I migrated two data tables ("workshops" & "registrations") from gadfly to flatdb instances using the CSV import feature, and the admin interface is working fine.
I wrote flat database because I wanted some features ListMate didn't have and didn't want ZClasses. I basically copied the structure from ListMate, so it's probably not the best design possible for ZPatterns. So (1) may not be possible with the current code. Maybe try creating entries like so: <dtml-let entry="newItem(id)"> <dtml-call "entry.manage_addProperty('col_workshopid','string','TEST')"> <dtml-call "entry.manage_addProperty('col_firstname','string','TEST')"> <dtml-call "entry.manage_addProperty('col_lastname','string','TEST')"> ... </dtml-let> manage_addEntry doesn't return the new entry. Idon't remember how this works anymore, frankly. The source code is your friend :) -- Itamar S.T. itamar@maxnm.com Fingerprint = D365 7BE8 B81E 2B18 6534 025E D0E7 92DB E441 411C
participants (2)
-
Itamar Shtull-Trauring -
Simon Michael