[Zope] Exporting zodb data (Urgent)

Sukhwinder Singh ssruprai@hotmail.com
Thu, 3 Jul 2003 10:39:06 -0700


Sergey Volobuev wrote

> Click on some ZClass. Than click on Property Sheets tab.  Most probably
> you will find one or more property sheets there. Click on them You will
> see the list of properties defined for this ZClass. After you have list
> of all properties of all your ZClasses writing the script which will
> iterate over your objects is trivial.
>


Yes I have been able to find all properties and their data types.

Thank you very much.

The script I am using to extract data from one object is like this:

def export_students(self):
 container = self
 self.REQUEST.RESPONSE.setHeader('Content-Type','text/csv')
 students=container.Catalog()
 studentsData = ""
 firstTime = 1
 for student in students:
  o = student.getObject()
  addr = (o.address)
  address = ""
  for ad in addr:
   address += ad
  studentsData = student.id + ", " + student.name +  ", " + student.surname
+ ", " + address + ", " + student.area + ", " + o.licence_type + ", " +
o.age_range_text + ", " + o.phone + ", " + o.mobile + ", " + o.comments + ",
" + o.reason_for_leaving + ", " + o.comment_on_leaving + ", " +
o.meeting_date_text + ", "+ student.instructor_id + ", " + o.operator_id +
", " + o.start_date +"\r\n"
 return studentsData


 The above script is working.

But I am not able to understand why I have to use two variables to access
properties.

First uses student object returned by "for student in students" and the
second uses o object returned by student.getObject().

If I use o where I have used student, error results and vice versa. What is
the difference getObject and "for student in students"? Why can't I use just
student to retrieve all properties or just o?

--Sukhwinder Singh