예제 #1
0
파일: help.py 프로젝트: cccarey/demisauce
# DB Table:  help response ---------------------------
help_response_table = Table("helpresponse", meta.metadata,
        Column("id", Integer, primary_key=True),
        Column("site_id", Integer, ForeignKey('site.id')),
        Column("help_id", Integer, ForeignKey('help.id')),
        Column("person_id", Integer, ForeignKey('person.id')),
        Column("status", Integer, default=1),
        Column("publish", Boolean, default=0),
        Column("created", DateTime,default=datetime.now()),
        Column("url", DBString(255), nullable=True),
        Column("title", DBString(255), nullable=True),
        Column("rating_ct", Integer, default=0),
        Column("response", DBText),
    )

ModelBaseAggregator = aggregator_callable(ModelBase)



class Help(ModelBaseAggregator):
    """
    Help is the Support/Help/Feedback form
    """
    comments = has_many('comment',lazy=True,local_key='id')
    
    def __init__(self, **kwargs):
        ModelBase.__init__(self,**kwargs)
        if 'email' in kwargs:
            self.set_email(kwargs['email'])
        self.all_tags = None
    
예제 #2
0
"""
from demisaucepy.tests import *
from demisaucepy import demisauce_ws, hash_email, \
    demisauce_ws_get
from demisaucepy.models import Comment, Person as DemisaucePerson
from demisaucepy.declarative import Aggregagtor, has_a, \
    has_many, aggregator_callable, AggregateView


class AthletePerson(object):
    def __init__(self, arg):
        super(AthletePerson, self).__init__()
        self.arg = arg
    

AggregatorCallableCustomInheritanceTest = aggregator_callable(AthletePerson)

class Person(Aggregagtor):
    """
    Demo person class, showing direct inheritance implementation
    of Demisauce Aggregate Functions
    """
    personext = has_a('person',lazy=True,local_key='hashed_email')
    comments = has_many('comment',lazy=True,local_key='id')
    
    def __init__(self, displayname, email):
        super(Person, self).__init__()
        self.id = 145
        self.displayname = displayname
        self.email = email
        self.hashed_email = hash_email(email)