[Zope-dev] ZPatterns + Skinscript

Joachim Schmitz js@aixtraware.de
Mon, 30 Oct 2000 09:40:25 +0100 (CET)


for debugging I inserted in Specialists.py in getItem:

return str(self.rackList) <-- inserted 
for rack in self.rackList:
    item = rack.__of__(self).getItem(key)
    if item is not None: return item

this alway returns an empty list, when calling it from the dtml:

<dtml-var "getItem(_.int(609))">  returns "[]"

I tried to follow the magic how this rackList is setup, but it is to much
python-Zen for me.

On Sun, 29 Oct 2000, Joachim Schmitz wrote:

> On Sat, 28 Oct 2000, Phillip J. Eby wrote:
> 
> > At 05:17 PM 10/28/00 +0200, Joachim Schmitz wrote:
> > >
> > >select e.event_id as event_id
> > >,e.zeiten as zeiten
> > >,v.firma as firma
> > >,v.tel as tel
> > >,e.movie_id as movie_id
> > >,m.movie_title as movie_title
> > >,m.movie_link as movie_link
> > >,m.movie_text as movie_text
> > >,e.datum_von as datum_von
> > >,e.datum_bis as datum_bis
> > >from event as e, veranstalter as v, movies as m 
> > >where  
> > >e.event_id = <dtml-sqlvar e_id type=int>
> > >and e.movie_id = m.movie_id and e.veran_id = v.veran_id
> > >order by m.movie_title
> > 
> > Just out of curiosity, why do you have an "order by" clause, if this is
> > supposed to only return one row?  If more than one item is returned by this
> > query, only the first will be used to supply data to your DataSkin.
> > 
> that was just left over from an reused query-template, I forgot to take it
> out.
> 
> > 
> > >I also added a SkinScript method as a Data Plug-in in the defaultRack like
> > this
> > >
> > >WITH QUERY readEvents(e_id=self.event_id) COMPUTE zeiten,firma,tel
> > >,movie_id,movie_text,movie_link,movie_title
> > >,datum_von,datum_bis,zeiten
> > 
> > Do you have some way of providing self with an "event_id" value?  Keep in
> > mind that when DataSkins are created, they have only an "id" attribute,
> > nothing else.  So unless you have an attribute provider that provides an
> > "event_id" value, this statement will fail.  Perhaps what you actually mean
> > is:
> > 
> > WITH QUERY readEvents(e_id=self.id) COMPUTE 
> >   event_id,
> >   zeiten,firma,tel,
> >   movie_id,movie_text,movie_link,movie_title,
> >   datum_von,datum_bis,zeiten
> > 
> > Notice that I'm passing self.id to readEvents, and that I've added event_id
> > to the list of attributes retrieved from the query.
> > 
> how do I set "self.id" I tried in dtml-method in the event-specialist:
> There is a event_id 609 in the table:
> 
> <dtml-var "getItem(_.int(609))">  returns none
> or
> <dtml-var "getItem(key=_.int(609))"> returns none
> 
> 
> > 
> > >under the storage tab I selected for:
> > >
> > >Class to use for stored items: ZPatterns:DataSkin and
> > >
> > >Objects are: o stored persistently.
> > >             x loaded by accessing attribute: event_id
> > 
> > This will work fine, if you use the revised SkinScript above.  You will
> > probably want to create a ZClass subclass of DataSkin at some point to use
> > instead, so that you can define permissions, methods, and so on for your
> > Event objects.
> > 
> > 
> 
> 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
> 
> 
> _______________________________________________
> Zope-Dev maillist  -  Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> **  No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope )
> 
> 

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