Exemplo n.º 1
0
def serialize_upload(upload):
    return {
        "uuid": str(upload.uuid),
        "listen_url": upload.listen_url,
        "size": upload.size,
        "duration": upload.duration,
        "bitrate": upload.bitrate,
        "mimetype": upload.mimetype,
        "extension": upload.extension,
        "is_local": federation_utils.is_local(upload.fid),
    }
Exemplo n.º 2
0
 def perform_create(self, serializer):
     submitter = None
     if self.request.user.is_authenticated:
         submitter = self.request.user.actor
     report = serializer.save(submitter=submitter)
     forward = self.request.data.get("forward", False)
     if (forward and report.target and report.target_owner
             and hasattr(report.target, "fid")
             and not federation_utils.is_local(report.target.fid)):
         routes.outbox.dispatch({"type": "Flag"},
                                context={"report": report})
Exemplo n.º 3
0
 def is_local(self):
     return federation_utils.is_local(self.fid)