ntt/reverence — pull request #18 by termie (2013-09-13 00:21:53+00:00)
Title: Ody1.1 updates

Well, the first half of this review you aren't going to like, I replace tabs with spaces everywhere (tabs are pretty taboo in python).

But if you want to make the relevant changes on your own you can look at the second two commits and see what changed.

Mostly Odyssey 1.1 added some prefixes and changed the location of a couple things.

There is still an outstanding issue, which I am not sure whether I caused or whether has been existing (because I didn't start using the library until ody1.1) but for whatever reason the cached objects that result from the CachedMethodCalls come out as dicts instead of instances. I'm not sure whether something behind the scenes is supposed to be attempting to turn those into instances or not. Here's most of my test code:

cachedObjects = cache.LoadCacheFolder("BulkData")
cachedObjects2 = cache.LoadCacheFolder(_join(cache.machocachepath, 'CachedObjects'))
cachedObjects3 = cache.LoadCacheFolder(_join(cache.machocachepath, 'CachedMethodCalls'))
#cachedObjects3 = []

# bulkdata updates may exist in cache folder. do version check and
# update when necessary.
while cachedObjects2:
objID, obj = cachedObjects2.popitem()
if objID in cachedObjects:
if obj.version < cachedObjects[objID].version:
continue # skip, the object is an older version
cachedObjects[objID] = obj

while cachedObjects3:
objID, obj = cachedObjects3.popitem()
if objID in cachedObjects:
#print cachedObjects[objID]
if obj['version'] < cachedObjects[objID].version:
continue # skip, the object is an older version
cachedObjects[objID] = obj

cachedObjects.update()
import pprint
pprint.pprint(cachedObjects.keys())

print len(cachedObjects.keys())
for obj in cachedObjects.itervalues():
if hasattr(obj, 'GetObject'):
obj.GetObject()
# CachedMethodCall
elif 'rret' in obj:
#print obj
obj['rret'].GetResult()