[Zope-dev] Porting EMarket to ZPatterns...possible good example
James Johnson
jimbo@tacoma.zzn.com
Wed, 13 Sep 2000 22:53:39 -0700
<html><head><meta Name=3D'keywords' Content=3D'commtouch, pronto, mail, =
free email, free, branded, web based, free web based email, communicatio=
ns, internet, software, advertising banners, e-mail, free software'></he=
ad><body ><div align=3D'left'><font ><blockquote><blockquote><TT><BR=
>
I overlooked this posting somehow. I've now actually stored <BR>
something in a ZClass. This seems to be a good working example. <=
BR>
Thanks so much. I will play with the rest and see what I come up =
<BR>
with.<BR>
I had to post it again just in case others missed it like I did.<BR>
<BR>
<BR>
<BR>
<BR>
Thanks Phillip!<BR>
<BR>
OK. that helped a lot. The problem is that when things don't work<BR>
as I expect.. I guess (usually with a high degree of success)<BR>
that I am off base. Now I've just been experimenting with<BR>
this in a simpler 'dtml-only' way just to clarify how it's <BR>
supposed to work.<BR>
<BR>
I created a simple ZClass with no ZClass based propertysheets.<BR>
(The ZClass is called MyTestSkin, subclass of DataSkin)<BR>
<BR>
I created a specialists that manages instances of this ZClass.<BR>
(The specialist is called myTest)<BR>
<BR>
I set up the default rack of myTest with a PlugIn SheetProvider<BR>
with "SheetNames" set to "ShopperData".<BR>
<BR>
Based on your last email the addShopper method in 'myTest' looks like <=
BR>
this:<BR>
<BR>
<dtml-var standard_html_header><BR>
<h2><dtml-var title_or_id> <dtml-var document_title>&=
lt;/h2><BR>
<dtml-let newObj=3D"newItem(REQUEST['id'])"><BR>
<dtml-if "newObj.propertysheets.manage_addPropertySheet<BR>
(id=3D'ShopperData',ns=3D'')"><BR>
<dtml-let newPPS=3D"newObj.propertysheets.get('ShopperData')&qu=
ot;><BR>
<dtml-call "newPPS.manage_addProperty<BR>
(id=3D'email',type=3D'string',value=3D'')"><BR>
<dtml-call "newPPS.manage_addProperty<BR>
(id=3D'passwd',type=3D'string',value=3D'')"><BR>
<dtml-call "newPPS.manage_addProperty<BR>
(id=3D'address',type=3D'string',value=3D'')"><BR>
<dtml-call "newPPS.manage_changeProperties(REQUEST)"><B=
R>
New Shopper Added!<BR>
<form action=3D"<dtml-var "myTest.absolute_url()"&=
gt;"><BR>
<input type=3Dsubmit value=3D"OK!"><BR>
</form><BR>
<BR>
</dtml-let><BR>
<dtml-else><BR>
Cannot add property sheet.<BR>
</dtml-if><BR>
</dtml-let><BR>
<dtml-var standard_html_footer><BR>
<BR>
It seems to work OK. Now.. the index_html for my ZClass wants to look <=
BR>
like this:<BR>
<BR>
<dtml-var standard_html_header><BR>
<h2><dtml-var title_or_id> <dtml-var document_title>&=
lt;/h2><BR>
<p><BR>
email: <dtml-var "email"><br><BR>
address: <dtml-var "address"><br><BR>
</p><BR>
</dtml-let><BR>
<dtml-var standard_html_footer><BR>
<BR>
But I get 'KeyError" on any attribute. I guess I thought that <BR>=
the SheetProvider would kick in when a request was made for 'email'<BR>=
and automagically search the instances propertysheets for an<BR>
attribute that matched. The following did work however:<BR>
<BR>
<dtml-var standard_html_header><BR>
<h2><dtml-var title_or_id> <dtml-var document_title>&=
lt;/h2><BR>
<dtml-let myPPS=3D"propertysheets.get('ShopperData')"><=
BR>
<p><BR>
email: <dtml-var "myPPS.getProperty('email')"><BR>
address: <dtml-var "myPPS.getProperty('address')"><BR>
</p><BR>
</dtml-let><BR>
<dtml-var standard_html_footer><BR>
<BR>
<BR>
This doesn't seem quite right to me... when I use a <BR>
GenericAttributeProvider<BR>
that talks to a database... I can just say <dtml-var foo> and it =
<BR>
works.<BR>
I'm sure I'm still not getting something... but I don't know what. I <B=
R>
can look<BR>
at:<BR>
<BR>
/myTest/a/propertysheets/ShopperData/manage<BR>
<BR>
and it allows me to edit the instance's property sheet through<BR>
the web.. I was hoping (and maybe this is really really just<BR>
wrong...) that there was some 'central' propertsheet that could<BR>
be modified and thereby give all instances new properties.. sorta<BR>
like ZClass property sheets... <BR>
<BR>
Anyway.. I'm now off to try SkinScripts with these test cases...<BR>
<BR>
thanks!<BR>
-steve<BR>
<BR>
<BR>
_______________________________________________<BR>
Zope-Dev maillist =A0- =A0Zope-Dev@zope.org<BR>
http://lists.zope.org/mailman/listinfo/zope-dev<BR>
** =A0No cross posts or HTML encoding! =A0**<BR>
(Related lists - <BR>
http://lists.zope.org/mailman/listinfo/zope-announce<BR>
http://lists.zope.org/mailman/listinfo/zope )<BR>
<BR>
<BR>
<BR>
---- End Original Message ----<BR>
<BR>
<BR>
</TT><br><br><font><p align=3Dleft><br>Get your Free E-mail at http://t=
acoma.zzn.com<br>_______________________________________________________=
_____<br>Get your own Web-Based E-mail Service at http://www.zzn.com<br>=
</blockquote></blockquote></div></font></body></html>