Projet

Général

Profil

Development #73951

after job import csv, 'NoneType' object has no attribute 'jsonp_display_values'

Ajouté par Frédéric Péters il y a environ un an. Mis à jour il y a 11 mois.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
28 janvier 2023
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non

Description

## Démarches en ligne - Toulouse Métropole [ PREPROD ] ##

Exception:
  type = '<class 'AttributeError'>', value = ''NoneType' object has no attribute 'jsonp_display_values''

Stack trace (most recent call first):
  File "/usr/lib/python3/dist-packages/wcs/fields.py", line 2306, in get_display_value
  2304 
  2305         if data_source.type == 'jsonp':
> 2306             if not get_session().jsonp_display_values:
  2307                 get_session().jsonp_display_values = {}
  2308             return get_session().jsonp_display_values.get('%s_%s' % (data_source.get_jsonp_url(), value))

  locals: 
     data_source = <NamedDataSource 'Communes' id:3>
     self = <ItemField 4 'Commune'>
     value = 'TOULOUSE'

  File "/usr/lib/python3/dist-packages/wcs/fields.py", line 2416, in store_display_value
  2414                 return display_value
  2415         with get_publisher().with_language('default'):
> 2416             return self.get_display_value(value)
  2417 
  2418     def store_structured_value(self, data, field_id, raise_on_error=False):

  locals: 
     data = {'3': 'AMAURY', '4': 'TOULOUSE'}
     data_source = <NamedDataSource 'Communes' id:3>
     field_id = '4'
     raise_on_error = False
     self = <ItemField 4 'Commune'>
     value = 'TOULOUSE'

  File "/usr/lib/python3/dist-packages/wcs/fields.py", line 678, in set_value
   676         data['%s' % self.id] = value
   677         if self.store_display_value:
>  678             display_value = self.store_display_value(data, self.id)
   679             if raise_on_error and display_value is None:
   680                 raise SetValueError('a datasource is unavailable')

  locals: 
     data = {'3': 'AMAURY', '4': 'TOULOUSE'}
     raise_on_error = False
     self = <ItemField 4 'Commune'>
     value = 'TOULOUSE'

  File "/usr/lib/python3/dist-packages/wcs/backoffice/data_management.py", line 428, in execute
   426                 if field.convert_value_from_str is None:
   427                     continue
>  428                 field.set_value(data_instance.data, field.convert_value_from_str(value))
   429 
   430             user_value = data_instance.data.pop('_user', None)

  locals: 
     carddata_class = <class 'wcs.carddef._wcs_Sites-Composteurs-Collectif'>
     carddef_fields = [<StringField 3 'Nom site'>, <ItemField 4 'Commune'>, <StringField 11 'Voie'>, <StringField 12 'Numéro voie'>]
     csv_line = ['AMAURY', 'TOULOUSE', 'RUE Pierre Brossolette       ', '12']
     data_instance = <_wcs_Sites-Composteurs-Collectif 'Sites composteurs collectif - n°None' id:None>
     field = <ItemField 4 'Commune'>
     i = 1
     self = <ImportFromCsvAfterJob id:e4e04985-2671-4c0c-a34e-a6f95c426eca>
     value = 'TOULOUSE'

  File "/usr/lib/python3/dist-packages/wcs/qommon/afterjobs.py", line 129, in run
   127             if getattr(self, 'raise_exception', False):
   128                 raise
>  129             get_publisher().record_error(exception=e, notify=True)
   130             self.exception = traceback.format_exc()
   131             self.status = N_('failed')

  locals: 
     e = AttributeError("'NoneType' object has no attribute 'jsonp_display_values'")
     self = <ImportFromCsvAfterJob id:e4e04985-2671-4c0c-a34e-a6f95c426eca>
     spool = False

  File "/usr/lib/python3/dist-packages/wcs/ctl/management/commands/runjob.py", line 43, in handle
    41             job.completion_time = None
    42         job.raise_exception = options.get('raise')
