summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorAleš Smodiš <aless@guru.si>2015-08-24 19:09:41 +0200
committerAleš Smodiš <aless@guru.si>2015-08-24 19:09:41 +0200
commita4f639242f9f6221a486e0e91adeb75ba6096f45 (patch)
treea6d1c1207ccd9829031d527f322ad84d89a2a550 /client
parent5b4f1e25980ee18a323eba1415ed453b3a910ca3 (diff)
Split the development into daemon and wsgi_server.
Implemented basic infrastructure for daemon (Prolog), and partial support for services in wsgi_server.
Diffstat (limited to 'client')
-rw-r--r--client/__init__.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/client/__init__.py b/client/__init__.py
new file mode 100644
index 0000000..8781a96
--- /dev/null
+++ b/client/__init__.py
@@ -0,0 +1,26 @@
+# coding=utf-8
+
+import multiprocessing.managers
+
+__all__ = ['get_session_by_id', 'get_or_create_session']
+
+class CodeqManager(multiprocessing.managers.BaseManager):
+ pass
+
+CodeqManager.register('PrologSession')
+CodeqManager.register('UserSession')
+CodeqManager.register('get_session_by_id')
+CodeqManager.register('get_or_create_session')
+CodeqManager.register('authenticate_and_create_session')
+
+m = CodeqManager(address=('localhost', 16231), authkey=b'c0d3q3y')
+m.connect()
+
+def get_session_by_id(sid):
+ return m.get_session_by_id(sid)
+
+def get_or_create_session(uid, username, sid=None):
+ return m.get_or_create_session(uid, username, sid)
+
+def authenticate_and_create_session(username, password):
+ return m.authenticate_and_create_session(username, password)