Download:
child 106:807d12ac771c
parent 104:28caf44e903a
105:a0b4b59d86d5
Anton Shestakov <av6@dwimlabs.net>, Wed, 20 Jul 2016 19:04:15 +0800
crud: use dict comprehension instead of dict() with generator expression

1 файлов изменено, 4 вставок(+), 1 удалений(-) [+]
fruitbar/crud.py file | annotate | diff | comparison | revisions
--- a/fruitbar/crud.py Wed Jul 20 18:56:30 2016 +0800
+++ b/fruitbar/crud.py Wed Jul 20 19:04:15 2016 +0800
@@ -60,7 +60,10 @@
except (RecordNotFound, RecordDeleted):
return '', 404
- userdata = dict((k, v) for (k, v) in request.json.items() if k in self.safe_fields)
+ userdata = {
+ k: v for k, v in request.json.items()
+ if k in self.safe_fields
+ }
doc.update(userdata)
response = g.db.update(doc)