>   43         job.run()

  locals: 
     args = ()
     domain = 'demarches-tm.test.entrouvert.org'
     job = <ImportFromCsvAfterJob id:e4e04985-2671-4c0c-a34e-a6f95c426eca>
     options = {'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'force_color': False, 'job_id': 'e4e04985-2671-4c0c-a34e-a6f95c426eca', 'force_replay': False, 'raise': False}
     self = <wcs.ctl.management.commands.runjob.Command object at 0x7fe3cd04cfd0>

  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 364, in execute
   362         if self.requires_migrations_checks:
   363             self.check_migrations()
>  364         output = self.handle(*args, **options)
   365         if output:
   366             if self.output_transaction:

  locals: 
     args = ()
     options = {'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'force_color': False, 'domain': 'demarches-tm.test.entrouvert.org', 'job_id': 'e4e04985-2671-4c0c-a34e-a6f95c426eca', 'force_replay': False, 'raise': False}
     self = <wcs.ctl.management.commands.runjob.Command object at 0x7fe3cd04cfd0>

  File "/usr/lib/python3/dist-packages/wcs/ctl/management/commands/__init__.py", line 32, in execute
    30             # are not left lingering.
    31             get_publisher().cleanup()
>   32         return super().execute(*args, **kwargs)
    33 
    34     def init_tenant_publisher(self, domain, **kwargs):

  locals: 
     __class__ = <class 'wcs.ctl.management.commands.TenantCommand'>
     args = ()
     kwargs = {'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'force_color': False, 'domain': 'demarches-tm.test.entrouvert.org', 'job_id': 'e4e04985-2671-4c0c-a34e-a6f95c426eca', 'force_replay': False, 'raise': False}
     self = <wcs.ctl.management.commands.runjob.Command object at 0x7fe3cd04cfd0>

  File "/usr/lib/python3/dist-packages/django/core/management/base.py", line 323, in run_from_argv
   321         handle_default_options(options)
   322         try:
>  323             self.execute(*args, **cmd_options)
   324         except Exception as e:
   325             if options.traceback or not isinstance(e, CommandError):

  locals: 
     args = ()
     argv = ['/usr/lib/wcs/manage.py', 'runjob', '--domain', 'demarches-tm.test.entrouvert.org', '--job-id', 'e4e04985-2671-4c0c-a34e-a6f95c426eca']
     cmd_options = {'verbosity': 1, 'settings': None, 'pythonpath': None, 'traceback': False, 'no_color': False, 'force_color': False, 'domain': 'demarches-tm.test.entrouvert.org', 'job_id': 'e4e04985-2671-4c0c-a34e-a6f95c426eca', 'force_replay': False, 'raise': False}
     options = Namespace(verbosity=1, settings=None, pythonpath=None, traceback=False, no_color=False, force_color=False, domain='demarches-tm.test.entrouvert.org', job_id='e4e04985-2671-4c0c-a34e-a6f95c426eca', force_replay=False, raise=False)
     parser = CommandParser(prog='manage.py runjob', usage=None, description=None, formatter_class=<class 'django.core.management.base.DjangoHelpFormatter'>, conflict_handler='error', add_help=True)
     self = <wcs.ctl.management.commands.runjob.Command object at 0x7fe3cd04cfd0>

  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 375, in execute
   373             sys.stdout.write(self.main_help_text() + '\n')
   374         else:
>  375             self.fetch_command(subcommand).run_from_argv(self.argv)
   376 
   377 

  locals: 
     args = ['--domain', '--job-id', 'e4e04985-2671-4c0c-a34e-a6f95c426eca']
     options = Namespace(settings=None, pythonpath=None, args=['demarches-tm.test.entrouvert.org'])
     parser = CommandParser(prog='manage.py', usage='%(prog)s subcommand [options] [args]', description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=False)
     self = <django.core.management.ManagementUtility object at 0x7fe3d44ee490>
     subcommand = 'runjob'

  File "/usr/lib/python3/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
   379     """Run a ManagementUtility.""" 
   380     utility = ManagementUtility(argv)
>  381     utility.execute()

  locals: 
     argv = ['/usr/lib/wcs/manage.py', 'runjob', '--domain', 'demarches-tm.test.entrouvert.org', '--job-id', 'e4e04985-2671-4c0c-a34e-a6f95c426eca']
     utility = <django.core.management.ManagementUtility object at 0x7fe3d44ee490>

  File "/usr/lib/wcs/manage.py", line 10, in <module>
     8     from django.core.management import execute_from_command_line
     9 
>   10     execute_from_command_line(sys.argv)

  locals: 
     __annotations__ = {}
     __builtins__ = <module 'builtins' (built-in)>
     __cached__ = None
     __doc__ = None
     __file__ = '/usr/lib/wcs/manage.py'
     __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x7fe3d45d9b80>
     __name__ = '__main__'
     __package__ = None
     __spec__ = None
     execute_from_command_line = <function execute_from_command_line at 0x7fe3d40e6280>
     os = <module 'os' from '/usr/lib/python3.9/os.py'>
     sys = <module 'sys' (built-in)>

Révisions associées

Révision 0330eb9e (diff)
Ajouté par Frédéric Péters il y a 11 mois

misc: fix csv import of jsonp item fields (#73951)

Historique

#1

Mis à jour par Robot Gitea il y a 11 mois

  • Tracker changé de Bug à Development
  • Statut changé de Nouveau à Solution proposée
  • Assigné à mis à Frédéric Péters

Frédéric Péters (fpeters) a ouvert une pull request sur Gitea concernant cette demande :

#2

Mis à jour par Robot Gitea il y a 11 mois

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

Lauréline Guérin (lguerin) a approuvé une pull request sur Gitea concernant cette demande :

#3

Mis à jour par Robot Gitea il y a 11 mois

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

Frédéric Péters (fpeters) a mergé une pull request sur Gitea concernant cette demande :

#4

Mis à jour par Transition automatique il y a 11 mois

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

Mis à jour par Transition automatique il y a 9 mois

Automatic expiration

Formats disponibles : Atom PDF