Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback sur l'AutoAdd #69

Open
poulp opened this issue May 19, 2017 · 0 comments
Open

Traceback sur l'AutoAdd #69

poulp opened this issue May 19, 2017 · 0 comments

Comments

@poulp
Copy link
Contributor

poulp commented May 19, 2017

J'ai une ressource :

class MyCategory(Category):
 
  # Views
  new_resources = AutoAdd

Quand 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant