remove some commented-out code that i don't think i'll need.

This commit is contained in:
chris t 2018-04-08 00:06:55 -07:00
parent b12815917e
commit 69991f5209
1 changed files with 1 additions and 41 deletions

View File

@ -16,13 +16,6 @@ class Tag(Base):
self.data = [] self.data = []
def append(self, item): def append(self, item):
# print "collection append: %s" % item
# self.data.append(item)
# t = TagAssociation()
# t.target_id = item.db_id
# t.target_table = item.__tablename__
try: try:
cls = self._get_class_by_tablename(item.target_table) cls = self._get_class_by_tablename(item.target_table)
thingy = cls() thingy = cls()
@ -115,14 +108,6 @@ class TagAssociation(Base):
return False return False
return self.db_id == other.db_id return self.db_id == other.db_id
# def __init__(self):
# if self.args and self.args.get("target_table"):
# self.target_table = self.args["target_table"]
# @classmethod
# def creator(cls, target_table):
# return lambda tags: TagAssociation(tags=tags,
# discriminator=target_table)
@property @property
def parent(self): def parent(self):
return getattr(self, "%s_parent" % self.target_table) return getattr(self, "%s_parent" % self.target_table)
@ -134,17 +119,6 @@ class TagAssociation(Base):
class Taggable(Base): class Taggable(Base):
__abstract__ = True __abstract__ = True
# FIXME this doesn't seem to actually be needed.
@staticmethod
def _outer_join_accessor_factory(collection_type, proxy):
def getter(obj):
if obj is None:
return []
return getattr(obj, proxy.value_attr)
def setter(obj, value):
setattr(obj, proxy.value_attr, value)
return getter, setter
@declared_attr @declared_attr
def kk_tag_associations(cls): def kk_tag_associations(cls):
name = cls.__name__ name = cls.__name__
@ -176,10 +150,7 @@ class Taggable(Base):
}, },
) )
) )
cls.tags = association_proxy( cls.tags = association_proxy("kk_tag_associations", "tag")
"kk_tag_associations", "tag",
# getset_factory=cls._outer_join_accessor_factory,
)
return sa.orm.relationship( return sa.orm.relationship(
@ -189,14 +160,3 @@ class Taggable(Base):
"foreign(TagAssociation.target_id)==%s.db_id)" "foreign(TagAssociation.target_id)==%s.db_id)"
%(table, name)), %(table, name)),
) )
# @sa.event.listens_for(Tag.associations, 'append')
# def receive_append(target, value, initiator):
# print "append %s to %s" % (value, target)
# cls = target._get_class_by_tablename(value.target_table)
# thingy = cls()
# thingy.db_id = value.target_id
# target.collection.append(thingy)
# TODO remove, extend, set, modified, init_scalar?, init_collection?