pyams-utils 1.3.5__py3.5.egg → 1.3.7__py3.5.egg

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. EGG-INFO/PKG-INFO +9 -1
  2. pyams_utils/__pycache__/__init__.cpython-35.pyc +0 -0
  3. pyams_utils/__pycache__/adapter.cpython-35.pyc +0 -0
  4. pyams_utils/__pycache__/attr.cpython-35.pyc +0 -0
  5. pyams_utils/__pycache__/cache.cpython-35.pyc +0 -0
  6. pyams_utils/__pycache__/container.cpython-35.pyc +0 -0
  7. pyams_utils/__pycache__/context.cpython-35.pyc +0 -0
  8. pyams_utils/__pycache__/data.cpython-35.pyc +0 -0
  9. pyams_utils/__pycache__/date.cpython-35.pyc +0 -0
  10. pyams_utils/__pycache__/decorator.cpython-35.pyc +0 -0
  11. pyams_utils/__pycache__/dict.cpython-35.pyc +0 -0
  12. pyams_utils/__pycache__/encoding.cpython-35.pyc +0 -0
  13. pyams_utils/__pycache__/factory.cpython-35.pyc +0 -0
  14. pyams_utils/__pycache__/fanstatic.cpython-35.pyc +0 -0
  15. pyams_utils/__pycache__/html.cpython-35.pyc +0 -0
  16. pyams_utils/__pycache__/i18n.cpython-35.pyc +0 -0
  17. pyams_utils/__pycache__/include.cpython-35.pyc +0 -0
  18. pyams_utils/__pycache__/inherit.cpython-35.pyc +0 -0
  19. pyams_utils/__pycache__/intids.cpython-35.pyc +0 -0
  20. pyams_utils/__pycache__/json.cpython-35.pyc +0 -0
  21. pyams_utils/__pycache__/list.cpython-35.pyc +0 -0
  22. pyams_utils/__pycache__/lock.cpython-35.pyc +0 -0
  23. pyams_utils/__pycache__/progress.cpython-35.pyc +0 -0
  24. pyams_utils/__pycache__/property.cpython-35.pyc +0 -0
  25. pyams_utils/__pycache__/pygments.cpython-35.pyc +0 -0
  26. pyams_utils/__pycache__/registry.cpython-35.pyc +0 -0
  27. pyams_utils/__pycache__/request.cpython-35.pyc +0 -0
  28. pyams_utils/__pycache__/schema.cpython-35.pyc +0 -0
  29. pyams_utils/__pycache__/session.cpython-35.pyc +0 -0
  30. pyams_utils/__pycache__/size.cpython-35.pyc +0 -0
  31. pyams_utils/__pycache__/tales.cpython-35.pyc +0 -0
  32. pyams_utils/__pycache__/testing.cpython-35.pyc +0 -0
  33. pyams_utils/__pycache__/text.cpython-35.pyc +0 -0
  34. pyams_utils/__pycache__/traversing.cpython-35.pyc +0 -0
  35. pyams_utils/__pycache__/unicode.cpython-35.pyc +0 -0
  36. pyams_utils/__pycache__/url.cpython-35.pyc +0 -0
  37. pyams_utils/__pycache__/vocabulary.cpython-35.pyc +0 -0
  38. pyams_utils/__pycache__/wsgi.cpython-35.pyc +0 -0
  39. pyams_utils/__pycache__/zodb.cpython-35.pyc +0 -0
  40. pyams_utils/doctests/wsgi.rst +16 -0
  41. pyams_utils/interfaces/__pycache__/__init__.cpython-35.pyc +0 -0
  42. pyams_utils/interfaces/__pycache__/data.cpython-35.pyc +0 -0
  43. pyams_utils/interfaces/__pycache__/form.cpython-35.pyc +0 -0
  44. pyams_utils/interfaces/__pycache__/inherit.cpython-35.pyc +0 -0
  45. pyams_utils/interfaces/__pycache__/intids.cpython-35.pyc +0 -0
  46. pyams_utils/interfaces/__pycache__/pygments.cpython-35.pyc +0 -0
  47. pyams_utils/interfaces/__pycache__/size.cpython-35.pyc +0 -0
  48. pyams_utils/interfaces/__pycache__/tales.cpython-35.pyc +0 -0
  49. pyams_utils/interfaces/__pycache__/text.cpython-35.pyc +0 -0
  50. pyams_utils/interfaces/__pycache__/timezone.cpython-35.pyc +0 -0
  51. pyams_utils/interfaces/__pycache__/traversing.cpython-35.pyc +0 -0
  52. pyams_utils/interfaces/__pycache__/tree.cpython-35.pyc +0 -0
  53. pyams_utils/interfaces/__pycache__/url.cpython-35.pyc +0 -0
  54. pyams_utils/interfaces/__pycache__/zeo.cpython-35.pyc +0 -0
  55. pyams_utils/protocol/__pycache__/__init__.cpython-35.pyc +0 -0
  56. pyams_utils/protocol/__pycache__/http.cpython-35.pyc +0 -0
  57. pyams_utils/protocol/__pycache__/tcp.cpython-35.pyc +0 -0
  58. pyams_utils/protocol/__pycache__/xmlrpc.cpython-35.pyc +0 -0
  59. pyams_utils/tests/__pycache__/__init__.cpython-35.pyc +0 -0
  60. pyams_utils/tests/__pycache__/test_utilsdocs.cpython-35.pyc +0 -0
  61. pyams_utils/tests/__pycache__/test_utilsdocstrings.cpython-35.pyc +0 -0
  62. pyams_utils/timezone/__pycache__/__init__.cpython-35.pyc +0 -0
  63. pyams_utils/timezone/__pycache__/utility.cpython-35.pyc +0 -0
  64. pyams_utils/timezone/__pycache__/vocabulary.cpython-35.pyc +0 -0
  65. pyams_utils/wsgi.py +4 -2
