Index: pkipplib/trunk/bin/pksubscribe
===================================================================
--- pkipplib/trunk/bin/pksubscribe (revision 45)
+++ pkipplib/trunk/bin/pksubscribe (revision 3437)
@@ -1,4 +1,4 @@
 #! /usr/bin/env python
-# -*- coding: UTF-8 -*-
+# -*- coding: utf-8 -*-
 #
 # pkipplib : IPP and CUPS support for Python
@@ -9,10 +9,10 @@
 # the Free Software Foundation, either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -28,7 +28,7 @@
 import optparse
 
-from pkipplib import pkipplib        
-    
-if __name__ == "__main__" :    
+from pkipplib import pkipplib
+
+if __name__ == "__main__" :
     try :
         locale.setlocale(locale.LC_ALL, "")
@@ -40,49 +40,49 @@
         gettext.NullTranslations().install()
     parser = optparse.OptionParser(usage="pksubscribe [options] [subscriptions ids]")
-    parser.add_option("-v", "--version", 
-                            action="store_true", 
+    parser.add_option("-v", "--version",
+                            action="store_true",
                             dest="version",
                             help=_("show pksubscribe's version number and exit."))
-    parser.add_option("-c", "--cups", 
-                            default="http://localhost:631", 
+    parser.add_option("-c", "--cups",
+                            default="http://localhost:631",
                             dest="cups",
                             help=_("the CUPS server to connect to. Defaults to http://localhost:631"))
-    parser.add_option("-d", "--debug", 
-                            action="store_true", 
+    parser.add_option("-d", "--debug",
+                            action="store_true",
                             dest="debug",
                             help=_("activate debug mode."))
-    parser.add_option("-X", "--delete", 
-                            action="store_true", 
+    parser.add_option("-X", "--delete",
+                            action="store_true",
                             dest="delete",
                             help=_("deletes subscriptions."))
-    parser.add_option("-p", "--printer", 
+    parser.add_option("-p", "--printer",
                             dest="printer",
                             help=_("the printer's name for a printer subscription."))
-    parser.add_option("-j", "--job", 
-                            type="int", 
+    parser.add_option("-j", "--job",
+                            type="int",
                             dest="job",
                             help=_("the job's id for a job subscripition."))
-    parser.add_option("-r", "--recipient",                        
+    parser.add_option("-r", "--recipient",
                             dest="recipient",
                             help=_("the recipient's uri."))
-    parser.add_option("-C", "--charset",                        
+    parser.add_option("-C", "--charset",
                             dest="charset",
                             help=_("the charset to use in notifications sent for this subscription."))
-    parser.add_option("-L", "--language",                        
+    parser.add_option("-L", "--language",
                             dest="language",
                             help=_("the language to use in notifications sent for this subscription."))
-    parser.add_option("-u", "--userdata",                        
+    parser.add_option("-u", "--userdata",
                             dest="userdata",
                             help=_("the user's data to use in notifications for this subscription."))
-    parser.add_option("-U", "--username",                        
+    parser.add_option("-U", "--username",
                             dest="username",
                             help=_("the user's name to use when connecting to the CUPS server."))
-    parser.add_option("-W", "--password",                        
+    parser.add_option("-W", "--password",
                             dest="password",
                             help=_("the user's password to use when connecting to the CUPS server."))
-    parser.add_option("-E", "--events",                        
+    parser.add_option("-E", "--events",
                             dest="events",
                             help=_("a comma separated list of events to subscribe to."))
-    parser.add_option("-P", "--pullmethod",                        
+    parser.add_option("-P", "--pullmethod",
                             dest="pullmethod",
                             help=_("the optional pull method's name."))
@@ -91,9 +91,9 @@
                             dest="duration",
                             help=_("the duration of the subscription."))
-    parser.add_option("-I", "--interval",                        
+    parser.add_option("-I", "--interval",
                             type="int",
                             dest="interval",
                             help=_("the time interval of the subscription."))
-                            
+
     (options, arguments) = parser.parse_args()
     if options.version :
@@ -102,9 +102,9 @@
         if not options.events and not options.delete :
             sys.stderr.write(_("You MUST pass a list of events to subscribe to.\n"))
-        elif not options.recipient and not options.delete :    
+        elif not options.recipient and not options.delete :
             sys.stderr.write(_("You MUST pass a recipient for the subscription.\n"))
-        elif options.delete and not arguments :    
+        elif options.delete and not arguments :
             sys.stderr.write(_("You MUST pass a subscriptions ids at the end of your command line.\n"))
-        else :    
+        else :
             cups = pkipplib.CUPS(options.cups,
                                  options.username,
@@ -112,13 +112,13 @@
                                  debug=options.debug)
             baseurl = options.cups.replace("http://", "ipp://")
-            if baseurl.endswith(":631") : 
+            if baseurl.endswith(":631") :
                 baseurl = baseurl[:-4]
             if options.printer :
                 url = "%s/printers/%s" % (baseurl, options.printer)
-            elif options.job :     
+            elif options.job :
                 url = "%s/jobs/%i" % (baseurl, options.job)
-            else :    
+            else :
                 url = baseurl
-            if not options.delete :    
+            if not options.delete :
                 answer = cups.createSubscription(url,
                                                  [e.strip() for e in options.events.split(",")],
@@ -131,11 +131,11 @@
                                                  timeinterval=options.interval,
                                                  jobid=options.job)
-                try :                                 
+                try :
                     subscriptionid = answer.subscription["notify-subscription-id"][0][1]
                 except KeyError :
                     sys.stderr.write("%s\n" % answer.operation["status-message"][0][1])
-                else :    
+                else :
                     print _("Subscription %i registered.") % subscriptionid
-            else :        
+            else :
                 for subid in [int(arg) for arg in arguments] :
                     answer = cups.cancelSubscription(url, subid, options.job)
@@ -143,9 +143,9 @@
                         try :
                             error = answer.operation["status-message"][0][1]
-                        except KeyError :    
+                        except KeyError :
                             print _("Subscription %i cancelled.") % subid
                         else :
                             sys.stderr.write("%s\n" % error)
-                    else :        
+                    else :
                         sys.stderr.write(_("Incorrect answer (None)\n"))
 
