[postr: 6/8] Don't import constants directly.



commit cb6a4ab7074ef3597a4947c7054001d5b80b8439
Author: Karl Mikaelsson <derfian lysator liu se>
Date:   Mon Aug 23 21:10:34 2010 +0200

    Don't import constants directly.
    
    Don't import RESPONSE_OK and RESPONSE_INVALID from PyUnique, use them
    directly from the module instead. This makes the code more clear on
    what RESPONSE_OK constant is being used, as gtk has one too.

 src/postr.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/postr.py b/src/postr.py
index e41db32..93e1ab4 100644
--- a/src/postr.py
+++ b/src/postr.py
@@ -45,7 +45,8 @@ from datetime import datetime
 import shelve
 
 try:
-    from PyUnique import UniqueApp, RESPONSE_OK, RESPONSE_INVALID
+    import PyUnique
+    from PyUnique import UniqueApp
 except ImportError:
     from DummyUnique import UniqueApp
 
@@ -278,9 +279,9 @@ class Postr(UniqueApp):
         """ PyUnique callback for receiving a message """
         if command == self.commands['OPEN']:
             self.add_image_filename(data)
-            return RESPONSE_OK
+            return PyUnique.RESPONSE_OK
         else:
-            return RESPONSE_INVALID
+            return PyUnique.RESPONSE_INVALID
 
     def on_model_changed(self, *args):
         # We don't care about the arguments, because we just want to know when



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]