comparison roundup/hyperdb.py @ 5807:0467d80eaeec

Try to deal with this warning/error: DeprecationWarning: generator 'iter_roles' raised StopIteration PEP479 specifies how to rework it by using return rather than raise StopIteration. I am not sure if this is right, but test/test_cgi.py::FormTestCase::testRoles is still passing.
author John Rouillard <rouilj@ieee.org>
date Wed, 12 Jun 2019 19:38:33 -0400
parents 5a9159ad773f
children 936275dfe1fa
comparison
equal deleted inserted replaced
5806:abee2c2c822e 5807:0467d80eaeec
32 from roundup.cgi.exceptions import DetectorError 32 from roundup.cgi.exceptions import DetectorError
33 from roundup.anypy.cmp_ import NoneAndDictComparable 33 from roundup.anypy.cmp_ import NoneAndDictComparable
34 from roundup.anypy.strings import eval_import 34 from roundup.anypy.strings import eval_import
35 35
36 logger = logging.getLogger('roundup.hyperdb') 36 logger = logging.getLogger('roundup.hyperdb')
37
38 37
39 # 38 #
40 # Types 39 # Types
41 # 40 #
42 class _Type(object): 41 class _Type(object):
835 def iter_roles(roles): 834 def iter_roles(roles):
836 ''' handle the text processing of turning the roles list 835 ''' handle the text processing of turning the roles list
837 into something python can use more easily 836 into something python can use more easily
838 ''' 837 '''
839 if not roles or not roles.strip(): 838 if not roles or not roles.strip():
840 raise StopIteration("Empty roles given") 839 return
841 for role in [x.lower().strip() for x in roles.split(',')]: 840 for role in [x.lower().strip() for x in roles.split(',')]:
842 yield role 841 yield role
843 842
844 843
845 # 844 #

Roundup Issue Tracker: http://roundup-tracker.org/