Mercurial > p > roundup > code
comparison roundup/security.py @ 8519:19152fd94fcf
bug: move import findargspec out of Permission __init__ method
We have a few places where imports are done inside a method/function.
For methods that are called once it's not an issue but the Permissions
__init__ method is called often and accounts for > 10% of the time in
the __init__ function when looking at wsgi-lineprof output.
So move it to the module level.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 02 Feb 2026 23:41:36 -0500 |
| parents | 224ccb8b49ca |
| children |
comparison
equal
deleted
inserted
replaced
| 8518:4b89c22b1a91 | 8519:19152fd94fcf |
|---|---|
| 4 | 4 |
| 5 import logging | 5 import logging |
| 6 import weakref | 6 import weakref |
| 7 | 7 |
| 8 from roundup import hyperdb, support | 8 from roundup import hyperdb, support |
| 9 from roundup.anypy import findargspec | |
| 9 | 10 |
| 10 logger = logging.getLogger('roundup.security') | 11 logger = logging.getLogger('roundup.security') |
| 11 | 12 |
| 12 | 13 |
| 13 class Permission: | 14 class Permission: |
| 72 | 73 |
| 73 limit_perm_to_props_only_default = False | 74 limit_perm_to_props_only_default = False |
| 74 | 75 |
| 75 def __init__(self, name='', description='', klass=None, | 76 def __init__(self, name='', description='', klass=None, |
| 76 properties=None, check=None, props_only=None, filter=None): | 77 properties=None, check=None, props_only=None, filter=None): |
| 77 from roundup.anypy import findargspec | |
| 78 self.name = name | 78 self.name = name |
| 79 self.description = description | 79 self.description = description |
| 80 self.klass = klass | 80 self.klass = klass |
| 81 self.properties = properties | 81 self.properties = properties |
| 82 self._properties_dict = support.TruthDict(properties) | 82 self._properties_dict = support.TruthDict(properties) |
