12 |
|
|
13 |
#----------------------------------------------------------------------------- |
#----------------------------------------------------------------------------- |
14 |
# $Log$ |
# $Log$ |
15 |
|
# Revision 1.9 2004/09/01 21:43:30 xabbu |
16 |
|
# +Moved funtion getDefaultDir from FraggleCtlPreferences to FraggleEngine for more convenience |
17 |
|
# +FraggleCtlModules class creation for handling content modules |
18 |
|
# |
19 |
# Revision 1.8 2004/08/31 16:48:19 joko |
# Revision 1.8 2004/08/31 16:48:19 joko |
20 |
# + def authenticate |
# + def authenticate |
21 |
# |
# |
41 |
from fraggleConstants import * |
from fraggleConstants import * |
42 |
import FraggleXMLRPC |
import FraggleXMLRPC |
43 |
import fraggleCtlPreferences |
import fraggleCtlPreferences |
44 |
|
import FraggleCtlModules |
45 |
|
|
46 |
class FraggleEngine: |
class FraggleEngine: |
47 |
"""Back-end doing the work.""" |
"""Back-end doing the work.""" |
48 |
def __init__(self): |
def __init__(self): |
49 |
self.settings = {} |
self.settings = {} |
50 |
self.topics = {} |
self.topics = {} |
51 |
|
self.modules = FraggleCtlModules.create(self) |
52 |
self.preferences = fraggleCtlPreferences.create(self) |
self.preferences = fraggleCtlPreferences.create(self) |
53 |
self.rpc = FraggleXMLRPC.create(self, self.preferences.getConfig()) |
self.rpc = FraggleXMLRPC.create(self, self.preferences.getConfig()) |
54 |
|
|
176 |
except Error, v: |
except Error, v: |
177 |
print "ERROR", v |
print "ERROR", v |
178 |
|
|
179 |
|
def getDefaultDir(self): |
180 |
|
"""Gets location of default dir and creates it |
181 |
|
if necessary. ($HOME/.pears/)""" |
182 |
|
try: |
183 |
|
import pearsdebug |
184 |
|
savedir = pearsdebug.savedir |
185 |
|
except: |
186 |
|
dir = '.netfraggle' |
187 |
|
savedir = os.path.expanduser(os.path.join('~', dir)) |
188 |
|
if len(savedir)<=len("c:\\/" + dir): |
189 |
|
# problem that might occur on Win2k (no $HOME environment variable) |
190 |
|
temp = os.path.join(os.path.expandvars('$USERPROFILE'), dir) |
191 |
|
if temp > len("c:\\/" + dir): |
192 |
|
savedir = temp |
193 |
|
# create dir if it doesn't exist |
194 |
|
if not os.path.exists(savedir): |
195 |
|
os.makedirs(savedir) |
196 |
|
return savedir |
197 |
|
|
198 |
class urlOpener(object): |
class urlOpener(object): |
199 |
"""Opens urls.""" |
"""Opens urls.""" |
200 |
def __init__(self): |
def __init__(self): |