Changeset f6c6897 for server/lib/gutenbach/ipp/operations.py
- Timestamp:
- Dec 20, 2011, 1:47:11 PM (12 years ago)
- Branches:
- no-cups
- Children:
- 6effd50
- Parents:
- 5fe360e
- git-author:
- Jessica B. Hamrick <jhamrick@…> (12/20/11 13:47:11)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (12/20/11 13:47:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/lib/gutenbach/ipp/operations.py
r71bfce0 rf6c6897 3 3 from .attributegroup import AttributeGroup 4 4 from .request import Request 5 from .constants import AttributeTags, operations_attribute_value_tags5 from .constants import AttributeTags, StatusCodes, operations_attribute_value_tags 6 6 import exceptions as err 7 8 from collections import OrderedDictionary as odict9 7 10 8 def verify_operations(request): … … 43 41 44 42 # check charset 45 charset attribute46 43 charset_attr = op_attrs.attributes[0] 47 44 if charset_attr.name != 'attributes-charset': … … 73 70 if natlang_value.tag != operations_attribute_value_tags['attributes-natural-language']: 74 71 raise err.BadRequest( 75 "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" natlang_value.tag)72 "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" % natlang_value.tag) 76 73 if natlang_value.value != 'en-us': 77 74 raise err.Attributes( … … 115 112 # Operation attributes -- typically the same for any request 116 113 attributes = [ 117 ipp.Attribute(114 Attribute( 118 115 'attributes-charset', 119 [ (operations_attribute_value_tags['attributes-charset'], 'utf-8')]),120 ipp.Attribute(116 [Value(operations_attribute_value_tags['attributes-charset'], 'utf-8')]), 117 Attribute( 121 118 'attributes-natural-language', 122 [ (operations_attribute_value_tags['attributes-natural-language'], 'en-us')])119 [Value(operations_attribute_value_tags['attributes-natural-language'], 'en-us')]) 123 120 ] 124 121 # Put the operation attributes in a group 125 attribute_group = ipp.AttributeGroup(126 const.AttributeTags.OPERATION,122 attribute_group = AttributeGroup( 123 AttributeTags.OPERATION, 127 124 attributes) 128 125 … … 131 128 response_kwargs = {} 132 129 response_kwargs['version'] = request.version 133 response_kwargs['operation_id'] = const.StatusCodes.OK130 response_kwargs['operation_id'] = StatusCodes.OK 134 131 response_kwargs['request_id'] = request.request_id 135 132 response_kwargs['attribute_groups'] = [attribute_group] 136 response = ipp.Request(**response_kwargs)133 response = Request(**response_kwargs) 137 134 138 135 return response … … 168 165 if 'which-jobs' or 'my-jobs' constrain which jobs are 169 166 returned. The limit is a 'stateless limit' in that if 170 the value supplied by the client is ’N’, then only the171 first ’N’jobs are returned in the Get-Jobs Response.172 There is no mechanism to allow for the next ’M’jobs173 after the first ’N’jobs. If the client does not167 the value supplied by the client is 'N', then only the 168 first 'N' jobs are returned in the Get-Jobs Response. 169 There is no mechanism to allow for the next 'M' jobs 170 after the first 'N' jobs. If the client does not 174 171 supply this attribute, the Printer object responds 175 172 with all applicable jobs. … … 185 182 the client does not supply this attribute, the Printer 186 183 MUST respond as if the client had supplied this 187 attribute with two values: ’job-uri’ and ’job-id’.184 attribute with two values: 'job-uri' and 'job-id'. 188 185 'which-jobs' (type2 keyword): 189 186 The client OPTIONALLY supplies this attribute. The … … 191 188 indicates which Job objects MUST be returned by the 192 189 Printer object. The values for this attribute are: 193 - ’completed’: This includes any Job object whose194 state is ’completed’, ’canceled’, or ’aborted’.195 - ’not-completed’: This includes any Job object whose196 state is ’pending’, ’processing’,197 ’processing-stopped’, or ’pending-held’.190 - 'completed': This includes any Job object whose 191 state is 'completed', 'canceled', or 'aborted'. 192 - 'not-completed': This includes any Job object whose 193 state is 'pending', 'processing', 194 'processing-stopped', or 'pending-held'. 198 195 A Printer object MUST support both values. However, if 199 196 the implementation does not keep jobs in the 200 ’completed’, ’canceled’, and ’aborted’states, then it201 returns no jobs when the ’completed’value is197 'completed', 'canceled', and 'aborted' states, then it 198 returns no jobs when the 'completed' value is 202 199 supplied. If a client supplies some other value, the 203 200 Printer object MUST copy the attribute and the 204 201 unsupported value to the Unsupported Attributes 205 202 response group, reject the request, and return the 206 ’client-error-attributes-or-values-not-supported’203 'client-error-attributes-or-values-not-supported' 207 204 status code. If the client does not supply this 208 205 attribute, the Printer object MUST respond as if the 209 206 client had supplied the attribute with a value of 210 ’not-completed’.207 'not-completed'. 211 208 'my-jobs' (boolean): 212 209 The client OPTIONALLY supplies this attribute. The … … 218 215 attribute, the Printer object MUST respond as if the 219 216 client had supplied the attribute with a value of 220 ’false’, i.e., jobs from all users. The means for217 'false', i.e., jobs from all users. The means for 221 218 authenticating the requesting user and matching the 222 219 jobs is described in section 8. … … 268 265 response returns 0 jobs because there are no jobs matching the 269 266 criteria, and the request would have returned 1 or more jobs 270 with a status code of ’successful-ok’if there had been jobs267 with a status code of 'successful-ok' if there had been jobs 271 268 matching the criteria, then the status code for 0 jobs MUST be 272 ’successful-ok’.269 'successful-ok'. 273 270 274 271 Group 1: Operation Attributes … … 293 290 referenced in the 'requested-attributes' operation 294 291 attribute and that attribute included group names, such as 295 ’all’, the unsupported attributes MUST NOT include292 'all', the unsupported attributes MUST NOT include 296 293 attributes described in the standard but not supported by 297 294 the implementation. … … 306 303 job (job originating user) or not (see section 307 304 8). However, the Printer object MUST respond with the 308 ’unknown’value for any supported attribute (including all305 'unknown' value for any supported attribute (including all 309 306 REQUIRED attributes) for which the Printer object does not 310 307 know the value, unless it would violate the security … … 313 310 314 311 Jobs are returned in the following order: 315 - If the client requests all ’completed’Jobs (Jobs in the316 ’completed’, ’aborted’, or ’canceled’states), then the312 - If the client requests all 'completed' Jobs (Jobs in the 313 'completed', 'aborted', or 'canceled' states), then the 317 314 Jobs are returned newest to oldest (with respect to 318 315 actual completion time) 319 - If the client requests all ’not-completed’Jobs (Jobs in320 the ’pending’, ’processing’, ’pending-held’, and321 ’processing- stopped’states), then Jobs are returned in316 - If the client requests all 'not-completed' Jobs (Jobs in 317 the 'pending', 'processing', 'pending-held', and 318 'processing- stopped' states), then Jobs are returned in 322 319 relative chronological order of expected time to 323 320 complete (based on whatever scheduling algorithm is
Note: See TracChangeset
for help on using the changeset viewer.