navigator-session 0.6.5__py3-none-any.whl → 0.8.0__py3-none-any.whl

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.
navigator_session/data.py CHANGED
@@ -12,6 +12,11 @@ from .conf import (
12
12
  SESSION_ID,
13
13
  SESSION_STORAGE
14
14
  )
15
+ try:
16
+ from pydantic import BaseModel as PydanticBaseModel
17
+ except ImportError:
18
+ PydanticBaseModel = None
19
+
15
20
 
16
21
  class ModelHandler(jsonpickle.handlers.BaseHandler):
17
22
  """ModelHandler.
@@ -30,6 +35,25 @@ class ModelHandler(jsonpickle.handlers.BaseHandler):
30
35
 
31
36
  jsonpickle.handlers.registry.register(BaseModel, ModelHandler, base=True)
32
37
 
38
+ if PydanticBaseModel:
39
+ class PydanticHandler(jsonpickle.handlers.BaseHandler):
40
+ """PydanticHandler.
41
+ This class can handle with serializable Pydantic Models.
42
+ """
43
+ def flatten(self, obj, data):
44
+ data['__dict__'] = self.context.flatten(obj.__dict__, reset=False)
45
+ return data
46
+
47
+ def restore(self, obj):
48
+ module_and_type = obj['py/object']
49
+ mdl = loadclass(module_and_type)
50
+ cls = mdl.__new__(mdl) if hasattr(mdl, '__new__') else object.__new__(mdl)
51
+ cls.__dict__ = self.context.restore(obj['__dict__'], reset=False)
52
+ return cls
53
+
54
+ jsonpickle.handlers.registry.register(PydanticBaseModel, PydanticHandler, base=True)
55
+
56
+
33
57
  class SessionData(MutableMapping[str, Any]):
34
58
  """Session dict-like object.
35
59
  """
@@ -6,7 +6,7 @@ __description__ = (
6
6
  'Navigator Session allows us to store user-specific data '
7
7
  'into session object.'
8
8
  )
9
- __version__ = '0.6.5'
9
+ __version__ = '0.8.0'
10
10
  __copyright__ = 'Copyright (c) 2023 Jesus Lara'
11
11
  __author__ = 'Jesus Lara'
12
12
  __author_email__ = 'jesuslarag@gmail.com'
@@ -1,18 +1,16 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: navigator-session
3
- Version: 0.6.5
3
+ Version: 0.8.0
4
4
  Summary: Navigator Session allows us to store user-specific data into session object.
5
- Home-page: https://github.com/phenobarbital/navigator-session
6
- Author: Jesus Lara
7
- Author-email: jesuslarag@gmail.com
8
- License: Apache-2.0
5
+ Author-email: Jesus Lara Gimenez <jesuslarag@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/phenobarbital/navigator-session
9
8
  Project-URL: Source, https://github.com/phenobarbital/navigator-session
10
9
  Project-URL: Funding, https://paypal.me/phenobarbital
11
- Project-URL: Say Thanks!, https://saythanks.io/to/phenobarbital
12
- Keywords: asyncio,session,aioredis,aiohttp
13
- Platform: POSIX
10
+ Project-URL: Documentation, https://github.com/phenobarbital/navigator-session
14
11
  Classifier: Development Status :: 4 - Beta
15
12
  Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
16
14
  Classifier: Operating System :: POSIX :: Linux
17
15
  Classifier: Environment :: Web Environment
18
16
  Classifier: Topic :: Software Development :: Build Tools
@@ -33,6 +31,7 @@ Requires-Dist: jsonpickle>=3.0.2
33
31
  Requires-Dist: redis>=5.0.4
34
32
  Requires-Dist: python-datamodel>=0.7.0
35
33
  Requires-Dist: navconfig[default]>=1.7.0
34
+ Dynamic: license-file
36
35
 
37
36
  # Navigator_Session #
38
37
 
@@ -1,15 +1,15 @@
1
1
  navigator_session/__init__.py,sha256=U1MtM30ccs5N6c_lzUYFRS5NURz6kheDC8jZmRL_2yc,3056
2
2
  navigator_session/conf.py,sha256=Pe8qsukmt5cXXPc3hwFphSWF5xCIpZfeFQ8JhICEnow,1695
3
- navigator_session/data.py,sha256=z4OULrvzA7Y8x25O7AQBXJ5dywJKxjgkiWGFj6MhKBA,5867
3
+ navigator_session/data.py,sha256=Mcsu95sXLTDMJbJ_QmI-fp8gBkFJqIfg-bpCKL_UMkw,6711
4
4
  navigator_session/middleware.py,sha256=_bQKfD81BxNZTGuyGTc4yh7y1Rb95I-y2hM1ihE4wCk,1944
5
5
  navigator_session/session.py,sha256=CG-TjsmQqjuk6N7GCYNgQTCkrXptgq-swHDiemgHmKI,2398
6
- navigator_session/version.py,sha256=_lz3nFH2sOLT6lmg_SpS7MED5vFJ_sC3Cd-UyeUKwBA,430
6
+ navigator_session/version.py,sha256=sG88AbAgbH8l9aRo5I849Lg-2dutyjDExTSNa_nSCQY,430
7
7
  navigator_session/storages/__init__.py,sha256=kTcHfqps5LmnDpFAktxevPuSIwRbnrcMmB7Uygq4axQ,34
8
8
  navigator_session/storages/abstract.py,sha256=wTv0yWMVXTwrzA_bjexcwI7c6_W3tzosXlMOIZIQrBM,6503
9
9
  navigator_session/storages/cookie.py,sha256=VILzVCatKlDhMoQDoE2y0u6s7lp4wbdep5Oc0NfIJcg,2474
10
10
  navigator_session/storages/redis.py,sha256=mqSRyb0YOgV8gvNiAuPhYCLA0fCOgZsQlqOUWE85Gss,11528
11
- navigator_session-0.6.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
- navigator_session-0.6.5.dist-info/METADATA,sha256=nxnUT6YaVqxR59bC5WX70oK0tMZoOHDODFejs3-mLRg,2302
13
- navigator_session-0.6.5.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
14
- navigator_session-0.6.5.dist-info/top_level.txt,sha256=ZpOEy3wLKGsxG2rc0nHqcqJCV3HIOG_XCfE6mtsYYYY,18
15
- navigator_session-0.6.5.dist-info/RECORD,,
11
+ navigator_session-0.8.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
12
+ navigator_session-0.8.0.dist-info/METADATA,sha256=83Y_us-KaI51tgkmJvMx80kEEEd1FEXfgwCFjabmLzk,2360
13
+ navigator_session-0.8.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
14
+ navigator_session-0.8.0.dist-info/top_level.txt,sha256=ZpOEy3wLKGsxG2rc0nHqcqJCV3HIOG_XCfE6mtsYYYY,18
15
+ navigator_session-0.8.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.0.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5