Beispiel #1
0
    def add(self, name, data, mime=None):
        if not mime:
            mime = "unspecified"

        name = RE_NON_PRINTABLE.sub("", name)[0:131]
        mime = RE_NON_PRINTABLE.sub("", mime)[0:53]

        digest = transforms.sha1(data)
        d = transforms.dumps(data)
        row = u"%s\t%s\t%s\t%s\t%s\t%s\n" % (datetime.datetime.utcnow().isoformat(), mime, name, digest, len(data), d)
        self.store(row)
Beispiel #2
0
 def new_name(self):
     return "%s/%s.%s.barrel" % (
         self.pathname,
         self.name,
         transforms.sha1(self.hostname + datetime.datetime.utcnow().isoformat()).replace("/", "_").replace("+", "-"),
     )