forked from snarfed/bridgy-fed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.py
More file actions
52 lines (37 loc) 路 1.08 KB
/
Copy pathui.py
File metadata and controls
52 lines (37 loc) 路 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"""Stub UI Protocol class, for objects created in the UI.
Needed for serving /convert/ui/web/... requests.
"""
from oauth_dropins.webutil import util
from google.cloud import ndb
import models
import protocol
class UIProtocol(models.User, protocol.Protocol):
LABEL = 'ui'
SUPPORTED_AS1_TYPES = ('comment', 'block', 'like', 'note', 'post', 'share')
def _pre_put_hook(self):
raise NotImplementedError()
@classmethod
def owns_id(self, id):
if id.startswith('ui:'):
return True
elif util.is_web(id) and not self.is_blocklisted(id, allow_internal=True):
return None
return False
@ndb.ComputedProperty
def handle(self):
return None
@classmethod
def handle_to_id(cls, handle):
return None
@classmethod
def create_for(cls, user):
raise ValueError()
@classmethod
def send(to_cls, *args, **kwargs):
return False
@classmethod
def fetch(cls, obj, **kwargs):
return False
@classmethod
def target_for(cls, obj, **kwargs):
return None