minor cleanup
This commit is contained in:
parent
f4a7441e86
commit
04d4bbe556
15
kosokoso.py
15
kosokoso.py
|
|
@ -1,12 +1,11 @@
|
||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.ext.declarative import declarative_base, declared_attr
|
from sqlalchemy.ext.declarative import declared_attr
|
||||||
from sqlalchemy.ext.associationproxy import association_proxy
|
from sqlalchemy.ext.associationproxy import association_proxy
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
import pprint
|
import pprint
|
||||||
import sys
|
import sys
|
||||||
# import traceback
|
|
||||||
|
|
||||||
# this will get overridden by init_base
|
# this will get overridden by init_base
|
||||||
Base = None
|
Base = None
|
||||||
|
|
@ -106,17 +105,6 @@ class TagBase(object):
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.text == other.text
|
return self.text == other.text
|
||||||
|
|
||||||
def _get_class_by_tablename(self, tablename):
|
|
||||||
"""Return class reference mapped to table.
|
|
||||||
|
|
||||||
:param tablename: String with name of table.
|
|
||||||
:return: Class reference or None.
|
|
||||||
"""
|
|
||||||
for c in Base._decl_class_registry.values():
|
|
||||||
if (hasattr(c, '__tablename__')
|
|
||||||
and c.__tablename__ == tablename):
|
|
||||||
return c
|
|
||||||
|
|
||||||
|
|
||||||
class TagAssociationBase(object):
|
class TagAssociationBase(object):
|
||||||
__tablename__ = "kk_tag_associations"
|
__tablename__ = "kk_tag_associations"
|
||||||
|
|
@ -202,6 +190,7 @@ class TaggableBase(object):
|
||||||
|
|
||||||
|
|
||||||
def init_base(new_base):
|
def init_base(new_base):
|
||||||
|
"""Set up classes based on new_base."""
|
||||||
def init_cls(name, base):
|
def init_cls(name, base):
|
||||||
current = globals()[name + 'Base']
|
current = globals()[name + 'Base']
|
||||||
new_ns = current.__dict__.copy()
|
new_ns = current.__dict__.copy()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue