[Zope-dev] ZPatterns: SkinScript semantics
In a SkinScript COMPUTE statement, should I be allowed to supply different names in the OTHERWISE LET section as in the attributes section? For example: WITH some_query() COMPUTE foo,bar,baz OTHERWISE LET foo='There is no foo', spoon='There is no spoon' Looking at the ZPatterns code, I don't think this attribute provider will get registered for providing "spoon", although "spoon" will get calculated if foo, bar or baz is requested. On the other hand, you could consider the above as a shorthand for: WITH some_query() COMPUTE foo,bar,baz, spoon=NOT_FOUND OTHERWISE LET foo='There is no foo', spoon='There is no spoon' In which case, it works entirely as expected. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
"Phillip J. Eby" wrote: > DataSkin is strictly a mix-in class. Sometimes I forget to remind people > of that, and sometimes I even forget it myself. :( DataskinAddons provides a nice DataSkin-derived class for debugging purposes - it has a debug() method that prints out __dict__, and lets you getattr attributes through the web as well. So you can use that for testing purposes. http://www.zope.org/Members/stevea/DataSkinAddons -- Itamar S.T. [EMAIL PROTECTED] Fingerprint = D365 7BE8 B81E 2B18 6534 025E D0E7 92DB E441 411C ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
At 04:42 PM 10/31/00 +0100, Joachim Schmitz wrote: >Hi Steve, > >On Tue, 31 Oct 2000, Steve Spicklemire wrote: > >> >> Joachim> By the way, it only work if specify a DataSkin derived ZClass >> Joachim> under the Storage tab. >> >> Yes... did you attempt to use a 'pure' DataSkin? >> >after your advise not to use a 'pure' DataSkin, I did all the testing with a >DataSkin derived ZClass, when that was working, I tried the 'pure' DataSkin >and it didn't work. > DataSkin is strictly a mix-in class. Sometimes I forget to remind people of that, and sometimes I even forget it myself. :( ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
Hi Steve, On Tue, 31 Oct 2000, Steve Spicklemire wrote: > > Joachim> By the way, it only work if specify a DataSkin derived ZClass > Joachim> under the Storage tab. > > Yes... did you attempt to use a 'pure' DataSkin? > after your advise not to use a 'pure' DataSkin, I did all the testing with a DataSkin derived ZClass, when that was working, I tried the 'pure' DataSkin and it didn't work. 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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
Hi Joachim, > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: Joachim> Hi Steve, Joachim> that did it, many thanks, how did you debug this ? The debugger is your friend. ;-). Seriously I'd be lost without it: http://www.zope.org/Members/michel/HowTos/TheDebuggerIsYourFriend Joachim> By the way, it only work if specify a DataSkin derived ZClass Joachim> under the Storage tab. Yes... did you attempt to use a 'pure' DataSkin? -steve ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
Hi Steve, that did it, many thanks, how did you debug this ? By the way, it only work if specify a DataSkin derived ZClass under the Storage tab. it solved also the problem with the following setup, which didn't work before applying the patch, with an setup like this: SkinScript method: WITH QUERY readEvents(e_id=self.id) COMPUTE event_id=event_id,zeiten=zeiten,firma=firma ,tel=tel,movie_id=movie_id,movie_text=movie_text ,movie_link=movie_link,movie_title ,datum_von=datum_von,datum_bis=datum_bis SQL-method readEvents parameter: e_id:int Querytemplate: 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 = and e.movie_id = m.movie_id and e.veran_id = v.veran_id dtml-method: > On Tue, 31 Oct 2000, Steve Spicklemire wrote: > > OK I think I found the problem(s): > > *** Expressions.py 2000/10/18 23:11:55 1.1.1.3 > --- Expressions.py 2000/10/31 14:14:09 > *** > *** 133,139 > def eval(self,mapping): > """Return the result of looking up/calling the name from 'mapping'. > If the object was created with 'call==1', call it before returning it.""" > ! return md.getitem(self.name,self.call) > > > del Eval, expr_globals, TemplateDict, Base, ComputedAttribute > --- 133,139 > def eval(self,mapping): > """Return the result of looking up/calling the name from 'mapping'. > If the object was created with 'call==1', call it before returning it.""" > ! return mapping.getitem(self.name,self.call) > > > del Eval, expr_globals, TemplateDict, Base, ComputedAttribute > > *** SkinScript/Compiler.py 2000/10/18 23:11:56 1.1.1.4 > --- SkinScript/Compiler.py 2000/10/31 14:12:09 > *** > *** 168,174 > > class Compute(AST): > type = 'COMPUTE' > ! def __init__(self,*args,**args): > self._kids=list(args)+kw.items() > > class Trigger(Compute): > --- 168,174 > > class Compute(AST): > type = 'COMPUTE' > ! def __init__(self,*args,**kw): > self._kids=list(args)+kw.items() > > class Trigger(Compute): > > > Try these patches and see if it works... > > -steve > > > 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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
At 09:16 AM 10/31/00 -0500, Steve Spicklemire wrote: > >OK I think I found the problem(s): > >*** Expressions.py 2000/10/18 23:11:55 1.1.1.3 >--- Expressions.py 2000/10/31 14:14:09 >*** >*** 133,139 > def eval(self,mapping): > """Return the result of looking up/calling the name from 'mapping'. > If the object was created with 'call==1', call it before returning it.""" >! return md.getitem(self.name,self.call) > > > del Eval, expr_globals, TemplateDict, Base, ComputedAttribute >--- 133,139 > def eval(self,mapping): > """Return the result of looking up/calling the name from 'mapping'. > If the object was created with 'call==1', call it before returning it.""" >! return mapping.getitem(self.name,self.call) > Yep, that's it. Looks like I screwed up while doing documentation and cleanup on the file just before release (I was changing parameter names for consistency in the internal docs). :( I'll get this fixed today, and see about releasing an updated beta that also fixes the missing "help" directory for PlugIns. ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
At 12:32 PM 10/31/00 +0100, Joachim Schmitz wrote: > >I changed the SkinScript to: > >WITH QUERY getevent() COMPUTE event_id ,datum_von > >that does not work, I get an key error: event_id > >but finally last try: > >WITH QUERY getevent() COMPUTE event_id=event_id ,datum_von=datum_von > >that worked, so there seams to be a little bug. > Weird. I'll check this out and see if I can reproduce it. Thanks. ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
OK I think I found the problem(s): *** Expressions.py 2000/10/18 23:11:55 1.1.1.3 --- Expressions.py 2000/10/31 14:14:09 *** *** 133,139 def eval(self,mapping): """Return the result of looking up/calling the name from 'mapping'. If the object was created with 'call==1', call it before returning it.""" ! return md.getitem(self.name,self.call) del Eval, expr_globals, TemplateDict, Base, ComputedAttribute --- 133,139 def eval(self,mapping): """Return the result of looking up/calling the name from 'mapping'. If the object was created with 'call==1', call it before returning it.""" ! return mapping.getitem(self.name,self.call) del Eval, expr_globals, TemplateDict, Base, ComputedAttribute *** SkinScript/Compiler.py 2000/10/18 23:11:56 1.1.1.4 --- SkinScript/Compiler.py 2000/10/31 14:12:09 *** *** 168,174 class Compute(AST): type = 'COMPUTE' ! def __init__(self,*args,**args): self._kids=list(args)+kw.items() class Trigger(Compute): --- 168,174 class Compute(AST): type = 'COMPUTE' ! def __init__(self,*args,**kw): self._kids=list(args)+kw.items() class Trigger(Compute): Try these patches and see if it works... -steve ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
Hi Steve, somehow I got the first part working, I don´t exactly remember, what was wrong, but it worked anyhow. my setup was: SkinScript method in defaultRack, Data-Skin: WITH ['a','b'] COMPUTE event_id=RESULT[0],datum_von=RESULT[1] and under Storage I specified my ZClass and loaded accessing by event_id dtml-method: that finally displayed "a b" then I made a sql-method "getevent" with no arguments and a query-template: select event_id,datum_von from event where event_id = 609 tested it and it returns exactly one row. I changed the SkinScript to: WITH QUERY getevent() COMPUTE event_id ,datum_von that does not work, I get an key error: event_id but finally last try: WITH QUERY getevent() COMPUTE event_id=event_id ,datum_von=datum_von that worked, so there seams to be a little bug. 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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
Hi Joachim, Hmm... I just put all the code in myself... to be *really* sure, and it does work. What do you see for 'current attribute handling' in the Data PlugIns tab of the default rack? I would try to simplify. Take out all the skin script execpt for the one line. -steve > "JS" == Joachim Schmitz <[EMAIL PROTECTED]> writes: JS> Hi Steve, JS> I did exactly (hopefully) as you sugested, but the dtml-method JS> fails with: (I moved the SkinScript with first to the top) JS> Error Type: KeyError Error Value: movie_link JS> ... JS> File JS> /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_String.py, JS> line 528, in __call__ (Object: testzclass) File JS> /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_Let.py, JS> line 147, in render (Object: theItem="getItem('anyOldThing')") JS> File JS> /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_With.py, JS> line 146, in render (Object: theItem) KeyError: (see above) JS> what's the best way to debug this ? JS> On Mon, 30 Oct 2000, Steve Spicklemire wrote: >> Hi Joachim, >> >> Hmm.. I would start start really simple here, and then 'work >> up' to the sql query Create a default rack with the >> following SkinScript. >> ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
Hi Steve, I did exactly (hopefully) as you sugested, but the dtml-method fails with: (I moved the SkinScript with first to the top) Error Type: KeyError Error Value: movie_link ... File /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__ (Object: testzclass) File /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_Let.py, line 147, in render (Object: theItem="getItem('anyOldThing')") File /usr/local/Zope-2.2.0/lib/python/DocumentTemplate/DT_With.py, line 146, in render (Object: theItem) KeyError: (see above) what's the best way to debug this ? On Mon, 30 Oct 2000, Steve Spicklemire wrote: > > Hi Joachim, > >Hmm.. I would start start really simple here, and then 'work up' > to the sql query Create a default rack with the following > SkinScript. > > WITH ['a','b','c'] COMPUTE movie_link=RESULT[0],movie_title=RESULT[1], >zeiten=RESULT[2] > > Set the storage for this rack to be a DataSkin derived ZClass loaded by > accessing attribute 'movie_link'. Then try the following method in the Specialist: > > > > > > > > > > > > > If this does what you expect.. then you're getting close. Now change the > ['a','b','c'] to be a call to your query: > > WITH yourQuery(... parameters for your query... ) COMPUTE movie_link, movie_title... >etc. > > If you get the same errors in the first case.. then your problem has > nothing to do with SQL. > > -steve > > > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: > > Joachim> On Mon, 30 Oct 2000, Steve Spicklemire wrote: > > >> Hi Joachim, > >> > >> rackList just refers to the racks in the 'racks' tab of the > >> Specialist. Do you have any racks defined for this Specialist? > >> The rackList is managed magically with the plug-in-group stuff. > >> > Joachim> Yes that's what I found too, but it doesn't work, with > Joachim> SQL-database and SkinScripts, the setup is described > Joachim> below: > > >> > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: > >> > Joachim> for debugging I inserted in Specialists.py in getItem: > >> > Joachim> return str(self.rackList) <-- inserted for rack in > Joachim> self.rackList: item = rack.__of__(self).getItem(key) if > Joachim> item is not None: return item > >> > Joachim> this alway returns an empty list, when calling it from > Joachim> the dtml: > >> > Joachim> returns "[]" > >> > Joachim> I tried to follow the magic how this rackList is setup, > Joachim> but it is to much python-Zen for me. > >> > Joachim> 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 = > >> > 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 >> >
Re: [Zope-dev] ZPatterns + Skinscript
My Experience with 'raw' DataSkins is that you'll quickly run afoul of the Zope Security system. Using a ZClass that has ZPatterns:DataSkin as a base class avoids this, and gives you an easy way to put a 'user interface' on your objects. -steve > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: Joachim> Hi Steve, Joachim> thanks for the tips, I try to do it without the ZClass, Joachim> according to my understanding, and Phil Eby's reply that Joachim> should work too, but apparently I the first one to try Joachim> it. I try it out. Joachim> On Mon, 30 Oct 2000, Steve Spicklemire wrote: >> Hi Joachim, >> >> Hmm.. I would start start really simple here, and then 'work >> up' to the sql query Create a default rack with the >> following SkinScript. >> >> WITH ['a','b','c'] COMPUTE >> movie_link=RESULT[0],movie_title=RESULT[1], zeiten=RESULT[2] >> >> Set the storage for this rack to be a DataSkin derived ZClass >> loaded by accessing attribute 'movie_link'. Then try the >> following method in the Specialist: >> >> > theItem="getItem('anyOldThing')"> > movie_link> >> >> >> >> If this does what you expect.. then you're getting close. Now >> change the ['a','b','c'] to be a call to your query: >> >> WITH yourQuery(... parameters for your query... ) COMPUTE >> movie_link, movie_title... etc. >> >> If you get the same errors in the first case.. then your >> problem has nothing to do with SQL. >> >> -steve >> >> > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: >> Joachim> On Mon, 30 Oct 2000, Steve Spicklemire wrote: >> >> Hi Joachim, >> >> >> >> rackList just refers to the racks in the 'racks' tab of the >> >> Specialist. Do you have any racks defined for this >> Specialist? >> The rackList is managed magically with the >> plug-in-group stuff. >> >> Joachim> Yes that's what I found too, but it doesn't work, with Joachim> SQL-database and SkinScripts, the setup is described Joachim> below: >> >> > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> >> writes: >> >> Joachim> for debugging I inserted in Specialists.py in getItem: >> >> Joachim> return str(self.rackList) <-- inserted for rack in Joachim> self.rackList: item = rack.__of__(self).getItem(key) if Joachim> item is not None: return item >> >> Joachim> this alway returns an empty list, when calling it from Joachim> the dtml: >> >> Joachim> returns "[]" >> >> Joachim> I tried to follow the magic how this rackList is setup, Joachim> but it is to much python-Zen for me. >> >> Joachim> 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 = >> > >> 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 re
Re: [Zope-dev] ZPatterns + Skinscript
Hi Steve, thanks for the tips, I try to do it without the ZClass, according to my understanding, and Phil Eby's reply that should work too, but apparently I the first one to try it. I try it out. On Mon, 30 Oct 2000, Steve Spicklemire wrote: > > Hi Joachim, > >Hmm.. I would start start really simple here, and then 'work up' > to the sql query Create a default rack with the following > SkinScript. > > WITH ['a','b','c'] COMPUTE movie_link=RESULT[0],movie_title=RESULT[1], >zeiten=RESULT[2] > > Set the storage for this rack to be a DataSkin derived ZClass loaded by > accessing attribute 'movie_link'. Then try the following method in the Specialist: > > > > > > > > > > > > > If this does what you expect.. then you're getting close. Now change the > ['a','b','c'] to be a call to your query: > > WITH yourQuery(... parameters for your query... ) COMPUTE movie_link, movie_title... >etc. > > If you get the same errors in the first case.. then your problem has > nothing to do with SQL. > > -steve > > > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: > > Joachim> On Mon, 30 Oct 2000, Steve Spicklemire wrote: > > >> Hi Joachim, > >> > >> rackList just refers to the racks in the 'racks' tab of the > >> Specialist. Do you have any racks defined for this Specialist? > >> The rackList is managed magically with the plug-in-group stuff. > >> > Joachim> Yes that's what I found too, but it doesn't work, with > Joachim> SQL-database and SkinScripts, the setup is described > Joachim> below: > > >> > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: > >> > Joachim> for debugging I inserted in Specialists.py in getItem: > >> > Joachim> return str(self.rackList) <-- inserted for rack in > Joachim> self.rackList: item = rack.__of__(self).getItem(key) if > Joachim> item is not None: return item > >> > Joachim> this alway returns an empty list, when calling it from > Joachim> the dtml: > >> > Joachim> returns "[]" > >> > Joachim> I tried to follow the magic how this rackList is setup, > Joachim> but it is to much python-Zen for me. > >> > Joachim> 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 = > >> > 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: > >> >> > >> >> returns none or >> >> "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
Re: [Zope-dev] ZPatterns + Skinscript
Hi Joachim, Hmm.. I would start start really simple here, and then 'work up' to the sql query Create a default rack with the following SkinScript. WITH ['a','b','c'] COMPUTE movie_link=RESULT[0],movie_title=RESULT[1], zeiten=RESULT[2] Set the storage for this rack to be a DataSkin derived ZClass loaded by accessing attribute 'movie_link'. Then try the following method in the Specialist: If this does what you expect.. then you're getting close. Now change the ['a','b','c'] to be a call to your query: WITH yourQuery(... parameters for your query... ) COMPUTE movie_link, movie_title... etc. If you get the same errors in the first case.. then your problem has nothing to do with SQL. -steve > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: Joachim> On Mon, 30 Oct 2000, Steve Spicklemire wrote: >> Hi Joachim, >> >> rackList just refers to the racks in the 'racks' tab of the >> Specialist. Do you have any racks defined for this Specialist? >> The rackList is managed magically with the plug-in-group stuff. >> Joachim> Yes that's what I found too, but it doesn't work, with Joachim> SQL-database and SkinScripts, the setup is described Joachim> below: >> > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: >> Joachim> for debugging I inserted in Specialists.py in getItem: >> Joachim> return str(self.rackList) <-- inserted for rack in Joachim> self.rackList: item = rack.__of__(self).getItem(key) if Joachim> item is not None: return item >> Joachim> this alway returns an empty list, when calling it from Joachim> the dtml: >> Joachim> returns "[]" >> Joachim> I tried to follow the magic how this rackList is setup, Joachim> but it is to much python-Zen for me. >> Joachim> 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 = >> > 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: >> >> >> >> returns none or > >> "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. >> >> > >> >> > >> >> Joachim> Mit freundlichen Grüßen Joachim> Joachim Schmitz Joachim> AixtraWare, Ing. Büro
Re: [Zope-dev] ZPatterns + Skinscript
On Mon, 30 Oct 2000, Steve Spicklemire wrote: > > Hi Joachim, > >rackList just refers to the racks in the 'racks' tab > of the Specialist. Do you have any racks defined for > this Specialist? The rackList is managed magically > with the plug-in-group stuff. > Yes that's what I found too, but it doesn't work, with SQL-database and SkinScripts, the setup is described below: > > "Joachim" == Joachim Schmitz <[EMAIL PROTECTED]> writes: > > Joachim> for debugging I inserted in Specialists.py in getItem: > > Joachim> return str(self.rackList) <-- inserted for rack in > Joachim> self.rackList: item = rack.__of__(self).getItem(key) if > Joachim> item is not None: return item > > Joachim> this alway returns an empty list, when calling it from > Joachim> the dtml: > > Joachim> returns "[]" > > Joachim> I tried to follow the magic how this rackList is setup, > Joachim> but it is to much python-Zen for me. > > Joachim> 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 = >> 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: > >> > >> returns none or >> "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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
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: 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 = > > >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: > > returns none > or > 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 - [EMAIL PROTECTED] > 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 ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
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 = > >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: returns none or 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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
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 = >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. ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns + Skinscript
At 03:39 PM 10/27/00 +0200, Joachim Schmitz wrote: >I trying to understand ZPatterns and using it for a real world example which >uses a SQL-based storage. > >can I do it just by defining the appropriate SkinScript Method in my >defaultrack as data plugin. Do I define everything in one SkinScript Method, >and what must be the name of that method. Can I delete the Specialist >Plugins, PersistentSheets and PersistenceAttributes which are created, when >I add a new rack ? Yes, you can, and for a pure SQL scenario, you should either remove the Persistent Attribute Provider, or place your SkinScript method before it in the pecking order. If you need to support WebDAV property sheets, you might want to leave the Persistent Sheet Provider in place. There is no special name required for your SkinScript, and you can define as much as you want in a single method. The only downside to really large SkinScript methods is that they take longer to compile when you change them. There is no run-time performance difference between one large method and lots of small ones, because they still compile to the same number of "hidden" plugins: one per statement. Last, but not least, in an SQL scenario with no persistent data for the objects, you will want to change the settings on the Rack's Storage tab to use an attribute to test for object existence. ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
[Zope-dev] ZPatterns + Skinscript
I trying to understand ZPatterns and using it for a real world example which uses a SQL-based storage. can I do it just by defining the appropriate SkinScript Method in my defaultrack as data plugin. Do I define everything in one SkinScript Method, and what must be the name of that method. Can I delete the Specialist Plugins, PersistentSheets and PersistenceAttributes which are created, when I add a new rack ? Could you provide a simple example ? The SkinScript syntax wiki has many examples, but not in context of a working example. Any hints are welcome 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 - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns: SkinScript discovery
Steve Alexander wrote: > > "Phillip J. Eby" wrote: > > > > Just out of curiosity, did you find this out by reading the draft > > SkinScript reference documentation on the ZPatterns Wiki? > > No. I just guessed. > I think I might have read it in the source the other day too. > > I'll take a look at the wiki now: > http://www.zope.org//Members/pje/Wikis/ZPatterns/SkinScriptSyntax Reading further, these are *very* useful docs! Now, I can start moving on from guesswork and intuition :-) Many thanks. -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns: SkinScript discovery
"Phillip J. Eby" wrote: > > Just out of curiosity, did you find this out by reading the draft > SkinScript reference documentation on the ZPatterns Wiki? No. I just guessed. I think I might have read it in the source the other day too. I'll take a look at the wiki now: http://www.zope.org//Members/pje/Wikis/ZPatterns/SkinScriptSyntax expression A DTML-style Python expression. As with DTML, the "_" object is available for access to Python built-ins and library functions. Aha! I'm looking forward to using the new "OTHERWISE LET" clause too, when the next release of ZPatterns comes out. Thanks. > At 03:45 PM 10/4/00 +0100, Steve Alexander wrote: > >I just found out that you can access all sorts of useful methods in > >SkinScript from the magical "_" namespace variable. > > > >Let's say I have a DataSkin that has a propertysheet "journey", which > >has a "steps" property of type "lines". I can expose its "steps" > >property as an attribute, and also a neatly formatted version of the > >same, using this SkinScript: > > > >WITH self.propertysheets.get('journey') COMPUTE > > steps=getProperty('steps'), > > steps_comma_sep=_.string.join(self.steps, ', ') -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
Re: [Zope-dev] ZPatterns: SkinScript discovery
Just out of curiosity, did you find this out by reading the draft SkinScript reference documentation on the ZPatterns Wiki? At 03:45 PM 10/4/00 +0100, Steve Alexander wrote: >I just found out that you can access all sorts of useful methods in >SkinScript from the magical "_" namespace variable. > >Let's say I have a DataSkin that has a propertysheet "journey", which >has a "steps" property of type "lines". I can expose its "steps" >property as an attribute, and also a neatly formatted version of the >same, using this SkinScript: > >WITH self.propertysheets.get('journey') COMPUTE > steps=getProperty('steps'), > steps_comma_sep=_.string.join(self.steps, ', ') > ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )
[Zope-dev] ZPatterns: SkinScript discovery
I just found out that you can access all sorts of useful methods in SkinScript from the magical "_" namespace variable. Let's say I have a DataSkin that has a propertysheet "journey", which has a "steps" property of type "lines". I can expose its "steps" property as an attribute, and also a neatly formatted version of the same, using this SkinScript: WITH self.propertysheets.get('journey') COMPUTE steps=getProperty('steps'), steps_comma_sep=_.string.join(self.steps, ', ') -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net ___ Zope-Dev maillist - [EMAIL PROTECTED] 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 )