Confused about catalog unique ID in ZScheduler
Two questions really: 1. How do I get the uid from the catalog in a python product. Currently I have for event in self._catalog.searchResults( nextEventTime=DateTime(1), nextEventTime_usage='range:min', sort_on='nextEventTime' ): next_url = event.absolute_url next_time = event.nextEventTime #next_uid = event.uid break # just look at the first one return (next_uid, next_time, next_url) ...but that event.uid line isn't correct. 2. I need to add to ZScheduler the ability to delete a catalog entry if the Dispatcher gets an error when it tries to disarm an event. Is uid what I need in ZScheduler to subsequently do this? self.uncatalog_object(uid) My confusion here is knowing that uid is based on relative URL but knowing (vaguely) that relative URL is problematic in vurtual hosting environment (the very reason that ZScheduler catalogs absolute_url and uses it to identify the target ZEvent). Can someone clarify? -- Loren
Loren Stafford wrote:
Two questions really:
1. How do I get the uid from the catalog in a python product. Currently I have
for event in self._catalog.searchResults( nextEventTime=DateTime(1), nextEventTime_usage='range:min', sort_on='nextEventTime' ): next_url = event.absolute_url next_time = event.nextEventTime #next_uid = event.uid break # just look at the first one return (next_uid, next_time, next_url)
...but that event.uid line isn't correct.
Well, brain objects do not have a uid attribute (unless you have an metadata table entry called uid, which you might...). The 'unique id' that the catalog uses can be accessed with a two step process. First, the integer record 'id' of the catalog result can be gotten from 'data_record_id_' (this is a name holdover from ZTables). Using this integer, you can access the 'unique id' that the catalog uses for the object. This is by convention the path to the object. self._catalog.getpath(event.data_record_id_)
2. I need to add to ZScheduler the ability to delete a catalog entry if the Dispatcher gets an error when it tries to disarm an event. Is uid what I need in ZScheduler to subsequently do this?
self.uncatalog_object(uid)
If self is a catalog, yes. -Michel
participants (2)
-
Loren Stafford -
Michel Pelletier