Skip to content

Commit b1dd251

Browse files
authored
Merge pull request #42 from octabytes/feature
bug fix in text field format
2 parents 2baf00d + eb6becd commit b1dd251

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# Versions should comply with PEP440. For a discussion on single-sourcing
1717
# the version across setup.py and the project code, see
1818
# https://packaging.python.org/en/latest/single_source_version.html
19-
version='1.2.1',
19+
version='1.2.2',
2020

2121
description="FireO ORM is specifically designed for the Google's Firestore",
2222
long_description=long_description,

src/fireo/fields/text_field.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ def db_value(self, val):
6060

6161
# override method
6262
def field_value(self, val):
63+
64+
# check if val is None then there is no need to run these functions
65+
# just return back the None value
66+
if val is None:
67+
return val
68+
6369
self.field_attribute.parse(val, run_only=['format'])
6470
if self.format_type:
6571
if self.format_type in self.supported_types:
File renamed without changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from fireo.fields import TextField
2+
from fireo.models import Model
3+
4+
5+
def test_format_with_none_value():
6+
class TextFieldFormatNone(Model):
7+
name = TextField()
8+
address = TextField(format='upper')
9+
10+
t = TextFieldFormatNone()
11+
t.name = 'name'
12+
t.save()
13+
14+
tf = TextFieldFormatNone.collection.get(t.key)\
15+
16+
assert tf.name == 'name'
17+
assert tf.address is None

0 commit comments

Comments
 (0)