[Zope] Exporting zodb data (Urgent)
Sukhwinder Singh
ssruprai@hotmail.com
Tue, 1 Jul 2003 00:04:11 +0530
Dieter Maurer worte at Sunday, June 29, 2003 11:08 AM
> > for employee in container.employees
> > print employee.name
>
> Go to the "Properties" tab of these objects.
> Do you see there the relevant properties?
>
The main "/" (root) folder of the application, under which all other files
are stored shows a tooltip of "Ffolder w/Customizer support". There are
other folders in this root folder like, Control_Panel, acl_users.
When I click the root folder of this application which is "school".
Many subfolders and other files are displayed.
The objects I am talking about, like employees and students, are shown with
specialist icons( Icon of a person sitting on a desk). What this means? What
kind of objects these are?
When I click these objects (for example, employee) and check their
properties, no property is defined. But under these objects their are dtml
methods, python scripts and other dtml files. Some external methods were
added by
earlier programmer under these folder/objects to export data from each of
these
objects (specialists). But I don't know how he determined attributes of
these objects (like employee.id, employee.is_operator) etc.
These external methods in each specialist call a scipt like this to export
data:
/////////////////////////////////////////////////////////////////
def list_all_employees(self):
self.REQUEST.RESPONSE.setHeader('Content-Type','text/csv')
start_time=DateTime()
container=self
result=[]
r=""
q=""
e_id=""
e_name=""
e_isop=""
e_surname=""
employees=container.Catalog()
for employee in employees:
e_name = employee.name
e_id = employee.id
e_isop = "%s" % (employee.is_operator)
e_surname = employee.surname
q+=e_id+"#"+e_isop+"#"+e_name+"#"+e_surname+"\n"
return q
def list_all_adverts(self):
self.REQUEST.RESPONSE.setHeader('Content-Type','text/csv')
start_time=DateTime()
container=self
result=[]
r=""
q=""
e_id=""
e_name=""
e_isop=""
e_surname=""
adverts=container.Catalog()
for advert in adverts:
a_class = "%s" %(advert.classification)
a_id = "%s" %(advert.id)
a_desc = "%s" %(advert.description)
a_name= "%s" %(advert.name)
q+=a_class+"#"+a_desc+"#"+a_id+"#"+a_name+"\n"
return q
////////////////////////////////////////////////////////////
But problem is that he had to add these external methods under each of these
object himself to export data. Also how did he determine, whether there was
an attribute "employee.is_operator" and names of other attributes?
So now, can I do it without requiring client to install these external
methods themselves under each folder? Becuase they don't know how to manage
zope. If there was only one script to be installed, then may be able to do
it. But for each object it may not be possible.
So this is all I know.
Can I give them just one script which they can install in root of their
application and which when called exports all data to csv or other format?
--Sukhwinder Singh