Index: server/lib/gutenbach/ipp/operations.py
===================================================================
--- server/lib/gutenbach/ipp/operations.py	(revision cf32fee4f45b34100e39e3b51044243e285a3df1)
+++ server/lib/gutenbach/ipp/operations.py	(revision 71bfce0b333b007df44decc7e73d62251f97b911)
@@ -3,5 +3,5 @@
 from .attributegroup import AttributeGroup
 from .request import Request
-from .constants import AttributeTags, Tags
+from .constants import AttributeTags, operations_attribute_value_tags
 import exceptions as err
 
@@ -54,7 +54,7 @@
     # check charset value
     charset_value = charset_attr.values[0]
-    if charset_value.tag != Tags.CHARSET:
-        raise err.BadRequest(
-            "Charset value does not have CHARSET tag: 0x%x" % charset_value.tag)
+    if charset_value.tag != operations_attribute_value_tags['attributes-charset']:
+        raise err.BadRequest(
+            "Wrong tag for charset value: 0x%x" % charset_value.tag)
     if charset_value.value != 'utf-8':
         raise err.CharsetNotSupported(str(charset_value.value))
@@ -71,5 +71,5 @@
     # check natural language value
     natlang_value = natlang_attr.values[0]
-    if natlang_value.tag != Tags.NATURAL_LANGUAGE:
+    if natlang_value.tag != operations_attribute_value_tags['attributes-natural-language']:
         raise err.BadRequest(
             "Natural language value does not have NATURAL_LANGUAGE tag: 0x%x" natlang_value.tag)
@@ -78,17 +78,36 @@
             "Invalid natural language value: %s" % natlang_value.value, [natlang_attr])
 
+def verify_printer_uri(uri_attr):
+    if uri_attr.name != 'printer-uri':
+        raise err.BadRequest(
+            "Unexpected name for attribute 'printer-uri': %s" % uri_attr.name)
+    if len(uri_attr.values) != 1:
+        raise err.BadRequest(
+            "Requesting printer uri attribute has too many values: %d" % len(uri_attr.values))
+    printer_name_value = uri_attr.values[0]
+    if printer_name_value.tag != operations_attribute_value_tags['printer-uri']:
+        raise err.BadRequest(
+            "Bad value tag (expected URI): 0x%x" % printer_name_value_tag)
+    
+    # actually get the printer name
+    printer_name_value = printer_name_attr.values[0].value
+    # XXX: hack -- CUPS will strip the port from the request, so
+    # we can't do an exact comparison (also the hostname might be
+    # different, depending on the CNAME or whether it's localhost)
+    printer_name = printer_name_value.split("/")[-1]
+    return printer_name
+
 def verify_requesting_username(requser_attr):
-    if requser_attr.tag != Tags.NAME_WITHOUT_LANGUAGE:
-        raise err.BadRequest(
-            "Requesting user name attribute tag is not NAME_WITHOUT_LANGUAGE: 0x%x" % \
-            requser_attr.tag)
+    if requser_attr.name != 'requesting-user-name':
+        raise err.BadRequest(
+            "Unexpected name for attribute 'requesting-user-name': %s" % requser_attr.name)
     if len(requser_attr.values) != 1:
         raise err.BadRequest(
             "Requesting user name attribute has too many values: %d" % len(requser_attr.values))
     requser_value = requser_attr.values[0]
-    if requser_value.tag != Tags.NAME_WITHOUT_LANGUAGE:
-        raise err.BadRequest(
-            "Requesting user name value tag is not NAME_WITHOUT_LANGUAGE: 0x%x" % \
-            requser_value.tag)
+    if requser_value.tag != operations_attribute_value_tags['requesting-user-name']:
+        raise err.BadRequest(
+            "Bad value tag (expected NAME_WITHOUT_LANGUAGE): 0x%x" % requser_value.tag)
+    
     return requser_value.value
 
@@ -98,8 +117,8 @@
         ipp.Attribute(
             'attributes-charset',
-            [ipp.Value(ipp.Tags.CHARSET, 'utf-8')]),
+            [(operations_attribute_value_tags['attributes-charset'], 'utf-8')]),
         ipp.Attribute(
             'attributes-natural-language',
-            [ipp.Value(ipp.Tags.NATURAL_LANGUAGE, 'en-us')])
+            [(operations_attribute_value_tags['attributes-natural-language'], 'en-us')])
         ]
     # Put the operation attributes in a group
@@ -205,14 +224,19 @@
     """
 
+
     # generic operations verification
     verify_operations(request)
-
+    # requested printer uri
+    printeruri = verify_printer_uri(request.attribute_groups[0].attributes[2])
     # requesting username
-    requser = verify_requesting_username(request.attributes[2])
-    out = {'requesting-user-name': requser}
-
+    requser = verify_requesting_username(request.attribute_groups[0].attributes[3])
     # make the rest of the attributes into a dictionary
-    attrs = dict([(attr.name, attr.values) for attr in request.attributes[3:]])
+    attrs = dict([(attr.name, attr.values) for attr in request.attributes[4:]])
     
+    out = {
+        'printer-uri': printeruri,
+        'requesting-user-name': requser
+        }
+
     if 'limit' in attrs:
         out['limit'] = None # XXX
@@ -230,5 +254,5 @@
 
 def make_get_jobs_response(self, request):
-    """3.2.6.2 Get-Jobs Response
+    """RFC 2911: 3.2.6.2 Get-Jobs Response
         
     The Printer object returns all of the Job objects up to the number
