Changeset 8de3c81 for server/lib/gutenbach/server/requests.py
- Timestamp:
- Jan 21, 2012, 3:19:37 PM (12 years ago)
- Branches:
- no-cups
- Children:
- 5141ed8
- Parents:
- 8d89b3d (diff), 7c8a2f8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Daniel Cooper <danny@…> (01/21/12 15:19:37)
- git-committer:
- Daniel Cooper <danny@…> (01/21/12 15:19:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/server/requests.py
r8d89b3d r8de3c81 896 896 @handler_for(ipp.OperationCodes.SEND_URI) 897 897 def send_uri(self, request, response): 898 <<<<<<< HEAD 898 899 raise ipp.errors.ServerErrorOperationNotSupported 900 ======= 901 """3.2.2 Send URI 902 903 This OPTIONAL operation is identical to the Send-Document 904 operation (see section 3.3.1) except that a client MUST supply 905 a URI reference ('document-uri' operation attribute) rather 906 than the document data itself. If a Printer object supports 907 this operation, clients can use both Send-URI or Send-Document 908 operations to add new documents to an existing multi-document 909 Job object. However, if a client needs to indicate that the 910 previous Send-URI or Send-Document was the last document, the 911 client MUST use the Send-Document operation with no document 912 data and the 'last-document' flag set to 'true' (rather than 913 using a Send-URI operation with no 'document-uri' operation 914 attribute). 915 916 If a Printer object supports this operation, it MUST also 917 support the Print-URI operation (see section 3.2.2). 918 919 The Printer object MUST validate the syntax and URI scheme of 920 the supplied URI before returning a response, just as in the 921 Print-URI operation. The IPP Printer MAY validate the 922 accessibility of the document as part of the operation or 923 subsequently (see section 3.2.2). 924 925 Request 926 ------- 927 928 Group 1: Operation Attributes 929 REQUIRED 'attributes-charset' 930 REQUIRED 'attributes-natural-language' 931 REQUIRED 'job-id' (integer(1:MAX)) and 'printer-uri' (uri) 932 REQUIRED 'document-uri' (uri) 933 -or- 'job-uri' (uri) 934 OPTIONAL 'requesting-user-name' (name(MAX)) 935 OPTIONAL 'document-name' (name(MAX)) 936 OPTIONAL 'compression' (type3 keyword) 937 OPTIONAL 'document-format' (mimeMediaType) 938 OPTIONAL 'document-natural-language' (naturalLanguage) 939 Group 2: Document Content 940 941 Response 942 -------- 943 944 Group 1: Operation Attributes 945 OPTIONAL 'status-message' (text(255)) 946 OPTIONAL 'detailed-status-message' (text(MAX)) 947 REQUIRED 'attributes-charset' 948 REQUIRED 'attributes-natural-language' 949 Group 2: Unsupported Attributes 950 Group 3: Job Object Attributes 951 REQUIRED 'job-uri' (uri) 952 REQUIRED 'job-id' (integer(1:MAX)) 953 REQUIRED 'job-state' (type1 enum) 954 REQUIRED 'job-state-reasons' (1setOf type2 keyword) 955 OPTIONAL 'job-state-message' (text(MAX)) 956 OPTIONAL 'number-of-intervening-jobs' (integer(0:MAX)) 957 958 """ 959 960 operation = request.attribute_groups[0] 961 962 job_id = None 963 printer_uri = None 964 requesting_user_name = None 965 document_name = None 966 compression = None 967 document_format = None 968 document_natural_language = None 969 last_document = None 970 971 # required attributes 972 if 'job-id' not in operation: 973 raise ipp.errors.ClientErrorBadRequest("Missing 'job-id' attribute") 974 job_id = verify_attribute(operation['job-id'], ipp.JobId)[0] 975 976 if 'last-document' not in operation: 977 raise ipp.errors.ClientErrorBadRequest("Missing 'last-document' attribute") 978 last_document = verify_attribute(operation['last-document'], ipp.LastDocument)[0] 979 980 if 'document-uri' not in operation: 981 raise ipp.errors.ClientErrorBadRequest("Missing 'document-uri' attribute") 982 document_uri = verify_attribute(operation['document-uri'], ipp.DocumentUri)[0] 983 if not last_document: 984 raise ipp.errors.ServerErrorMultipleJobsNotSupported 985 986 # optional attributes 987 if 'printer-uri' in operation: 988 printer_uri = verify_attribute(operation['printer-uri'], ipp.PrinterUri)[0] 989 if printer_uri not in self.printer.uris: 990 raise ipp.errors.ClientErrorAttributes( 991 str(operation['printer-uri']), operation['printer-uri']) 992 993 if 'requesting-user-name' in operation: 994 user_name = verify_attribute( 995 operation['requesting-user-name'], ipp.RequestingUserName)[0] 996 997 if 'document-name' in operation: 998 document_name = verify_attribute( 999 operation['document-name'], ipp.DocumentName)[0] 1000 1001 if 'compression' in operation: 1002 compression = verify_attribute( 1003 operation['compression'], ipp.Compression)[0] 1004 1005 if 'document-format' in operation: 1006 document_format = verify_attribute( 1007 operation['document-format'], ipp.DocumentFormat)[0] 1008 1009 if 'document-natural-language' in operation: 1010 document_natural_language = verify_attribute( 1011 operation['document_natural_language'], 1012 ipp.DocumentNaturalLanguage)[0] 1013 1014 try: 1015 self.printer.send_uri( 1016 job_id, 1017 document_uri=document_uri, 1018 document_name=document_name, 1019 document_format=document_format, 1020 document_natural_language=document_natural_language, 1021 requesting_user_name=user_name, 1022 compression=compression, 1023 last_document=last_document) 1024 attrs = self.printer.get_job_attributes(job_id) 1025 except InvalidJobException: 1026 raise ipp.errors.ClientErrorNotFound("bad job: %d" % job_id) 1027 1028 response.attribute_groups.append(ipp.AttributeGroup( 1029 ipp.AttributeTags.JOB, attrs)) 1030 >>>>>>> 7c8a2f82df069878680146d8ac18339ec96bd487 899 1031 900 1032 @handler_for(ipp.OperationCodes.GET_JOB_ATTRIBUTES)
Note: See TracChangeset
for help on using the changeset viewer.