Permalink
Browse files

Use json array instead of hardcoded string for capabilities

  • Loading branch information...
simoncadman committed Aug 4, 2012
1 parent 95b6b39 commit 4eac8ec38da42474110cfb6105b26f0a85f25cf4
Showing with 5 additions and 1 deletion.
  1. +5 −1 printer.py
View
@@ -173,6 +173,10 @@ def EncodeMultiPart(fields, files, file_type='application/xml'):
lines.append('--' + Printer.BOUNDARY + '--')
lines.append('') # blank line
return Printer.CRLF.join(lines)
+
+ @staticmethod
+ def getCapabilities (printerid) :
+ return { "capabilities" : [{ "name" : "ns1:Colors", "type" : "Feature", "options" : [{ "name":"Color" }] }] }
@staticmethod
def SubmitJob(printerid, jobtype, jobsrc, jobname, tokens):
@@ -213,7 +217,7 @@ def SubmitJob(printerid, jobtype, jobsrc, jobname, tokens):
('title', title),
('content', content[jobtype]),
('contentType', content_type[jobtype]),
- ('capabilities', '{"capabilities":[{"name":"ns1:Colors","type":"Feature","options":[{"name":"Color"}]}]}')
+ ('capabilities', json.dumps( Printer.getCapabilities(printerid) ) )
]
files = []
if jobtype in ['pdf', 'jpeg', 'png']:

0 comments on commit 4eac8ec

Please sign in to comment.