Project

General

Profile

Development #36808

erreur 500 quand on veut éditer une source de donnée qui n'existe pas

Added by Nicolas Roche 13 days ago. Updated 7 days ago.

Status:
Solution déployée
Priority:
Normal
Assignee:
Target version:
-
Start date:
09 Oct 2019
Due date:
% Done:

0%

Patch proposed:
Yes
Planning:
No

Description

ex: https://wcs.dev.publik.love/backoffice/settings/data-sources/99/
En cette URL devrait plutôt retourner une 404.

Exception:
  type = '<type 'exceptions.KeyError'>', value = ''

Stack trace (most recent call first):
  File "/home/nroche/src/wcs/wcs/qommon/storage.py", line 393, in get_filename
   391             if ignore_errors:
   392                 return None
>  393             raise KeyError()
   394         except ImportError as e:
   395             if ignore_errors:

  locals: 
     cls = <class 'wcs.data_sources.NamedDataSource'>
     filename = '/var/lib/wcs/wcs.dev.publik.love/datasources/17'
     ignore_errors = False
     ignore_migration = False
     kwargs = {}

  File "/home/nroche/src/wcs/wcs/qommon/storage.py", line 329, in get
   327         return cls.get_filename(filename, ignore_errors=ignore_errors,
   328                                 ignore_migration=ignore_migration,
>  329                                 **kwargs)
   330 
   331     @classmethod

  locals: 
     cls = <class 'wcs.data_sources.NamedDataSource'>
     filename = '/var/lib/wcs/wcs.dev.publik.love/datasources/17'
     id = '17'
     ignore_errors = False
     ignore_migration = False
     kwargs = {}

  File "/home/nroche/src/wcs/wcs/admin/data_sources.py", line 125, in __init__
   123 
   124     def __init__(self, component):
>  125         self.datasource = NamedDataSource.get(component)
   126         self.datasource_ui = NamedDataSourceUI(self.datasource)
   127         get_response().breadcrumb.append((component + '/', self.datasource.name))

  locals: 
     component = '17'
     self = <wcs.admin.data_sources.NamedDataSourcePage object at 0x7f19fc0eb610>

  File "/home/nroche/src/wcs/wcs/admin/data_sources.py", line 271, in _q_lookup
   269 
   270     def _q_lookup(self, component):
>  271         return NamedDataSourcePage(component)

  locals: 
     component = '17'
     self = <wcs.admin.data_sources.NamedDataSourcesDirectory object at 0x7f19fd2da350>

  File "/home/nroche/envs/publik-env/local/lib/python2.7/site-packages/quixote/directory.py", line 57, in _q_traverse
    55             obj = getattr(self, name)
    56         else:
>   57             obj = self._q_lookup(component)
    58         if obj is None:
    59             raise TraversalError(private_msg=('directory %r has no component '

  locals: 
     component = '17'
     name = None
     path = ['']
     self = <wcs.admin.data_sources.NamedDataSourcesDirectory object at 0x7f19fd2da350>

  File "/home/nroche/src/wcs/wcs/admin/data_sources.py", line 225, in _q_traverse
   223     def _q_traverse(self, path):
   224         get_response().breadcrumb.append( ('data-sources/', _('Data Sources')) )
>  225         return super(NamedDataSourcesDirectory, self)._q_traverse(path)
   226 
   227     def _q_index(self):

  locals: 
     path = ['17', '']
     self = <wcs.admin.data_sources.NamedDataSourcesDirectory object at 0x7f19fd2da350>

0001-datasources-return-404-on-unknown-datasource-36808.patch View (1.92 KB) Nicolas Roche, 09 Oct 2019 03:31 PM

0001-datasources-return-404-on-unknown-datasource-36808.patch View (1.92 KB) Nicolas Roche, 09 Oct 2019 06:58 PM

Associated revisions

Revision e7e34cd4 (diff)
Added by Nicolas Roche 8 days ago

datasources: return 404 on unknown datasource (#36808)

History

#1 Updated by Nicolas Roche 13 days ago

#2 Updated by Thomas Noël 13 days ago

il reste un self.datasource = NamedDataSource.get(component) alors que tu le fais déjà dans le try

#4 Updated by Thomas Noël 13 days ago

  • Status changed from Solution proposée to Solution validée

#5 Updated by Nicolas Roche 12 days ago

  • Related to Bug #18431: comportement quand une source de données n'existe pas/plus added

#6 Updated by Nicolas Roche 11 days ago

  • Related to deleted (Bug #18431: comportement quand une source de données n'existe pas/plus)

#7 Updated by Nicolas Roche 11 days ago

J'ai lié les tickets par erreur parce que j'ai oublié que l'exception KeyError traitée ici est levée par StorableObject.get() (et non pas NamedDataSource.get_by_slug())

#8 Updated by Nicolas Roche 8 days ago

  • Status changed from Solution validée to Résolu (à déployer)
commit e7e34cd498b9a6259a2ccb1c505d817162ec3bf0
Author: Nicolas ROCHE <nroche@entrouvert.com>
Date:   Wed Oct 9 15:12:02 2019 +0200

    datasources: return 404 on unknown datasource (#36808)

#9 Updated by Frédéric Péters 7 days ago

  • Status changed from Résolu (à déployer) to Solution déployée

Also available in: Atom PDF