Пример #1
0
 def insert_new_template(self, package, template, path):
     newfile = readfile(path)
     filename = self.template_filename(package, template)
     makepaths(dirname(filename))
     writefile(filename, newfile)
     try:
         self.traittemplate.insert_template(
             dict(package=package, template=template), file(path))
     except OperationalError:
         dialogs.Message('template already exists')
     self.set_template(package, template)
     self.reset_rows()
Пример #2
0
 def insert_new_template(self, package, template, path):
     newfile = readfile(path)
     filename = self.template_filename(package, template)
     makepaths(dirname(filename))
     writefile(filename, newfile)
     try:
         self.traittemplate.insert_template(dict(package=package, template=template),
                                            file(path))
     except OperationalError:
         dialogs.Message('template already exists')
     self.set_template(package, template)
     self.reset_rows()
Пример #3
0
 def set_template(self, package, template):
     self.package = package
     self.template = template
     path = self.template_filename(package, template)
     print self.trait, 'self.trait'
     clause = Eq('trait', self.trait) & Eq('package', package) & Eq('template', template)
     print 'clause', clause
     template_text = self.traittemplate.templatedata(package, template)
     self.workspace.set_text(template_text)
     self.template_view.set_text(template_text)
     if self.extracted:
         path = join(self.trait_temp_path(), package, template)
         try:
             self.original_view.set_text(readfile(path))
         except NoExistError:
             pass
         except IOError:
             pass
Пример #4
0
 def set_template(self, package, template):
     self.package = package
     self.template = template
     path = self.template_filename(package, template)
     print self.trait, 'self.trait'
     clause = Eq('trait', self.trait) & Eq('package', package) & Eq(
         'template', template)
     print 'clause', clause
     template_text = self.traittemplate.templatedata(package, template)
     self.workspace.set_text(template_text)
     self.template_view.set_text(template_text)
     if self.extracted:
         path = join(self.trait_temp_path(), package, template)
         try:
             self.original_view.set_text(readfile(path))
         except NoExistError:
             pass
         except IOError:
             pass
Пример #5
0
 def set_template(self, package, template):
     self.package = package
     self.template = template
     path = self.template_filename(package, template)
     clause = Eq('trait', self.trait) & Eq('package', package) & Eq('template', template)
     row = self.cmd.cmd.select(fields=['templatefile'], clause=clause)[0]
     filename = row.templatefile.name
     tfile = self.cmd.cmd.openfile(self.conn, filename)
     template_text = tfile.read()
     tfile.close()
     self.workspace.set_text(template_text)
     self.template_view.set_text(template_text)
     if self.extracted:
         path = join(self.trait_temp_path(), package, template)
         try:
             self.original_view.set_text(readfile(path))
         except NoExistError:
             pass
         except IOError:
             pass
Пример #6
0
 def parse(self):
     filename = join(self.source.distpath, 'Release')
     self.fields = email.message_from_string(readfile(filename))
     self.sums = self._parse_md5sums(self.fields['md5sum'])
Пример #7
0
def parse_release(suite, path):
    filename = pjoin(path, DISTS, suite, 'Release')
    release = email.message_from_string(readfile(filename))
    return release, parse_release_md5sums(release['md5sum'])
Пример #8
0
 def parse(self):
     filename = join(self.source.distpath, 'Release')
     self.fields = email.message_from_string(readfile(filename))
     self.sums = self._parse_md5sums(self.fields['md5sum'])
Пример #9
0
 def _fill_from_path(self, path):
     self.__original_text__ = readfile(path)
     self.editor.set_text(copy(self.__original_text__))