|
5 | 5 | from flask import Flask, request, session, g, redirect, url_for, \
|
6 | 6 | abort, render_template, flash, jsonify
|
7 | 7 | from contextlib import closing
|
| 8 | +import pickle |
8 | 9 |
|
9 | 10 | # configuration
|
10 | 11 | DATABASE = '/var/www/web-print-server/web-print-server/db/data.db'
|
|
17 | 18 | app = Flask(__name__)
|
18 | 19 | app.config.from_object(__name__)
|
19 | 20 |
|
20 |
| -printerPages = { |
21 |
| - "print\\CASS101-X4600": 1, |
22 |
| - "print\\CLST100-CC5051": 1, |
23 |
| - "print\\CMC020-CC5051": 1, |
24 |
| - "print\\CMC104-CC5051": 1, |
25 |
| - "print\\CMC104-Gray-CC5051": 1, |
26 |
| - "print\\CMC121H-CC5051": 1, |
27 |
| - "print\\CMC201-X4600": 1, |
28 |
| - "print\\CMC305-X4600": 1, |
29 |
| - "print\\COWL108-CC5051": 1, |
30 |
| - "print\\FACI318-CC5051": 1, |
31 |
| - "print\\GHUE156-X5550": 1, |
32 |
| - "print\\GOOD102-X3610": 1, |
33 |
| - "print\\GOOD103-CC5051": 1, |
34 |
| - "print\\GOOD103-X6350": 1, |
35 |
| - "print\\HOPN104-CC5051": 1, |
36 |
| - "print\\HUL007A-X3600": 1, |
37 |
| - "print\\HUL010-X3600": 1, |
38 |
| - "print\\HUL014-X6350": 1, |
39 |
| - "print\\HUL100-CC5051": 1, |
40 |
| - "print\\LAIR115-CC5051": 1, |
41 |
| - "print\\LAIR118-CC5051": 1, |
42 |
| - "print\\LAIR208-CC5051": 1, |
43 |
| - "print\\LAIR208-X4600": 1, |
44 |
| - "print\\LAIR300-X3610": 1, |
45 |
| - "print\\LAST110-CC5051": 1, |
46 |
| - "print\\LDC220-CC5051": 2, |
47 |
| - "print\\LDC243-X5550": 2, |
48 |
| - "print\\LEIG128-LJM602": 2, |
49 |
| - "print\\LEIG217-X4510": 2, |
50 |
| - "print\\LEIG218-CC5051": 2, |
51 |
| - "print\\LEIG218-Gray-CC5051": 2, |
52 |
| - "print\\LEIG231-X4600": 2, |
53 |
| - "print\\LEIG326-CC5051": 2, |
54 |
| - "print\\LEIG326-X4600": 2, |
55 |
| - "print\\LEIG414-LJM602": 2, |
56 |
| - "print\\LIBR-Public-X5550": 2, |
57 |
| - "print\\LIBR400-CC5051": 2, |
58 |
| - "print\\MUDD075-X4510": 2, |
59 |
| - "print\\MUDD169-X4600": 2, |
60 |
| - "print\\MUSI200-X4600": 2, |
61 |
| - "print\\OLIN007-X6350": 2, |
62 |
| - "print\\OLIN011-X3600": 2, |
63 |
| - "print\\OLIN104-X4510": 2, |
64 |
| - "print\\OLIN112-X4510": 2, |
65 |
| - "print\\OLIN125-CC5051": 2, |
66 |
| - "print\\OLIN125-Gray-CC5051": 2, |
67 |
| - "print\\OLIN215-CC5051": 2, |
68 |
| - "print\\OLIN301-X4600": 2, |
69 |
| - "print\\OLIN311-CC5051": 2, |
70 |
| - "print\\OLIN311-X6350": 2, |
71 |
| - "print\\RSC105-CC5051": 3, |
72 |
| - "print\\RSC235-CC5051": 3, |
73 |
| - "print\\SAYL-Public-X5550": 3, |
74 |
| - "print\\SAYL050-X6360": 3, |
75 |
| - "print\\SAYL057-CC5051": 3, |
76 |
| - "print\\SAYL109A-X4510": 3, |
77 |
| - "print\\SAYL150-X4510": 3, |
78 |
| - "print\\SCOV014-CC5051": 3, |
79 |
| - "print\\SEVY014-CC5051": 3, |
80 |
| - "print\\SEVY129-CC5051": 3, |
81 |
| - "print\\STRG107-CC5051": 3, |
82 |
| - "print\\TWCO100-CC5051": 3, |
83 |
| - "print\\WCC003-X3610": 3, |
84 |
| - "print\\WCC028-CC5051": 3, |
85 |
| - "print\\WCC138-X6360": 3, |
86 |
| - "print\\WCC146-X3610": 3, |
87 |
| - "print\\WCC225-CC5051": 3, |
88 |
| - "print\\WEST200-CC5051": 3, |
89 |
| - "print\\WILL119-X4600": 3, |
90 |
| - "print\\WILL310-CC5051": 3, |
91 |
| - "print\\WILL409-X4600": 3 |
92 |
| -} |
93 |
| - |
94 | 21 | #database helper functions
|
95 | 22 | def connect_db():
|
96 | 23 | return sqlite3.connect(app.config['DATABASE'])
|
@@ -163,7 +90,7 @@ def get_status():
|
163 | 90 | response["errors"] = message
|
164 | 91 | except:
|
165 | 92 | pass
|
166 |
| - response["printerPages"] = printerPages |
| 93 | + response["printerPages"] = pickle.load(open("printerPages.p", "rb")) |
167 | 94 | return(jsonify(**response))
|
168 | 95 |
|
169 | 96 |
|
|
0 commit comments