-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
J'ai une ressource :
class MyCategory(Category):
# Views
new_resources = AutoAddQuand je vais sur la vue sans préciser le type de resource à créer dans l'url j'ai un tracback :
/mycategory/;new_resources
Et le traceback :
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/itools/web/router.py", line 219, in handle_request
context.query = view.get_query(context)
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/itools/web/views.py", line 150, in get_query
schema = self.get_query_schema()
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/ikaaro/autoadd.py", line 159, in get_query_schema
schema = self.get_schema(resource, context)
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/ikaaro/autoadd.py", line 172, in get_schema
for name in self.get_fields():
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/ikaaro/autoadd.py", line 95, in get_fields
cls = self._resource_class
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/itools/core/prototypes.py", line 170, in __get__
value = self.meth(owner)
File "/home/bepatient/projects/localhost/api/local/lib/python2.7/site-packages/ikaaro/autoadd.py", line 127, in _resource_class
class_id = context.query['type']
KeyError: 'type'
Par contre si j'ajoute le type en paramètre pas de problèmes :
/mycategory/;new_resources?type=ma-resources
ça serait cool d'avoir un fallback du style sur j'ai pas le paramètre type dans mon url alors je récupère la première valeur du get_document_types de la ressources.
Metadata
Metadata
Assignees
Labels
No labels