Subversion Repositories SmartDukaan

Rev

Rev 4754 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4692 mandeep.dh 1
'''
2
Created on 05-Jul-2011
3
 
4
@author: ashish
5
'''
6
 
7
from elixir.entity import Entity
8
from elixir.fields import Field
9
from sqlalchemy.types import String, Integer, Boolean
10
from elixir.options import using_options, using_table_options
11
 
12
from shop2020.thriftpy.utils.ttypes import Agent as TAgent
13
 
14
class Agent(Entity):
15
    id = Field(Integer, primary_key=True)
16
    name = Field(String(128))
17
    password =  Field(String(128))
18
    emailId = Field(String(32))
19
    managerId = Field(Integer)
20
    isActive = Field(Boolean)
21
    using_options(shortnames=True)
22
    using_table_options(mysql_engine="InnoDB")
23
 
24
    def to_thrift_object(self):
25
        '''
26
        Returns the thrift object corresponding to this agent object.
27
        '''
28
        t_agent_user = TAgent()
29
        t_agent_user.id = self.id
30
        t_agent_user.name = self.name
31
        t_agent_user.password = self.password
32
        t_agent_user.emailId = self.emailId
33
        t_agent_user.managerId = self.managerId
34
        t_agent_user.isActive = self.isActive
35
        return t_agent_user