Skip to content

Commit

Permalink
fixing list vaidation
Browse files Browse the repository at this point in the history
  • Loading branch information
thingsplode committed Sep 9, 2018
1 parent 9a79fb2 commit cb3de3e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
## What is Appkernel?
A REST API framework, which enables micro-service development from zero to production within minutes (no kidding: literally within minutes).

**It provides data serialisation, transformation, validation, security, ORM, RPC and service mash functions out of the box.** ([Check out the roadmap for more details](docs/roadmap.md))
**It provides data serialisation, transformation, validation, security, ORM, RPC and service mash functions out of the box** ([check out the roadmap for more details](docs/roadmap.md)).
- [Full documentation on Read The Docs](http://appkernel.readthedocs.io/en/latest/)

**Give a vote** on [awesome-python](https://github.com/vinta/awesome-python/pull/1103) if you like the project, so it gets added to the list of RESTful python frameworks. **Only 16 more votes are missing :)**
**Give a vote on [awesome-python](https://github.com/vinta/awesome-python/pull/1103)** if you like the project, so it gets added to the list of RESTful python frameworks. **Only 16 more votes are missing :)**

## Installation

Expand Down
9 changes: 2 additions & 7 deletions appkernel/generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ def from_wire_format(self, wire_value):

class MongoDateTimeMarshaller(Marshaller):

def to_wireformat(self, instance_value):
def to_wireformat(self, instance_value: date):
if isinstance(instance_value, date):
return datetime.combine(instance_value, dtime.min)
else:
return instance_value

def from_wire_format(self, wire_value):
def from_wire_format(self, wire_value: datetime):
if isinstance(wire_value, datetime):
return wire_value.date()
else:
Expand All @@ -56,11 +56,6 @@ def date_now_generator():
return datetime.now()


def current_user_generator():
# todo: finalise this
return ''


def content_hasher(rounds=20000, salt_size=16):
def hash_content(password):
# type: (str) -> str
Expand Down
13 changes: 13 additions & 0 deletions tests/test_generators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from datetime import date

from appkernel.generators import MongoDateTimeMarshaller


def test_mongo_date_time_marshaller():
marshaler = MongoDateTimeMarshaller()
result = marshaler.to_wireformat(date.today())
print(f'result: {type(result)}/{result}')
assert isinstance(result, date)
result = marshaler.to_wireformat('raw text')
print(f'result: {type(result)}/{result}')
assert isinstance(result, str)

0 comments on commit cb3de3e

Please sign in to comment.