[Zope-dev] ZPatterns + Skinscript
Phillip J. Eby
pje@telecommunity.com
Sat, 28 Oct 2000 14:16:21 -0500
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.
>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.
>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.