Load a document in ExternalMethod
Hi, forgive my probably dumm question. I have some ZCatalog search results. I pass the 'data_record_id_' to an ExternalMethod in which I need to load the documtent referenced by the 'data_record_id_' in order to parse it. I tried a few versions of gettitem and getattr, but I've not been successfull. Any merciful help? ;-P Thanks Fabio
Fabio Rolando wrote:
I have some ZCatalog search results. I pass the 'data_record_id_' to an ExternalMethod in which I need to load the documtent referenced by the 'data_record_id_' in order to parse it. I tried a few versions of gettitem and getattr, but I've not been successfull. Any merciful help? ;-P
Hi, Something like self.Catalog.getobject(data_record_id_) in your External Method should give you the object. Cheers, Maik
Fabio Rolando wrote:
Hi, forgive my probably dumm question.
I have some ZCatalog search results. I pass the 'data_record_id_' to an ExternalMethod in which I need to load the documtent referenced by the 'data_record_id_' in order to parse it.
What's stopping oyu from just passing the brain to the external method? If you did that, you could just do: obj = brain.getObject() cheers, Chris PS: Of course, why you need to use an External Method here would probably also be interesting to discuss ;-)
I realize that I should have preponed "Newbie" in my question (;-P), because I dont even know what the "brain" is (...in this context I mean...) However, I managed to get the object with object = self.Catalog.getobject(data_record_id_) Discussing about the opportunity of using ExternalMethod would be quite interesting for me too, but I thought not to bother the list too much, yes, if you're so kind to give me your opinion I'd be really thankfull. The reason why I want to use External Method is that I need to read back the object found by the catalog, parse it and extract some quote of the text to make some sort of Google-like response. For this I was thinking to use the RegularExpression module that cannot be used in "internal" python script... then, I also thought it could have been good to get some experience with external methods. Cheers, Fabio At 10:49 07-05-03 Wednesday, you wrote:
Fabio Rolando wrote:
Hi, forgive my probably dumm question. I have some ZCatalog search results. I pass the 'data_record_id_' to an ExternalMethod in which I need to load the documtent referenced by the 'data_record_id_' in order to parse it.
What's stopping oyu from just passing the brain to the external method?
If you did that, you could just do:
obj = brain.getObject()
cheers,
Chris
PS: Of course, why you need to use an External Method here would probably also be interesting to discuss ;-)
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Fabio Rolando wrote:
I realize that I should have preponed "Newbie" in my question (;-P), because I dont even know what the "brain" is (...in this context I mean...)
However, I managed to get the object with object = self.Catalog.getobject(data_record_id_)
Show me more of your code... Where are you getting data_record_id_?
The reason why I want to use External Method is that I need to read back the object found by the catalog, parse it and extract some quote of the text to make some sort of Google-like response.
Why do you need to use an External Method rather than a python script?
For this I was thinking to use the RegularExpression module that cannot be used in "internal" python script...
It can, you just need to make the appropriate security declarations... cheers, Chris
participants (3)
-
Chris Withers -
Fabio Rolando -
Maik Jablonski