Пример #1
0
 def send(self, r):
     sio = StringIO.StringIO()
     self.xml.write("</notification>\n")
     self.xml.seek(0)
     sio.write(gpg.sign(self.xml.read()))
     self.xml = None
     sio.seek(0)
     notifyq.init(r)
     notifyq.add(sio)
     notifyq.flush()
Пример #2
0
 def send(self, r):
     sio = StringIO.StringIO()
     self.xml.write("</notification>\n")
     self.xml.seek(0)
     sio.write(gpg.sign(self.xml.read()))
     self.xml = None
     sio.seek(0)
     notifyq.init(r)
     notifyq.add(sio)
     notifyq.flush()
Пример #3
0
 def write_signed(self, name):
     sio = StringIO.StringIO()
     self._write_to(sio)
     sio.seek(0)
     sio.write(gpg.sign(sio.read()))
     sio.seek(0)
     (fdno, tmpname) = tempfile.mkstemp(dir=os.path.dirname(name))
     f = os.fdopen(fdno, "w")
     if re.search(r"\.gz$", name):
         fgz = gzip.GzipFile(filename=name, mode="w", compresslevel=6, fileobj=f)
         util.sendfile(sio, fgz)
         fgz.close()
     else:
         util.sendfile(sio, f)
     f.flush()
     os.fsync(f.fileno())
     f.close()
     os.chmod(tmpname, 0644)
     os.rename(tmpname, name)
Пример #4
0
 def write_signed(self, name):
     sio = StringIO.StringIO()
     self._write_to(sio)
     sio.seek(0)
     sio.write(gpg.sign(sio.read()))
     sio.seek(0)
     (fdno, tmpname) = tempfile.mkstemp(dir=os.path.dirname(name))
     f = os.fdopen(fdno, "w")
     if re.search(r"\.gz$", name):
         fgz = gzip.GzipFile(filename=name,
                             mode="w",
                             compresslevel=6,
                             fileobj=f)
         util.sendfile(sio, fgz)
         fgz.close()
     else:
         util.sendfile(sio, f)
     f.flush()
     os.fsync(f.fileno())
     f.close()
     os.chmod(tmpname, 0644)
     os.rename(tmpname, name)