[Zope] Adding instances - How sending meta_type by argument ?
Menard.Jean-Francois@hydro.qc.ca
Menard.Jean-Francois@hydro.qc.ca
Fri, 16 Feb 2001 14:49:57 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C09851.A21AFA20
Content-Type: text/plain;
charset="iso-8859-1"
Sorry for the long post...
I'm trying to create a general insert method that will be inherited by all
my sub-objects. I would like to send a parameter, "type", that will
determine what type of object to create.
I tried this:
<dtml-with "manage_addProduct['normalisation']">
<dtml-with "_[type].createInObjectManager(REQUEST['NewId'], REQUEST)">
<dtml-call reindex_object>
</dtml-with>
</dtml-with>
And I pass the meta-type as parameter "type". I receive the following
error:
Error Type: AttributeError
Error Value: createInObjectManager
Traceback (innermost last):
File D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 222, in
publish_module
File D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 187, in publish
File D:\INTRAN~1\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
(Object: CatalogAware)
File D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 171, in publish
File D:\INTRAN~1\lib\python\ZPublisher\mapply.py, line 160, in mapply
(Object: insert)
File D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 112, in
call_object
(Object: insert)
File D:\INTRAN~1\lib\python\OFS\DTMLMethod.py, line 189, in __call__
(Object: insert)
File D:\INTRAN~1\lib\python\DocumentTemplate\DT_String.py, line 538, in
__call__
(Object: insert)
File D:\INTRAN~1\lib\python\DocumentTemplate\DT_With.py, line 146, in
render
(Object: manage_addProduct['normalisation_externe'])
File D:\INTRAN~1\lib\python\DocumentTemplate\DT_With.py, line 133, in
render
(Object: _[type].propertysheets.createInObjectManager(REQUEST['NewId'],
REQUEST))
File D:\INTRAN~1\lib\python\DocumentTemplate\DT_Util.py, line 334, in eval
(Object: _[type].propertysheets.createInObjectManager(REQUEST['NewId'],
REQUEST))
(Info: type)
File <string>, line 0, in ?
File D:\INTRAN~1\lib\python\DocumentTemplate\DT_Util.py, line 127, in
careful_getattr
AttributeError: (see above)
Any ideas?
------_=_NextPart_001_01C09851.A21AFA20
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2650.12">
<TITLE>Adding instances - How sending meta_type by argument ?</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=3D2 FACE=3D"Arial">Sorry for the long post...</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I'm trying to create a general insert =
method that will be inherited by all my sub-objects. I would like =
to send a parameter, "type", that will determine what type of =
object to create.</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial">I tried this:</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"><dtml-with =
"manage_addProduct['normalisation']"></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> <dtml-with =
"_[type].createInObjectManager(REQUEST['NewId'], =
REQUEST)"></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> =
<dtml-call reindex_object></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> =
</dtml-with></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"></dtml-with></FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">And I pass the meta-type as parameter =
"type". I receive the following error:</FONT>
</P>
<P><B><FONT FACE=3D"Times New Roman">Error Type: =
AttributeError</FONT></B><BR>
<B><FONT FACE=3D"Times New Roman">Error Value: =
createInObjectManager</FONT></B>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">Traceback (innermost =
last):</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 222, in =
publish_module</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 187, in =
publish</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\Zope\__init__.py, line 221, in =
zpublisher_exception_hook</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
CatalogAware)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 171, in =
publish</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\ZPublisher\mapply.py, line 160, in mapply</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
insert)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\ZPublisher\Publish.py, line 112, in =
call_object</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
insert)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\OFS\DTMLMethod.py, line 189, in __call__</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
insert)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\DocumentTemplate\DT_String.py, line 538, in =
__call__</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
insert)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\DocumentTemplate\DT_With.py, line 146, in =
render</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
manage_addProduct['normalisation_externe'])</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\DocumentTemplate\DT_With.py, line 133, in =
render</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
_[type].propertysheets.createInObjectManager(REQUEST['NewId'], =
REQUEST))</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\DocumentTemplate\DT_Util.py, line 334, in =
eval</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Object: =
_[type].propertysheets.createInObjectManager(REQUEST['NewId'], =
REQUEST))</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> (Info: =
type)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File <string>, =
line 0, in ?</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New"> File =
D:\INTRAN~1\lib\python\DocumentTemplate\DT_Util.py, line 127, in =
careful_getattr</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Courier New">AttributeError: (see =
above)</FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">Any ideas?</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C09851.A21AFA20--