[Zope] Re: [Zope-dev] creating one ZClass instance in the con structor of another

Kevin Dangoor kid@kendermedia.com
Fri, 23 Jul 1999 12:10:01 -0400 (EDT)


--- Brian Lloyd <Brian@digicool.com> wrote:
> Can you post the actual scripting that you're using?
> It's hard
> for me to narrow down what's going on without
> context...

OK. Here's the layout:

Products
 Kendermedia
  KMArticleStore (ZClass)
    AddArticle (DTML Method)
  KMArticle (ZClass)

KMArticle is not under the KMArticleStore because it
is actually contained within a Folder (as you will see
from the AddArticle code)

I am using the default Factory and add methods at this
point.

AddArticle (please excuse the formatting here, I'm
sending from yahoo):
<dtml-var standard_html_header>
<!-- I've got excess variables in here -->
<dtml-call "REQUEST.set('ts', ZopeTime())">
<dtml-call "REQUEST.set('tsyear', _.str(ts.year()))">
<dtml-call "REQUEST.set('tsmonth',
_.str(ts.month()))">
<dtml-call "REQUEST.set('uniqueID',_.str(_.int(ts)))">
<dtml-call "REQUEST.set('id', uniqueID)">
<!-- check if the Folder for the year exists -->
<dtml-if "not _.hasattr(PARENTS[0], tsyear)">
<dtml-call "manage_addFolder(tsyear, '')">
</dtml-if>
<!-- check if the Folder for the month exists -->
<dtml-if "not _.hasattr(_[tsyear], tsmonth)">
 <dtml-with "_[tsyear]">
  <dtml-call "manage_addFolder(tsmonth, '')">
 </dtml-with>
</dtml-if>
<dtml-with REQUEST>
 <dtml-with "_[tsyear]">
  <dtml-with "_[tsmonth]">
   <dtml-call
"Control_Panel.Products.Kendermedia.KMArticle_add(REQUEST)">
  </dtml-with>
 </dtml-with>
</dtml-with>
<h2>Article submitted! Thanks!</h2>
<dtml-var standard_html_footer>

To recap, the error is a NameError... it is saying
that it can't find KMArticle from within the
KMArticle_add method.

Kevin
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com