Skip to content

Commit

Permalink
Merge branch 'master' into tseaver-pyramid2-compat
Browse files Browse the repository at this point in the history
  • Loading branch information
tseaver committed Sep 1, 2024
2 parents 8f8131c + 71c3e6c commit 085030e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
1.0b1 (unreleased)
==================


- Update to use Pyramid >= 2.0.
See https://github.com/Pylons/substanced/pull/308

- Fix ``tznames_widget``, b0rken seemingly forever under Python3.
See https://github.com/Pylons/substanced/pull/314

- Drop old Python versions (< 3.8), add newer ones (up to 3.12).
- Remove all the "straddle" compatibility stuff FBO Python 2.7
- Pin pyramid < 2.0dev, until it can be reviewed in depth.
Expand Down
4 changes: 2 additions & 2 deletions substanced/principal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ def groups_choices(context, request):
_ZONES = pytz.all_timezones

@colander.deferred
def tzname_widget(node, kw): #pragma NO COVER
return deform.widget.Select2Widget(values=zip(_ZONES, _ZONES))
def tzname_widget(node, kw):
return deform.widget.Select2Widget(values=list(zip(_ZONES, _ZONES)))

def get_locales():
dir_ = os.listdir(os.path.join(os.path.dirname(__file__),
Expand Down
29 changes: 20 additions & 9 deletions substanced/principal/tests/test_principal.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
from pyramid import testing
from zope.interface import implementer

class Test_locale_widget(unittest.TestCase):
def _callFUT(self, node, kw):
from substanced.principal import locale_widget
return locale_widget(node, kw)

def test_it(self):
result = self._callFUT(None, None)
self.assertTrue( ('en', 'en') in result.values)

class TestPrincipals(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
Expand Down Expand Up @@ -343,6 +334,26 @@ def test_it_no_principals_service(self):
result = self._makeOne(site, request)
self.assertEqual(result, ())

class Test_tzname_widget(unittest.TestCase):
def _callFUT(self, node, kw):
from substanced.principal import tzname_widget
return tzname_widget(node, kw)

def test_it(self):
result = self._callFUT(None, None)
self.assertIn(
('America/New_York', 'America/New_York'), result.values
)

class Test_locale_widget(unittest.TestCase):
def _callFUT(self, node, kw):
from substanced.principal import locale_widget
return locale_widget(node, kw)

def test_it(self):
result = self._callFUT(None, None)
self.assertIn( ('en', 'en'), result.values)

class TestUser(unittest.TestCase):
def setUp(self):
self.config = testing.setUp()
Expand Down

0 comments on commit 085030e

Please sign in to comment.