'scope' field moved from TaskTag to the parent class.
--- a/app/soc/modules/ghop/models/task.py Sun Nov 08 12:11:14 2009 -0800
+++ b/app/soc/modules/ghop/models/task.py Tue Nov 10 13:59:15 2009 +0100
@@ -43,10 +43,7 @@
"""Model for storing all Task tags.
"""
- #: Each task_type tag is scoped under the program.
- scope = db.ReferenceProperty(reference_class=soc.models.linkable.Linkable,
- required=True,
- collection_name='task_type_tags')
+ #: Each task_type tag is scoped under the program.
order = db.IntegerProperty(required=True, default=0)
@@ -147,6 +144,10 @@
def get_or_create(cls, scope, tag_name, order=0):
"""Get the Tag object that has the tag value given by tag_value.
"""
+
+ if not scope:
+ return None
+
tag_key_name = cls.__key_name(scope.key().name(), tag_name)
existing_tag = cls.get_by_key_name(tag_key_name)
if existing_tag is None:
--- a/app/taggable/taggable.py Sun Nov 08 12:11:14 2009 -0800
+++ b/app/taggable/taggable.py Tue Nov 10 13:59:15 2009 +0100
@@ -1,5 +1,7 @@
from google.appengine.ext import db
+
import string
+import soc.models.linkable
class Tag(db.Model):
"Google AppEngine model for store of tags."
@@ -19,6 +21,11 @@
auto_delete = db.BooleanProperty(required=True, default=False)
"If true, a tag instance should be deleted when tagged_count reaches zero."
+ scope = db.ReferenceProperty(reference_class=soc.models.linkable.Linkable,
+ required=False,
+ collection_name='task_type_tags')
+ "Each tag is scoped under some linkable model."
+
@classmethod
def __key_name(cls, tag_name):
return cls.__name__ + '_' + tag_name