EGG-INFO/PKG-INFO CHANGED
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyams-utils
3
- Version: 1.3.5
3
+ Version: 1.3.7
4
4
  Summary: PyAMS generic modules
5
5
  Home-page: https://pyams.readthedocs.io
6
6
  Author: Thierry Florac
@@ -48,6 +48,14 @@ Description: ===================
48
48
  Changelog
49
49
  =========
50
50
 
51
+ 1.3.7
52
+ -----
53
+ - updated Travis configuration
54
+
55
+ 1.3.6
56
+ -----
57
+ - updated WSGI environment decorator to prevent storing null values into request environment
58
+
51
59
  1.3.5
52
60
  -----
53
61
  - updated request's WSGI property decorator to be able to handle caching functions with
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -17,6 +17,11 @@ The "wsgi_environ_cache" can be used to cache a method result into request envir
17
17
  ... def get_value(self, request):
18
18
  ... pprint.pprint("Getting value...")
19
19
  ... return 1
20
+ ...
21
+ ... @wsgi_environ_cache('MyKey 2', store_none=False)
22
+ ... def get_other_value(self, request):
23
+ ... pprint.pprint("Getting second value...")
24
+ ... return None
20
25
 
21
26
  >>> request = DummyRequest()
22
27
 
@@ -31,6 +36,17 @@ The "wsgi_environ_cache" can be used to cache a method result into request envir
31
36
  >>> request.environ.get('MyKey')
32
37
  1
33
38
 
39
+ >>> utility.get_other_value(request) is None
40
+ 'Getting second value...'
41
+ True
42
+
43
+ >>> utility.get_other_value(request) is None
44
+ 'Getting second value...'
45
+ True
46
+
47
+ >>> request.environ.get('MyKey 2') is None
48
+ True
49
+
34
50
 
35
51
  Tests cleanup:
36
52
 
pyams_utils/wsgi.py CHANGED
@@ -18,11 +18,12 @@ This module provides a method decorator which can store it's value into request
18
18
  __docformat__ = 'restructuredtext'
19
19
 
20
20
 
21
- def wsgi_environ_cache(*names):
21
+ def wsgi_environ_cache(*names, store_none=True):
22
22
  """Wrap a function/method to cache its result for call into request.environ
23
23
 
24
24
  :param [string...] names: keys to cache into environ; len(names) must
25
25
  be equal to the result's length or scalar
26
+ :param bool store_none: if False, None values are not stored into request environment
26
27
  """
27
28
 
28
29
  def decorator(func):
@@ -41,7 +42,8 @@ def wsgi_environ_cache(*names):
41
42
  if scalar:
42
43
  env = [env, ]
43
44
  for idx, cached_key in enumerate(names):
44
- request.environ['{}{}'.format(cached_key, args_key)] = env[idx]
45
+ if store_none or (env[idx] is not None):
46
+ request.environ['{}{}'.format(cached_key, args_key)] = env[idx]
45
47
  return env[0] if scalar else env
46
48
 
47
49
  return function_wrapper