Workout With Friends Stay fit with a little motivation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Properties
types.py
Go to the documentation of this file.
1 ##
2 #
3 # Custom SQLAlchemy types.
4 #
5
6 import json
7 from sqlalchemy.types import TypeDecorator, Unicode
8
9
10 class JSONString(TypeDecorator):
11
12 impl = Unicode
13
14 def process_bind_param(self, value, dialect):
15 if value is not None:
16 value = unicode(json.dumps(value))
17 return value
18
19 def process_result_value(self, value, dialect):
20 if value is not None:
21 value = json.loads(value)
22 return value
23