Projet

Général

Profil

Development #36808

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

Ajouté par Nicolas Roche il y a plus de 4 ans. Mis à jour il y a plus de 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
09 octobre 2019
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

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>

Fichiers

Révisions associées

Révision e7e34cd4 (diff)
Ajouté par Nicolas Roche il y a plus de 4 ans

datasources: return 404 on unknown datasource (#36808)

Historique

#1

Mis à jour par Nicolas Roche il y a plus de 4 ans

#2

Mis à jour par Thomas Noël il y a plus de 4 ans

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

#4

Mis à jour par Thomas Noël il y a plus de 4 ans

  • Statut changé de Solution proposée à Solution validée
#5

Mis à jour par Nicolas Roche il y a plus de 4 ans

  • Lié à Bug #18431: comportement quand une source de données n'existe pas/plus ajouté
#6

Mis à jour par Nicolas Roche il y a plus de 4 ans

  • Lié à Bug #18431: comportement quand une source de données n'existe pas/plus supprimé
#7

Mis à jour par Nicolas Roche il y a plus de 4 ans

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

Mis à jour par Nicolas Roche il y a plus de 4 ans

  • Statut changé de Solution validée à 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

Mis à jour par Frédéric Péters il y a plus de 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF