Commits

Patrick Samson committed bc66ffc

Fix issue #21

Comments (0)

Files changed (5)

 # The short X.Y version.
 version = '2.1'
 # The full version, including alpha/beta/rc tags.
-release = '2.1.0'
+release = '2.1.1'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.

postman/__init__.py

 from __future__ import unicode_literals
 
 # following PEP 386: N.N[.N]+[{a|b|c|rc}N[.N]+][.postN][.devN]
-VERSION = (2, 1, 0)
+VERSION = (2, 1, 1)
 PREREL = ()
 POST = 0
 DEV = 0

postman/fields.py

 if app_name in settings.INSTALLED_APPS and arg_default:
     autocompleter_app['is_active'] = True
     autocompleter_app['name'] = app_name
-    autocompleter_app['version'] = getattr(__import__(app_name, globals(), locals(), ['__version__']), '__version__', None)
+    autocompleter_app['version'] = getattr(__import__(app_name, globals(), locals(), [str('__version__')]), '__version__', None)
     # does something like "from ajax_select.fields import AutoCompleteField"
-    auto_complete_field = getattr(__import__(app_name + '.fields', globals(), locals(), [field_name]), field_name)
+    auto_complete_field = getattr(__import__(app_name + '.fields', globals(), locals(), [str(field_name)]), field_name)
 
     class CommaSeparatedUserField(BasicCommaSeparatedUserField, auto_complete_field):
         def __init__(self, *args, **kwargs):
     now = datetime.now
 
 from postman.api import pm_broadcast, pm_write
-from postman.fields import CommaSeparatedUserField
+# because of reload()'s, do "from postman.fields import CommaSeparatedUserField" just before needs
 # because of reload()'s, do "from postman.forms import xxForm" just before needs
 from postman.models import ORDER_BY_KEY, ORDER_BY_MAPPER, Message, PendingMessage,\
     STATUS_PENDING, STATUS_ACCEPTED, STATUS_REJECTED,\
     Usual generic tests.
     """
     def test_version(self):
-        self.assertEqual(sys.modules['postman'].__version__, "2.1.0")
+        self.assertEqual(sys.modules['postman'].__version__, "2.1.1")
 
 
 class BaseTest(TestCase):
         clear_url_caches()
         try:
             reload(sys.modules['postman.utils'])
+            reload(sys.modules['postman.fields'])
             reload(sys.modules['postman.forms'])
             reload(sys.modules['postman.views'])
             reload(sys.modules['postman.urls'])
 
     def test_write_post_multirecipient(self):
         "Test number of recipients constraint."
+        from postman.fields import CommaSeparatedUserField
         url = reverse('postman_write')
         data = {
             'email': 'a@b.com', 'subject': 's', 'body': 'b',
 
     def test_reply_post_copies(self):
         "Test number of recipients constraint."
+        from postman.fields import CommaSeparatedUserField
         pk = self.c21().pk
         url = reverse('postman_reply', args=[pk])
         data = {'subject': 's', 'body': 'b', 'recipients': self.user3.get_username()}
     """
     def test_label(self):
         "Test the plural/singular of the label."
+        from postman.fields import CommaSeparatedUserField
         f = CommaSeparatedUserField(label=('plural','singular'))
         self.assertEqual(f.label, 'plural')
         f.set_max(1)
 
     def test_to_python(self):
         "Test the conversion to a python list."
+        from postman.fields import CommaSeparatedUserField
         f = CommaSeparatedUserField()
         self.assertEqual(f.to_python(''), [])
         self.assertEqual(f.to_python('foo'), ['foo'])
 
     def test_clean(self):
         "Test the 'clean' validation."
+        from postman.fields import CommaSeparatedUserField
         f = CommaSeparatedUserField(required=False)
         self.assertEqual(f.clean(''), [])
         self.assertEqual(f.clean('foo'), [self.user1])
 
     def test_user_filter(self):
         "Test the 'user_filter' argument."
+        from postman.fields import CommaSeparatedUserField
         f = CommaSeparatedUserField(user_filter=lambda u: None)
         self.assertEqual(frozenset(f.clean('foo, bar')), frozenset([self.user1, self.user2]))
         # no reason
 
     def test_min(self):
         "Test the 'min' argument."
+        from postman.fields import CommaSeparatedUserField
         f = CommaSeparatedUserField(required=False, min=1)
         self.assertEqual(f.clean(''), [])
 
 
     def test_max(self):
         "Test the 'max' argument."
+        from postman.fields import CommaSeparatedUserField
         f = CommaSeparatedUserField(max=1)
         self.assertEqual(f.clean('foo'), [self.user1])
         self.assertRaises(ValidationError, f.clean, 'foo, bar')
 # but if not installed or not desired, fallback to django.core.mail
 name = getattr(settings, 'POSTMAN_MAILER_APP', 'mailer')
 if name and name in settings.INSTALLED_APPS:
-    send_mail = __import__(name, globals(), locals(), ['send_mail']).send_mail
+    send_mail = __import__(name, globals(), locals(), [str('send_mail')]).send_mail
 else:
     from django.core.mail import send_mail
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.