[Zope-dev] Method calls
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é ___ 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] Method calls
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 [EMAIL PROTECTED] 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 - [EMAIL PROTECTED] 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 ) ___ 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] Method calls
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] ___ 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] Method calls
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 [EMAIL PROTECTED] 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] ___ 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 )