Add default repr() behavior to data model classes.
				
					
				
			This commit is contained in:
		
							parent
							
								
									75752383b3
								
							
						
					
					
						commit
						ef08cc7303
					
				
					 12 changed files with 13 additions and 101 deletions
				
			
		| 
						 | 
					@ -67,9 +67,6 @@ class Batch(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sil_type_pattern = re.compile(r'^(CHAR|NUMBER)\((\d+(?:\,\d+)?)\)$')
 | 
					    sil_type_pattern = re.compile(r'^(CHAR|NUMBER)\((\d+(?:\,\d+)?)\)$')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Batch(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.description or '')
 | 
					        return unicode(self.description or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -229,9 +226,6 @@ class BatchColumn(Base):
 | 
				
			||||||
            kwargs.setdefault('display_name', sil_column.display_name)
 | 
					            kwargs.setdefault('display_name', sil_column.display_name)
 | 
				
			||||||
        super(BatchColumn, self).__init__(**kwargs)
 | 
					        super(BatchColumn, self).__init__(**kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "BatchColumn(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.display_name or '')
 | 
					        return unicode(self.display_name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,10 +47,6 @@ class PhoneNumber(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    __mapper_args__ = {'polymorphic_on': parent_type}
 | 
					    __mapper_args__ = {'polymorphic_on': parent_type}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "{0}(uuid={1})".format(
 | 
					 | 
				
			||||||
            self.__class__.__name__, repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.number)
 | 
					        return unicode(self.number)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -71,9 +67,5 @@ class EmailAddress(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    __mapper_args__ = {'polymorphic_on': parent_type}
 | 
					    __mapper_args__ = {'polymorphic_on': parent_type}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "{0}(uuid={1})".format(
 | 
					 | 
				
			||||||
            self.__class__.__name__, repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.address)
 | 
					        return unicode(self.address)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,6 +27,7 @@ Data Models
 | 
				
			||||||
from __future__ import unicode_literals
 | 
					from __future__ import unicode_literals
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sqlalchemy as sa
 | 
					import sqlalchemy as sa
 | 
				
			||||||
 | 
					from sqlalchemy import orm
 | 
				
			||||||
from sqlalchemy.ext.declarative import declarative_base
 | 
					from sqlalchemy.ext.declarative import declarative_base
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from rattail.core import Object
 | 
					from rattail.core import Object
 | 
				
			||||||
| 
						 | 
					@ -38,7 +39,18 @@ from rattail.db.core import uuid_column, getset_factory
 | 
				
			||||||
from rattail.db.types import GPCType
 | 
					from rattail.db.types import GPCType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Base = declarative_base(cls=Object)
 | 
					class ModelBase(Object):
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					    Base class for all data models.
 | 
				
			||||||
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def __repr__(self):
 | 
				
			||||||
 | 
					        mapper = orm.object_mapper(self)
 | 
				
			||||||
 | 
					        keys = ['{0}={1}'.format(k.key, repr(getattr(self, k.key))) for k in mapper.primary_key]
 | 
				
			||||||
 | 
					        return "{0}({1})".format(self.__class__.__name__, ', '.join(keys))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Base = declarative_base(cls=ModelBase)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Setting(Base):
 | 
					class Setting(Base):
 | 
				
			||||||
| 
						 | 
					@ -51,9 +63,6 @@ class Setting(Base):
 | 
				
			||||||
    name = sa.Column(sa.String(length=255), primary_key=True)
 | 
					    name = sa.Column(sa.String(length=255), primary_key=True)
 | 
				
			||||||
    value = sa.Column(sa.Text())
 | 
					    value = sa.Column(sa.Text())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Setting(name={0})".format(repr(self.name))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,7 +78,3 @@ class Change(Base):
 | 
				
			||||||
    class_name = sa.Column(sa.String(length=25), primary_key=True)
 | 
					    class_name = sa.Column(sa.String(length=25), primary_key=True)
 | 
				
			||||||
    uuid = sa.Column(sa.String(length=32), primary_key=True)
 | 
					    uuid = sa.Column(sa.String(length=32), primary_key=True)
 | 
				
			||||||
    deleted = sa.Column(sa.Boolean())
 | 
					    deleted = sa.Column(sa.Boolean())
 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Change(class_name={0}, uuid={1})".format(
 | 
					 | 
				
			||||||
            repr(self.class_name), repr(self.uuid))
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,9 +50,6 @@ class Customer(Base):
 | 
				
			||||||
    name = sa.Column(sa.String(length=255))
 | 
					    name = sa.Column(sa.String(length=255))
 | 
				
			||||||
    email_preference = sa.Column(sa.Integer())
 | 
					    email_preference = sa.Column(sa.Integer())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Customer(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or self.person)
 | 
					        return unicode(self.name or self.person)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -130,9 +127,6 @@ class CustomerGroup(Base):
 | 
				
			||||||
    id = sa.Column(sa.String(length=20))
 | 
					    id = sa.Column(sa.String(length=20))
 | 
				
			||||||
    name = sa.Column(sa.String(length=255))
 | 
					    name = sa.Column(sa.String(length=255))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "CustomerGroup(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,9 +148,6 @@ class CustomerGroupAssignment(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    group = relationship(CustomerGroup)
 | 
					    group = relationship(CustomerGroup)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "CustomerGroupAssignment(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Customer._groups = relationship(
 | 
					Customer._groups = relationship(
 | 
				
			||||||
    CustomerGroupAssignment, backref='customer',
 | 
					    CustomerGroupAssignment, backref='customer',
 | 
				
			||||||
| 
						 | 
					@ -187,9 +178,6 @@ class CustomerPerson(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    person = relationship(Person, back_populates='_customers')
 | 
					    person = relationship(Person, back_populates='_customers')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "CustomerPerson(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Customer._people = relationship(
 | 
					Customer._people = relationship(
 | 
				
			||||||
    CustomerPerson, backref='customer',
 | 
					    CustomerPerson, backref='customer',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,9 +64,6 @@ class Employee(Base):
 | 
				
			||||||
                                  creator=lambda n: Person(last_name=n))
 | 
					                                  creator=lambda n: Person(last_name=n))
 | 
				
			||||||
    user = association_proxy('person', 'user')
 | 
					    user = association_proxy('person', 'user')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Employee(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.display_name or self.person)
 | 
					        return unicode(self.display_name or self.person)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,9 +52,6 @@ class LabelProfile(Base):
 | 
				
			||||||
    _printer = None
 | 
					    _printer = None
 | 
				
			||||||
    _formatter = None
 | 
					    _formatter = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "LabelProfile(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.description or '')
 | 
					        return unicode(self.description or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -43,9 +43,6 @@ class Department(Base):
 | 
				
			||||||
    number = sa.Column(sa.Integer())
 | 
					    number = sa.Column(sa.Integer())
 | 
				
			||||||
    name = sa.Column(sa.String(length=30))
 | 
					    name = sa.Column(sa.String(length=30))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Department(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -65,9 +62,6 @@ class Subdepartment(Base):
 | 
				
			||||||
    name = sa.Column(sa.String(length=30))
 | 
					    name = sa.Column(sa.String(length=30))
 | 
				
			||||||
    department_uuid = sa.Column(sa.String(length=32))
 | 
					    department_uuid = sa.Column(sa.String(length=32))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Subdepartment(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return self.name or ''
 | 
					        return self.name or ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,9 +89,6 @@ class Category(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    department = relationship(Department)
 | 
					    department = relationship(Department)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Category(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return self.name or ''
 | 
					        return self.name or ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,9 +109,6 @@ class Family(Base):
 | 
				
			||||||
Collection of :class:`Product` instances which associate with this family.
 | 
					Collection of :class:`Product` instances which associate with this family.
 | 
				
			||||||
""")
 | 
					""")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Family(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -144,9 +132,6 @@ class ReportCode(Base):
 | 
				
			||||||
Collection of :class:`Product` instances which associate with this report code.
 | 
					Collection of :class:`Product` instances which associate with this report code.
 | 
				
			||||||
""")
 | 
					""")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return u"ReportCode(uuid={0})".format(repr(self.uuid)).encode(u'utf_8')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return u"{0} - {1}".format(self.code, self.name or u'')
 | 
					        return u"{0} - {1}".format(self.code, self.name or u'')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -166,8 +151,5 @@ class DepositLink(Base):
 | 
				
			||||||
    description = sa.Column(sa.String(length=255), nullable=True)
 | 
					    description = sa.Column(sa.String(length=255), nullable=True)
 | 
				
			||||||
    amount = sa.Column(sa.Numeric(precision=5, scale=2), nullable=False)
 | 
					    amount = sa.Column(sa.Numeric(precision=5, scale=2), nullable=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "DepositLink(uuid={0})".format(repr(self.uuid)).encode('utf_8')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return "{0} (${1:0.2f})".format(self.description, self.amount)
 | 
					        return "{0} (${1:0.2f})".format(self.description, self.amount)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,9 +64,6 @@ class Person(Base):
 | 
				
			||||||
    last_name = sa.Column(sa.String(length=50))
 | 
					    last_name = sa.Column(sa.String(length=50))
 | 
				
			||||||
    display_name = sa.Column(sa.String(length=100), default=get_person_display_name)
 | 
					    display_name = sa.Column(sa.String(length=100), default=get_person_display_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Person(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.display_name or '')
 | 
					        return unicode(self.display_name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,9 +47,6 @@ class Brand(Base):
 | 
				
			||||||
    uuid = uuid_column()
 | 
					    uuid = uuid_column()
 | 
				
			||||||
    name = sa.Column(sa.String(length=100))
 | 
					    name = sa.Column(sa.String(length=100))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Brand(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,9 +66,6 @@ class Tax(Base):
 | 
				
			||||||
    description = sa.Column(sa.String(length=255), nullable=True)
 | 
					    description = sa.Column(sa.String(length=255), nullable=True)
 | 
				
			||||||
    rate = sa.Column(sa.Numeric(precision=7, scale=5), nullable=False)
 | 
					    rate = sa.Column(sa.Numeric(precision=7, scale=5), nullable=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Tax(uuid={0})".format(repr(self.uuid)).encode('utf_8')
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return "{0} ({1:0.2f} %)".format(self.description, self.rate)
 | 
					        return "{0} ({1:0.2f} %)".format(self.description, self.rate)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -196,9 +190,6 @@ Reference to the :class:`ReportCode` instance with which the product
 | 
				
			||||||
associates, if any.
 | 
					associates, if any.
 | 
				
			||||||
""")
 | 
					""")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Product(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return self.full_description
 | 
					        return self.full_description
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -250,9 +241,6 @@ class ProductCode(Base):
 | 
				
			||||||
    ordinal = sa.Column(sa.Integer(), nullable=False)
 | 
					    ordinal = sa.Column(sa.Integer(), nullable=False)
 | 
				
			||||||
    code = sa.Column(sa.String(length=20))
 | 
					    code = sa.Column(sa.String(length=20))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "ProductCode(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Product._codes = relationship(
 | 
					Product._codes = relationship(
 | 
				
			||||||
    ProductCode, backref='product',
 | 
					    ProductCode, backref='product',
 | 
				
			||||||
| 
						 | 
					@ -305,9 +293,6 @@ class ProductCost(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    vendor = relationship(Vendor)
 | 
					    vendor = relationship(Vendor)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "ProductCost(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Product.costs = relationship(
 | 
					Product.costs = relationship(
 | 
				
			||||||
    ProductCost, backref='product',
 | 
					    ProductCost, backref='product',
 | 
				
			||||||
| 
						 | 
					@ -357,9 +342,6 @@ class ProductPrice(Base):
 | 
				
			||||||
    pack_price = sa.Column(sa.Numeric(precision=8, scale=3))
 | 
					    pack_price = sa.Column(sa.Numeric(precision=8, scale=3))
 | 
				
			||||||
    pack_multiple = sa.Column(sa.Integer())
 | 
					    pack_multiple = sa.Column(sa.Integer())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "ProductPrice(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Product.prices = relationship(
 | 
					Product.prices = relationship(
 | 
				
			||||||
    ProductPrice, backref='product',
 | 
					    ProductPrice, backref='product',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,9 +46,6 @@ class Store(Base):
 | 
				
			||||||
    name = sa.Column(sa.String(length=100))
 | 
					    name = sa.Column(sa.String(length=100))
 | 
				
			||||||
    database_key = sa.Column(sa.String(length=30))
 | 
					    database_key = sa.Column(sa.String(length=30))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Store(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,9 +47,6 @@ class Role(Base):
 | 
				
			||||||
    uuid = uuid_column()
 | 
					    uuid = uuid_column()
 | 
				
			||||||
    name = sa.Column(sa.String(length=25), nullable=False)
 | 
					    name = sa.Column(sa.String(length=25), nullable=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Role(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.name or '')
 | 
					        return unicode(self.name or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,10 +63,6 @@ class Permission(Base):
 | 
				
			||||||
    role_uuid = sa.Column(sa.String(length=32), primary_key=True)
 | 
					    role_uuid = sa.Column(sa.String(length=32), primary_key=True)
 | 
				
			||||||
    permission = sa.Column(sa.String(length=50), primary_key=True)
 | 
					    permission = sa.Column(sa.String(length=50), primary_key=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Permission(role_uuid={0}, permission={1})".format(
 | 
					 | 
				
			||||||
            repr(self.role_uuid), repr(self.permission))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.permission or '')
 | 
					        return unicode(self.permission or '')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,9 +102,6 @@ class User(Base):
 | 
				
			||||||
    Whether the user is active, e.g. allowed to log in via the UI.
 | 
					    Whether the user is active, e.g. allowed to log in via the UI.
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "User(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        s = unicode(self.username)
 | 
					        s = unicode(self.username)
 | 
				
			||||||
        if self.person and self.person.display_name:
 | 
					        if self.person and self.person.display_name:
 | 
				
			||||||
| 
						 | 
					@ -181,9 +171,6 @@ class UserRole(Base):
 | 
				
			||||||
    user_uuid = sa.Column(sa.String(length=32), nullable=False)
 | 
					    user_uuid = sa.Column(sa.String(length=32), nullable=False)
 | 
				
			||||||
    role_uuid = sa.Column(sa.String(length=32), nullable=False)
 | 
					    role_uuid = sa.Column(sa.String(length=32), nullable=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "UserRole(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Role._users = relationship(
 | 
					Role._users = relationship(
 | 
				
			||||||
    UserRole, backref='role',
 | 
					    UserRole, backref='role',
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -61,9 +61,6 @@ The number of days expected to elapse between repeated order placement.  (This
 | 
				
			||||||
description is borrowed from the SIL standard.)
 | 
					description is borrowed from the SIL standard.)
 | 
				
			||||||
""")
 | 
					""")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "Vendor(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return self.name or ''
 | 
					        return self.name or ''
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -147,9 +144,6 @@ class VendorContact(Base):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    person = relationship(Person)
 | 
					    person = relationship(Person)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __repr__(self):
 | 
					 | 
				
			||||||
        return "VendorContact(uuid={0})".format(repr(self.uuid))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    def __unicode__(self):
 | 
					    def __unicode__(self):
 | 
				
			||||||
        return unicode(self.person)
 | 
					        return unicode(self.person)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue