Jan Dittberner
e18a12269f
- default preferencs file - ignore development files git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@81 a67ec6bc-e5d5-0310-a910-815c51eb3124
37 lines
1 KiB
Python
37 lines
1 KiB
Python
"""Package for GNUViech Admin main types and functions
|
|
|
|
(c) Copyright 2004 Jan Dittberner, IT-Consulting & Solutions
|
|
Germany
|
|
"""
|
|
|
|
import os
|
|
|
|
execfile('gvadm.preferences')
|
|
|
|
class GNVDomain:
|
|
"""Represents a domain in the GNUViech admin tool"""
|
|
|
|
def __init__(self, domain):
|
|
"""Initializes the domain object"""
|
|
self.domainname = domain
|
|
self.findUser()
|
|
|
|
def __repr__(self):
|
|
return "Domain "+self.domainname+", User "+self.username
|
|
|
|
def findUser(self):
|
|
"""Finds the user for the domain or creates a new one."""
|
|
if (os.access(GVADMDIR, os.R_OK)):
|
|
try:
|
|
domainsfile = open(GVADMDIR+"domains", "r")
|
|
self.username = "<from file>"
|
|
except IOError:
|
|
print "domain file not accessible"
|
|
self.username = "<unknown>"
|
|
else:
|
|
print "The directory "+GVADMDIR+" is not accessible!"
|
|
self.username = "<unknown>"
|
|
|
|
if __name__ == "__main__":
|
|
dom = GNVDomain("test.de")
|
|
print dom
|