コード例 #1
0
 def store(self, stream):
     """
     Stores a stream as the data content. The uuid will be the name
     of the file.
     """
     if not self.uuid:
         self.uuid = util.uuid()
     stream = to_stream(stream)
     self.content.save(self.uuid, stream)
コード例 #2
0
def create_track(user, pid, name, json={}, text=''):
    """
    Creates a track
    """
    proj = get_project(user=user, pid=pid, write=False)
    uuid = util.uuid()
    track = models.Track( owner=user, project=proj, name=name, json=json, uuid=uuid, text=text)
    track.save()
    user.message_set.create(message="Created track <b>%s</b>" % name)
    return track
コード例 #3
0
 def store(self, content, image=None):
     """
     Stores a stream as the data content. The uuid will be the name
     of the file.
     """
     if not self.uuid:
         self.uuid = util.uuid()
         self.save()
     if content:
         content = to_stream(content)
         self.content.save(self.uuid, content)
     if image:
         image = to_stream(image)
         self.image.save(self.uuid, image)