示例#1
0
 def to_ref(self):
     from datawire.store import frame_url
     return {
         'urn': self.urn,
         'api_uri': url_for('frames.get', urn=self.urn, _external=True),
         'store_uri': frame_url(self.urn),
         'action_at': self.action_at,
         'submitted_at': self.submitted_at
     }
示例#2
0
def get(urn):
    # TODO: authz checks.
    data = load_frame(urn)
    if data is None:
        raise NotFound('Frame: %s' % urn)
    headers = {
        'X-Backend-Location': frame_url(urn),
        'ETag': data['hash'],
        'Cache-Control': 'public; max-age: 8460000'
    }
    return jsonify(data, headers=headers)