I have a method called getModulesForProduct to which I pass a ProductID eg: <dtml-in "Products.Modules.getModulesForProduct(this(), _, ProductID)" sort=name> If ProductID is passed on from a form variable it works fine. If I set the ProductID through REQUEST.set: <dtml-call "REQUEST.set('ProductID',_.str(Product.id))"> , I get a TypeError: Error Type: TypeError Error Value: hasattr, argument 2: expected string, int found I've been banging my head against this problem the whole day so help would really be appreciated. Roché
Hi Roch, The whole traceback would be helpful.. one clue: Error Type: TypeError Error Value: hasattr, argument 2: expected string, int found 'hasattr' is the function that is complaining.... do you use it in your code? -steve
"Roch'e" == Roch'e Compaan <roche@ybm.co.za> writes:
Roch'e> I have a method called getModulesForProduct to which I Roch'e> pass a ProductID eg: <dtml-in Roch'e> "Products.Modules.getModulesForProduct(this(), _, Roch'e> ProductID)" sort=name> Roch'e> If ProductID is passed on from a form variable it works Roch'e> fine. Roch'e> If I set the ProductID through REQUEST.set: <dtml-call Roch'e> "REQUEST.set('ProductID',_.str(Product.id))"> , Roch'e> I get a TypeError: Roch'e> Error Type: TypeError Error Value: hasattr, argument 2: Roch'e> expected string, int found Roch'e> I've been banging my head against this problem the whole Roch'e> day so help would really be appreciated. Roch'e> Roché Roch'e> _______________________________________________ Zope-Dev Roch'e> maillist - Zope-Dev@zope.org Roch'e> http://lists.zope.org/mailman/listinfo/zope-dev ** No Roch'e> cross posts or HTML encoding! ** (Related lists - Roch'e> http://lists.zope.org/mailman/listinfo/zope-announce Roch'e> http://lists.zope.org/mailman/listinfo/zope )
Here's the whole traceback (i don't use hasattr in my code): Traceback (innermost last): File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 222, in publish_module File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 187, in publish File /usr/local/zope/2-2-2/lib/python/Zope/__init__.py, line 221, in zpublisher_exception_hook (Object: 10) File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 171, in publish File /usr/local/zope/2-2-2/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/ZPublisher/Publish.py, line 112, in call_object (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/OFS/DTMLMethod.py, line 172, in __call__ (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_String.py, line 528, in __call__ (Object: editLicenseForm) File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_Let.py, line 147, in render (Object: modList="Products.Modules.getModulesForProduct(this(), _, ProductID)") File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_In.py, line 691, in renderwob (Object: modList) File /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_In.py, line 672, in renderwob (Object: Modules) File /usr/local/zope/2-2-2/lib/python/OFS/ObjectManager.py, line 601, in __getitem__ (Object: ProviderContainer) File /usr/local/zope/2-2-2/lib/python/OFS/ObjectManager.py, line 241, in _getOb (Object: ProviderContainer) TypeError: (see above)
Hi Roch,
The whole traceback would be helpful.. one clue:
Error Type: TypeError Error Value: hasattr, argument 2: expected string, int found
'hasattr' is the function that is complaining.... do you use it in your code?
-steve
"Roch'e" == Roch'e Compaan <roche@ybm.co.za> writes:
Roch'e> I have a method called getModulesForProduct to which I Roch'e> pass a ProductID eg: <dtml-in Roch'e> "Products.Modules.getModulesForProduct(this(), _, Roch'e> ProductID)" sort=name>
Roch'e> If ProductID is passed on from a form variable it works Roch'e> fine.
Roch'e> If I set the ProductID through REQUEST.set: <dtml-call Roch'e> "REQUEST.set('ProductID',_.str(Product.id))"> ,
Roch'e> I get a TypeError:
Roch'e> Error Type: TypeError Error Value: hasattr, argument 2: Roch'e> expected string, int found
Roch'e> I've been banging my head against this problem the whole Roch'e> day so help would really be appreciated.
Roch'e> Roché
Roch'e> _______________________________________________ Zope-Dev Roch'e> maillist - Zope-Dev@zope.org Roch'e> http://lists.zope.org/mailman/listinfo/zope-dev ** No Roch'e> cross posts or HTML encoding! ** (Related lists - Roch'e> http://lists.zope.org/mailman/listinfo/zope-announce Roch'e> http://lists.zope.org/mailman/listinfo/zope )
In Roche, OK.. it's the 'in' tag that's causing the problem. Why not try: <dtml-var "experession that's causing problem with in" html_quote> and see what 'in' is choking on... -steve
"Roch'e" == Roch'e Compaan <roche@ybm.co.za> writes:
... Roch'e> line 147, in render (Object: Roch'e> modList="Products.Modules.getModulesForProduct(this(), _, Roch'e> ProductID)") File Roch'e> /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_In.py, Roch'e> line 691, in renderwob (Object: modList) File Roch'e> /usr/local/zope/2-2-2/lib/python/DocumentTemplate/DT_In.py, Roch'e> line 672, in renderwob (Object: Modules) File Roch'e> /usr/local/zope/2-2-2/lib/python/OFS/ObjectManager.py, Roch'e> line 601, in __getitem__ (Object: ProviderContainer) File Roch'e> /usr/local/zope/2-2-2/lib/python/OFS/ObjectManager.py, Roch'e> line 241, in _getOb (Object: ProviderContainer) TypeError: Roch'e> (see above)
OK.. it's the 'in' tag that's causing the problem. Why not try:
<dtml-var "experession that's causing problem with in" html_quote>
and see what 'in' is choking on...
It's choking on a list of instances. This is what is returned when I "var" the expression: [<Module instance at 8b97660>, <Module instance at 88f04b0>, <Module instance at 8994730>, <Module instance at 8b46a08>]
Hmm... OK ... next question... what are you doing *in* the 'in' tag? Somehow you're trying to access an object contained in an object manager (one of your modules?) and you're using an 'int' rather than a string as an id. Can you post the code? thanks, -steve
"Roch'e" == Roch'e Compaan <roche@ybm.co.za> writes:
>> OK.. it's the 'in' tag that's causing the problem. Why not try: >> >> <dtml-var "experession that's causing problem with in" >> html_quote> >> >> and see what 'in' is choking on... Roch'e> It's choking on a list of instances. This is what is Roch'e> returned when I "var" the expression: Roch'e> [<Module instance at 8b97660>, <Module instance at Roch'e> 88f04b0>, <Module instance at 8994730>, <Module instance Roch'e> at 8b46a08>]
All apologies, I was looking at the wrong "dtml-in". It must be me choking on the workload :) roché
OK.. it's the 'in' tag that's causing the problem. Why not try:
<dtml-var "experession that's causing problem with in" html_quote>
and see what 'in' is choking on...
participants (2)
-
Roch'e Compaan -
Steve Spicklemire