[Zope] Exporting zodb data (Urgent)

Dennis Allison allison@sumeru.stanford.EDU
Sun, 29 Jun 2003 10:38:51 -0700 (PDT)


I share Paul's conclusions.  If this is anything like the normal school 
application which has grown, porting to PHP and maintaining the same 
functionality is a non-trivial task.  Zope and PHP are very differnt.
The best approach would be to simply improve the performance of the 
current system--you'll have to learn to Zope system, but if you end up 
doing the port you'll have to do that anyhow.  My guess is that you have
a system where a little analysis and a little thought can provide enormous
performance gains.

On Sun, 29 Jun 2003, Paul Winkler wrote:

> On Sun, Jun 29, 2003 at 02:20:45AM +0530, Sukhwinder Singh wrote:
> > Hello,
> > 
> > Thanks for replying.
> > 
> > It is a school application which stored information about employees,
> > students, trainings etc.
> > What I know is they have used dtml methods, python scripts and folders to
> > organize their app. But not custom products. I have checked those objects
> > using /manage. And most of these are methods and other dtml files. I have
> > also checked some of the dtml files.and python scripts.
> 
> I'm still wondering why this app is slow.  I would hazard a guess that
> the implementation is not adequate to the number of objects. 
> E.g. there might be something like
> 
> for foo in some_folder.objectItems():
>     do something with a property of foo
>    
> ... which is fine when some_folder contains a small number of objects,
> but when it grows to thousands, this will be very inefficient.
> Even worse would be using zope_find() which is really meant to
> be a convenience for developers and administrators, not for
> application code.
> 
> Such an application should be redesigned to use ZCatalog which is
> very fast.
> 
> Of course this is only a guess, and optimization should NEVER be based
> on guesses, that is what profiling is for.
> 
> I still don't understand how you are expected to do this job.
> To make an analogy, if I needed to extract a large data set from
> a MySQL database, I wouldn't give the task to someone who had
> never used SQL before. If I wanted to re-implement a Smalltalk 
> application in Java, I wouldn't hire a java developer who has never 
> used smalltalk.  No wonder you're finding this difficult.
> 
> But I guess it's too late, the boss has dictated PHP and you
> are stuck with the task. So I'll try to give you what you
> want, no matter how wrong I think it is :)
> 
> > These files get data using something like:
> > 
> > for employee in container.employees
> > print employee.name
> 
> well, i'm still only guessing what the real code is, since that
> doesn't look like anything that really works.
> 
> Since you say there's nothing but folders, python scripts and DTML,
> I guess that maybe there is a DTML Document that represents each
> employee, and I further guess that they are using Properties to store
> data about each employee. Mind you, this is only a guess.
> You could verify this by looking at the Properties tab on some of 
> the objects that represent employees.
> 
> > These files/scripts/methods are in their respective folders. For example, a
> > script which displays employee data is in employees folder and script which
> > exports student data is in students folder.
> > 
> > But when I try to use this method of using for each * in container.students
> > or container.employees outside these folders (in the root folder) error is
> > displayed like container is not defined etc. Is container something built in
> > or their custom class?
> 
> "container" is a bound name that's always available in Python Script (and
> in Page Templates which you don't seem to be using).  It refers to the
> container (usually a Folder) in which the Script object lives.
> This is described in the Advanced Scripting chapter of the online 
> Zope Book.
> 
> The "container" name is NOT bound in an External Method, nor is it
> bound in DTML.
> In an External Method, you can use "self" instead (if self is the first
> parameter of the function definition bound to the external method).
> In DTML, it's typical to just ask for the name without a qualifying
> namespace like "container". DTML then automagically looks in many
> places for this name.
> 
> > If there is no other solution than learning zope then tell me what are the
> > things I should learn about only to export data. I have downloaded zope
> > guide 
> 
> Do you mean the Zope Book?
> 
> > and developer guide
> 
> Probably not much help to you, it's for developing add-on Products.
> 
> > and admin guide.
> 
> Dead project as far as I know, and probably not relevant anyway.
> 
> You might find this chapter of the online Zope Book very useful:
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.stx
> I suspect the section on "The Zope API" will be particularly
> useful, once you understand the differences between Scripts
> and External Methods etc.
> 
> That chapter builds on concepts that are described in earlier chapters:
> 
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/UsingZope.stx
> (introduces Properties, among other things)
> 
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/Acquisition.stx
> (introduces Acquisition, very important)
> 
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/DTML.stx
> (basic DTML)
> 
> http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/AppendixE.stx
> (describes how names are looked up in dtml-var expressions)
> 
> -- 
> 
> Paul Winkler
> http://www.slinkp.com
> Look! Up in the sky! It's FJUK- XENON MEGA!
> (random hero from isometric.spaceninja.com)
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>