[boto] r1321 committed - Added some more information to reverse reference properties

1 view
Skip to first unread message

codesite...@google.com

unread,
Oct 15, 2009, 5:12:26 PM10/15/09
to boto-...@googlegroups.com
Revision: 1321
Author: kopertop
Date: Thu Oct 15 14:12:10 2009
Log: Added some more information to reverse reference properties

http://code.google.com/p/boto/source/detail?r=1321

Modified:
/trunk/boto/sdb/db/property.py

=======================================
--- /trunk/boto/sdb/db/property.py Mon Oct 12 10:03:57 2009
+++ /trunk/boto/sdb/db/property.py Thu Oct 15 14:12:10 2009
@@ -347,7 +347,7 @@
if hasattr(self.reference_class, self.collection_name):
raise ValueError, 'duplicate property: %s' %
self.collection_name
setattr(self.reference_class, self.collection_name,
- _ReverseReferenceProperty(model_class, property_name))
+ _ReverseReferenceProperty(model_class, property_name,
self.collection_name, self.reference_class))

def check_uuid(self, value):
# This does a bit of hand waving to "type check" the string
@@ -374,10 +374,14 @@
self.check_instance(value)

class _ReverseReferenceProperty(Property):
-
- def __init__(self, model, prop):
+ data_type = Query
+ type_name = 'query'
+
+ def __init__(self, model, prop, name, reference_class):
self.__model = model
self.__property = prop
+ self.name = name
+ self.item_type = reference_class

def __get__(self, model_instance, model_class):
"""Fetches collection of model instances of this collection
property."""

Reply all
Reply to author
Forward
0 new messages