-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
daemon_get_links.py
45 lines (40 loc) · 1.44 KB
/
daemon_get_links.py
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
__filename__ = "daemon_get_links.py"
__author__ = "Bob Mottram"
__license__ = "AGPL3+"
__version__ = "1.6.0"
__maintainer__ = "Bob Mottram"
__email__ = "[email protected]"
__status__ = "Production"
__module_group__ = "Daemon GET"
from webapp_column_left import html_edit_links
from httpheaders import set_headers
from httpcodes import write2
from httpcodes import http_404
def edit_links2(self, calling_domain: str, path: str,
translate: {}, base_dir: str,
domain: str, cookie: str, theme: str,
access_keys: {}, key_shortcuts: {},
default_timeline: str) -> bool:
"""Show the links from the left column
"""
if '/users/' in path and path.endswith('/editlinks'):
nickname = path.split('/users/')[1]
if '/' in nickname:
nickname = nickname.split('/')[0]
if key_shortcuts.get(nickname):
access_keys = key_shortcuts[nickname]
msg = html_edit_links(translate,
base_dir,
path, domain,
default_timeline,
theme, access_keys)
if msg:
msg = msg.encode('utf-8')
msglen = len(msg)
set_headers(self, 'text/html', msglen,
cookie, calling_domain, False)
write2(self, msg)
else:
http_404(self, 106)
return True
return False