Getting the object from a path in a python script
Hello, I am trying to get hold of an object in a fs python script. The only thing I have to reference this object is the absolute url for the object. I have tried with restrictedTraverse and self.restrictedTraverse but keeps getting an error. Anyone who knows how to do this ? Regards, Gitte Wange
I am trying to get hold of an object in a fs python script. The only thing I have to reference this object is the absolute url for the object. I have tried with restrictedTraverse and self.restrictedTraverse but keeps getting an error.
What did you try ? What errors did you get ? You should use something like: obj = self.restrictedTraverse('/the/path/to/obj') Note that the path doesn't have the "http://server.com" part. Florent Guillaume Nuxeo
At 20:27 21-08-2001 GMT, you wrote:
I am trying to get hold of an object in a fs python script. The only thing I have to reference this object is the absolute url for the object. I have tried with restrictedTraverse and self.restrictedTraverse but keeps getting an error.
What did you try ? What errors did you get ?
You should use something like:
obj = self.restrictedTraverse('/the/path/to/obj')
Note that the path doesn't have the "http://server.com" part.
Florent Guillaume Nuxeo
Well I had tried with self.restrictedTraverse ... One quick "trip" to IRC world helped me - I simply just needed to make sure that the path was a string :-) Now everything works fine ... :-) Regards, Gitte Wange
participants (4)
-
Chris Withers -
Florent Guillaume -
Gitte Wange -
Gitte Wange