Ticket #307: facorreia-ticket-307.patch
| File facorreia-ticket-307.patch, 1.8 KB (added by facorreia, 20 months ago) |
|---|
-
pyamf/adapters/_google_appengine_ext_db.py
26 26 remove = True 27 27 self.context.class_aliases[obj.__class__] = pyamf.ClassAlias(obj.__class__, None) 28 28 29 self.writeObject(obj, *args, **kwargs)29 writeObjectAMF(self, obj, args, kwargs, remove) 30 30 31 if remove:32 self.context.class_aliases[obj.__class__] = None33 34 31 def writeObjectAMF3(self, obj, *args, **kwargs): 35 32 try: 36 33 self.context.getClassDefinitionReference(obj) … … 44 41 alias = pyamf.ClassAlias(obj.__class__, None) 45 42 self.context.class_aliases[obj.__class__] = alias 46 43 44 writeObjectAMF(self, obj, args, kwargs, remove) 45 46 def writeObjectAMF(self, obj, args, kwargs, remove): 47 """ 48 Writes an object that has already been prepared by writeObjectAMF0 or writeObjectAMF3. 49 """ 50 try: 51 obj._key = str(obj.key()) 52 except: 53 obj._key = None 47 54 self.writeObject(obj, *args, **kwargs) 48 55 del obj._key 49 56 if remove: 50 57 self.context.class_aliases[obj.__class__] = None 51 58 … … 53 60 """ 54 61 Returns a list of properties on an C{db.Model} instance. 55 62 """ 56 return list(obj.__class__._properties) 63 return list(obj.__class__._properties) + ['_key'] 57 64 58 65 def get_attrs_for_expando(obj): 59 66 """ 60 67 Returns a list of dynamic properties on a C{db.Expando} instance. 61 68 """ 62 return obj.dynamic_properties() 69 return obj.dynamic_properties() + ['_key'] 63 70 64 71 pyamf.register_class(db.Model, attr_func=get_attrs_for_model, metadata=['dynamic']) 65 72 pyamf.register_class(db.Expando, attr_func=get_attrs_for_expando, metadata=['dynamic'])
