2007-07-02 11:14:47 +02:00
|
|
|
# -*- coding: UTF-8 -*-
|
|
|
|
#
|
|
|
|
# Copyright (C) 2007 by Jan Dittberner.
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful, but
|
|
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
# General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
# USA.
|
|
|
|
#
|
|
|
|
# Version: $Id$
|
|
|
|
|
|
|
|
from sqlalchemy import *
|
|
|
|
from tables import client_table
|
|
|
|
from gnuviechadmin.exceptions import *
|
|
|
|
|
2007-07-03 11:13:20 +02:00
|
|
|
import sysuser
|
2007-07-02 11:14:47 +02:00
|
|
|
from BackendEntity import *
|
|
|
|
from BackendEntityHandler import *
|
|
|
|
|
|
|
|
class Client(BackendEntity):
|
|
|
|
"""Entity class for clients."""
|
|
|
|
|
|
|
|
_shortkeys = ('clientid', 'firstname', 'lastname', 'email')
|
|
|
|
|
|
|
|
def __init__(self, verbose = False, **kwargs):
|
|
|
|
BackendEntity.__init__(self, verbose)
|
|
|
|
self.clientid = None
|
|
|
|
self.country = 'de'
|
|
|
|
self.title = None
|
|
|
|
self.address2 = None
|
|
|
|
self.mobile = None
|
|
|
|
self.fax = None
|
|
|
|
for item in kwargs.items():
|
|
|
|
self.__setattr__(item)
|
|
|
|
self.validate()
|
|
|
|
|
|
|
|
def create_hook(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def delete_hook(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
client_mapper = mapper(Client, client_table)
|
|
|
|
client_mapper.add_property("sysusers", relation(sysuser.Sysuser))
|
|
|
|
|
|
|
|
class ClientHandler(BackendEntityHandler):
|
|
|
|
"""BackendEntityHandler for Client entities."""
|
|
|
|
|
|
|
|
def __init__(self, verbose = False):
|
|
|
|
BackendEntityHandler.__init__(self, Client, verbose)
|