Exemple #1
0
 def write(self, path=None):
     if not path:
         fobj = strfile()
     else:
         fobj = file(path, 'w')
     PrettyPrint(self.doc, fobj)
     if not path:
         fobj.seek(0)
         return fobj.read()
 def new_script(self, name):
     if self.script.get(name) is not None:
         dialogs.Message('script exists')
         raise Error, 'script exists'
     tmp = strfile()
     self.script.insert_script(name, tmp)
     self.append_script(name)
     tmp.close()
     self.edit_script(None, name, None)
 def write(self, path=None):
     if not path:
         fobj = strfile()
     else:
         fobj = file(path, 'w')
     PrettyPrint(self.doc, fobj)
     if not path:
         fobj.seek(0)
         return fobj.read()
Exemple #4
0
def parse_configdb(path):
    cf = file(path).read()
    return map(rfc822.Message,
               [strfile(x + '\n') for x in cf.split('\n\n')[:-1]])
def parse_configdb(path):
    cf = file(path).read()
    return map(rfc822.Message, [strfile(x + '\n') for x in cf.split('\n\n')[:-1]])
Exemple #6
0
 def scriptfile(self, name):
     return strfile(self.scriptdata(name))
Exemple #7
0
 def templatefile(self, package, template):
     return strfile(self.templatedata(package, template))
Exemple #8
0
 def get_strfile(self, id):
     return strfile(self.get_data(id))
Exemple #9
0
 def insert_data(self, data):
     md5 = md5sum(strfile(data))
     md5size = '_'.join([md5, str(len(data))])
     return self._insert_data(md5size, data)
Exemple #10
0
 def save_template(self):
     template_path = 'in database'
     package, template = self.package, self.template
     data = strfile(self.workspace.get_text())
     self.traittemplate.save_template(package, template, data)
     dialogs.Message('saved %s in\n%s' % (template, template_path))
Exemple #11
0
 def get_strfile(self, id):
     return strfile(self.get_data(id))
Exemple #12
0
 def insert_data(self, data):
     md5 = md5sum(strfile(data))
     md5size = '_'.join([md5, str(len(data))])
     return self._insert_data(md5size, data)
 def save_template(self):
     template_path = 'in database'
     package, template = self.package, self.template
     data = strfile(self.workspace.get_text())
     self.traittemplate.save_template(package, template, data)
     dialogs.Message('saved %s in\n%s' % (template, template_path))        
Exemple #14
0
 def scriptfile(self, name):
     return strfile(self.scriptdata(name))
Exemple #15
0
 def templatefile(self, package, template):
     return strfile(self.templatedata(package, template))