[ZPatterns] error when creating a newItem

Joachim Schmitz js@aixtraware.de
Wed, 31 Oct 2001 14:19:44 +0100 (CET)


hi,

I have a specialist which stores its data in a mysql-database. The
default-rack has the following skinscript


INITIALIZE OBJECT WITH name=' ',ort=' ',ansprechpartner=' '

WITH SELF COMPUTE
    SearchText='%s %s %s' % (name, ort, ansprechpartner)

WHEN OBJECT CHANGED CALL
   Catalog.catalog_object(self, _.string.join(self.getPhysicalPath(),'/'))

WHEN OBJECT DELETED CALL
   Catalog.uncatalog_object(_.string.join(self.getPhysicalPath(),'/'))

WHEN OBJECT ADDED CALL
       SQL_insert(
       buchhandlungID=self.id
       ,name=self.name
       ,plz=self.plz
       ,strasse=self.strasse
       ,ort=self.ort
       ,bundesland=self.bundesland
       ,land=self.land
       ,telefon=self.telefon
       ,fax=self.fax
       ,ansprechpartner=self.ansprechpartner
       ,url=self.url
       ,bestellEmail=self.bestellEmail
       ,nachfrageEmail=self.nachfrageEmail
       )

WHEN OBJECT CHANGED STORE
       buchhandlungID
       ,name
       ,plz
       ,strasse
       ,ort
       ,bundesland
       ,land
       ,telefon
       ,fax
       ,ansprechpartner
       ,url
       ,bestellEmail
       ,nachfrageEmail
    USING
       SQL_update(
       buchhandlungID=self.id
       ,name=self.name
       ,plz=self.plz
       ,strasse=self.strasse
       ,ort=self.ort
       ,bundesland=self.bundesland
       ,land=self.land
       ,telefon=self.telefon
       ,fax=self.fax
       ,ansprechpartner=self.ansprechpartner
       ,url=self.url
       ,bestellEmail=self.bestellEmail
       ,nachfrageEmail=self.nachfrageEmail
       )
WHEN OBJECT DELETED CALL
       SQL_delete(buchhandlungID=self.id)


WITH QUERY SQL_find(buchhandlungID=self.id)
    COMPUTE
       buchhandlungID
       ,name
       ,plz
       ,strasse
       ,ort
       ,bundesland
       ,land
       ,telefon
       ,fax
       ,ansprechpartner
       ,url
       ,bestellEmail
       ,nachfrageEmail


####

this works fine, when accessing existing objects. But when I do a

newItem(new_id) I get:

Error Type: NameError
Error Value: global name 'name' is not defined

 File <string>, line 2, in f
    (Object: guarded_getattr)
  File Zope-2.4.1/lib/python/Products/ZCatalog/ZCatalog.py, line 498, in catalog_object
    (Object: LockableItem)
  File Zope-2.4.1/lib/python/Products/ZCatalog/Catalog.py, line 438, in catalogObject
  File Zope-2.4.1/lib/python/Products/PluginIndexes/TextIndex/TextIndex.py, line 353, in index_object
    (Object: PluggableIndex)
  File Zope-2.4.1/lib/python/Products/ZPatterns/DataSkins.py, line 215, in __get_attr__
    (Object: LockableItem)
  File Zope-2.4.1/lib/python/Products/ZPatterns/AttributeProviders.py, line 355, in _AttributeFor
    (Object: GAPMixin)
  File Zope-2.4.1/lib/python/Products/ZPatterns/AttributeProviders.py, line 343, in _AttributeFor
    (Object: GAPMixin)
  File Zope-2.4.1/lib/python/Products/ZPatterns/Expressions.py, line 123, in eval
  File Zope-2.4.1/lib/python/DocumentTemplate/DT_Util.py, line 231, in eval
    (Object: '%s %s %s' % ( name , ort , ansprechpartner  ))
    (Info: ort)
  File <string>, line 2, in f
NameError: (see above)

The base ZClass is just a dummy.



Mit freundlichen Grüßen

Joachim Schmitz

AixtraWare, Ing. Büro für Internetanwendungen
Hüsgenstr. 33a, D-52457 Aldenhoven
Telefon: +49-2464-8851, FAX: +49-2464-905163