- repository reorganization
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/trunk@242 a67ec6bc-e5d5-0310-a910-815c51eb3124
This commit is contained in:
parent
5c1a97e82d
commit
dea15a6c4f
29 changed files with 1053 additions and 0 deletions
0
testdb/gnuviechadmin/__init__.py
Normal file
0
testdb/gnuviechadmin/__init__.py
Normal file
23
testdb/gnuviechadmin/dblayer.py
Normal file
23
testdb/gnuviechadmin/dblayer.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
from sqlalchemy import *
|
||||
from entities import *
|
||||
|
||||
db = create_engine('postgres://jan:heyyou97@localhost:5432/testdb')
|
||||
|
||||
metadata = BoundMetaData(db)
|
||||
|
||||
domains_table = Table('domains', metadata, autoload = True)
|
||||
sysuser_table = Table('sysuser', metadata, autoload = True)
|
||||
mailpassword_table = Table('mailpassword', metadata, autoload = True)
|
||||
client_table = Table('client', metadata, autoload = True)
|
||||
|
||||
popaccountmapper = mapper(PopAccount, mailpassword_table)
|
||||
|
||||
domainmapper = mapper(Domain, domains_table)
|
||||
domainmapper.add_property('popaccounts', relation(PopAccount))
|
||||
|
||||
sysusermapper = mapper(SysUser, sysuser_table)
|
||||
|
||||
clientmapper = mapper(Client, client_table)
|
||||
clientmapper.add_property('sysusers', relation(SysUser))
|
||||
|
||||
session = create_session()
|
46
testdb/gnuviechadmin/entities.py
Normal file
46
testdb/gnuviechadmin/entities.py
Normal file
|
@ -0,0 +1,46 @@
|
|||
class Client(object):
|
||||
def __repr__(self):
|
||||
return "%s(clientid=%s,firstname=%s,lastname=%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.clientid,
|
||||
self.firstname,
|
||||
self.lastname)
|
||||
|
||||
class PopAccount(object):
|
||||
def __repr__(self):
|
||||
return "%s(%s,%d,%d,%d,%s,%s,%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.id,
|
||||
self.domainid,
|
||||
self.uid,
|
||||
self.gid,
|
||||
self.home,
|
||||
self.cryptpass,
|
||||
self.clearpass)
|
||||
|
||||
class SysUser(object):
|
||||
def __repr__(self):
|
||||
return "%s(%d,%s,%d,%s,%s,%s,%d,%d,%s,%d)" % \
|
||||
(self.__class__.__name__,
|
||||
self.sysuserid,
|
||||
self.name,
|
||||
self.type,
|
||||
self.home,
|
||||
self.shell,
|
||||
self.password,
|
||||
self.clientid,
|
||||
self.toupdate,
|
||||
self.md5pass,
|
||||
self.sysuid)
|
||||
|
||||
class Domain(object):
|
||||
def __repr__(self):
|
||||
return "%s(%d,%s,%s,%s,%s,%s,%s)" % \
|
||||
(self.__class__.__name__,
|
||||
self.id,
|
||||
self.name,
|
||||
self.master,
|
||||
self.last_check,
|
||||
self.type,
|
||||
self.notified_serial,
|
||||
self.account)
|
Loading…
Add table
Add a link
Reference in a new issue