forked from teamtachyon/Quillpad-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
startquill_manual.py
executable file
·67 lines (57 loc) · 2.41 KB
/
startquill_manual.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
from aifc import Error
import cherrypy
from QuillManual import QuillManual
class QuillManualCherry:
@cherrypy.expose
def primaryToUnicodeCherry(self, literal ) :
try:
print "Invoking primaryToUnicode on QuillManual..."
return literal + "\n" + self.quillManual.primaryToUnicode( literal )
except Exception:
print Exception
return "-------------";
@cherrypy.expose
def unicodeToPrimaryCherry(self, uStr ) :
try:
return uStr.decode('utf-8') + "\n" + self.quillManual.unicodeToPrimary( uStr.decode('utf-8') )
except Exception:
print Exception
return "-------------";
@cherrypy.expose
def unicodeToHelperStrCherry(self, uStr ) :
try:
return uStr.decode('utf-8') + "\n" + self.quillManual.unicodeToHelperStr( uStr.decode('utf-8') )
except Exception:
print Exception
return "-------------";
@cherrypy.expose
def getOptionsAtCherry(self, currHelper, currUStr, pos ) :
try:
return currUStr.decode('utf-8') + "\n" + "\n".join(self.quillManual.getOptionsAt( currHelper, currUStr.decode('utf-8'), int(pos) ))
except Exception:
print Exception
return "-------------";
@cherrypy.expose
def getInsertCorrectionsCherry(self, currHelper, currUStr, pos, delta ) :
try:
corrections = currUStr.decode('utf-8') + "\n" + "\n".join(self.quillManual.getInsertCorrections( currHelper, currUStr.decode('utf-8'), int(pos), delta ));
return corrections
except Exception:
print Exception
return "-------------";
@cherrypy.expose
def getDeleteCorrectionsCherry(self, currHelper, currUStr, pos, delLen ) :
try:
return currUStr.decode('utf-8') + "\n" + "\n".join(self.quillManual.getDeleteCorrections( currHelper, currUStr.decode('utf-8'), int(pos), int(delLen) ))
except Exception:
print Exception
return "-------------";
def __init__(self):
self.quillManual = QuillManual()
self.quillManual.loadPrimaryDef()
def main() :
cherrypy.root = QuillManualCherry()
cherrypy.config.update( file='quill_manual.conf' )
cherrypy.server.start()
if __name__ == '__main__' :
main()