[Zope-dev] ZPatterns: SkinScript semantics

2001-01-20 Thread Steve Alexander

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

2000-10-31 Thread Steve Spicklemire


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

2000-10-31 Thread Steve Spicklemire


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

2000-10-31 Thread Joachim Schmitz

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

2000-10-31 Thread Phillip J. Eby

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

2000-10-31 Thread Itamar Shtull-Trauring

"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

2000-10-30 Thread Joachim Schmitz

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  -  [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

2000-10-30 Thread Joachim Schmitz

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 dtml-var "getItem(_.int(609))" 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 = 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  -  [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

2000-10-30 Thread Steve Spicklemire


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:
 
 dtml-var standard_html_header dtml-let
 theItem="getItem('anyOldThing')" dtml-with theItem dtml-var
 movie_link dtml-var movie_title dtml-var zeiten
 
 /dtml-with /dtml-let dtml-var standard_html_footer
 
 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 dtml-var "getItem(_.int(609))" 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 =  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 

Re: [Zope-dev] ZPatterns + Skinscript

2000-10-30 Thread Joachim Schmitz

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:
 
 dtml-var standard_html_header
 dtml-let theItem="getItem('anyOldThing')"
 dtml-with theItem
 dtml-var movie_link
 dtml-var movie_title
 dtml-var zeiten
 
 /dtml-with
 /dtml-let
 dtml-var standard_html_footer
 
 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 dtml-var "getItem(_.int(609))" 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 =
  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
  

Re: [Zope-dev] ZPatterns + Skinscript

2000-10-30 Thread Steve Spicklemire


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

2000-10-29 Thread Joachim Schmitz

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  -  [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

2000-10-28 Thread Phillip J. Eby

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.


___
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

2000-10-27 Thread Joachim Schmitz

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

2000-10-04 Thread Phillip J. Eby

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 )




Re: [Zope-dev] ZPatterns: SkinScript discovery

2000-10-04 Thread Steve Alexander

"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 )