Bug #55405
custom view supprimée (?), AttributeError: 'NoneType' object has no attribute 'filters'
Début:
05 juillet 2021
Echéance:
% réalisé:
0%
Temps estimé:
Patch proposed:
Oui
Planning:
Non
Description
Exception: type = '<class 'AttributeError'>', value = ''NoneType' object has no attribute 'filters'' Stack trace (most recent call first): File "/usr/lib/python3/dist-packages/wcs/data_sources.py", line 626, in get_jsonp_url 624 custom_view = CardDef.get_data_source_custom_view(self.type) 625 had_template = False > 626 for filter_key, filter_value in custom_view.filters.items(): 627 if not Template.is_template_string(filter_value): 628 continue locals: CardDef = <class 'wcs.carddef.CardDef'> WorkflowStatusItem = <class 'wcs.workflows.WorkflowStatusItem'> custom_view = None had_template = False parts = ['carddef', 'jeunes-rsa', 'listes-des-jeunes-suivis'] self = <NamedDataSource None id:None> File "/usr/lib/python3/dist-packages/wcs/fields.py", line 1894, in perform_more_widget_changes 1892 1893 if display_mode == 'autocomplete' and data_source and data_source.can_jsonp(): > 1894 self.url = kwargs['url'] = data_source.get_jsonp_url() 1895 carddef = self.get_carddef() 1896 if ( locals: data_source = <NamedDataSource None id:None> display_mode = 'autocomplete' edit = True form = <wcs.qommon.form.Form object at 0x7f4faaee6908> kwargs = {'required': True, 'render_br': False} self = <ItemField 1 'Sélectionnez un jeune à rattacher'> File "/usr/lib/python3/dist-packages/wcs/fields.py", line 648, in add_to_form 646 if hasattr(self, k): 647 kwargs[k] = getattr(self, k) > 648 self.perform_more_widget_changes(form, kwargs) 649 if self.hint and self.hint.startswith('<'): 650 hint = htmltext(self.hint) locals: form = <wcs.qommon.form.Form object at 0x7f4faaee6908> kwargs = {'required': True, 'render_br': False} self = <ItemField 1 'Sélectionnez un jeune à rattacher'> value = None File "/usr/lib/python3/dist-packages/wcs/formdef.py", line 660, in add_fields_to_form 658 if not field.add_to_form: 659 continue > 660 widget = field.add_to_form(form, value) 661 widget.is_hidden = not (visible) 662 widget.field = field locals: displayed_fields = [<ItemField 1 'Sélectionnez un jeune à rattacher'>] field = <ItemField 1 'Sélectionnez un jeune à rattacher'> form = <wcs.qommon.form.Form object at 0x7f4faaee6908> form_data = None on_page = True page = <PageField 15 'Choisir un Jeune'> self = <FormDef "RSJ Demande de Rattachement d'un Jeune à sa structure" id:159> transient_formdata = None value = None visible = True File "/usr/lib/python3/dist-packages/wcs/formdef.py", line 611, in create_form 609 ) 610 self.add_fields_to_form( > 611 form, page=page, displayed_fields=displayed_fields, transient_formdata=transient_formdata 612 ) 613 return form locals: displayed_fields = [<ItemField 1 'Sélectionnez un jeune à rattacher'>] form = <wcs.qommon.form.Form object at 0x7f4faaee6908> page = <PageField 15 'Choisir un Jeune'> self = <FormDef "RSJ Demande de Rattachement d'un Jeune à sa structure" id:159> transient_formdata = None File "/usr/lib/python3/dist-packages/wcs/forms/root.py", line 779, in create_form 777 778 def create_form(self, *args, **kwargs): > 779 form = self.formdef.create_form(*args, **kwargs) 780 form.attrs['data-live-url'] = self.formdef.get_url() + 'live' 781 return form locals: args = (<PageField 15 'Choisir un Jeune'>, [<ItemField 1 'Sélectionnez un jeune à rattacher'>]) kwargs = {'transient_formdata': None} self = <wcs.backoffice.submission.FormFillPage object at 0x7f4faae20198> File "/usr/lib/python3/dist-packages/wcs/backoffice/submission.py", line 298, in create_form 296 297 def create_form(self, *args, **kwargs): > 298 form = super().create_form(*args, **kwargs) 299 form.attrs['data-live-url'] = self.formdef.get_backoffice_submission_url() + 'live' 300 if self.has_channel_support:
Fichiers
Révisions associées
Historique
Mis à jour par Lauréline Guérin il y a presque 3 ans
- Fichier 0001-datasource-don-t-fail-if-custom-view-does-not-exist-.patch 0001-datasource-don-t-fail-if-custom-view-does-not-exist-.patch ajouté
- Statut changé de Nouveau à Solution proposée
- Patch proposed changé de Non à Oui
Mis à jour par Frédéric Péters il y a presque 3 ans
J'ajouterais un record_error() (voire un notify), parce que sans l'exception il me semble que ça va être compliqué de trouver l'erreur quand ça arrive.
(d'un coup d'œil ça me semble un peu compliqué d'empêcher la suppression d'une vue personnalisée quand elle est ainsi utilisée, on affiche déjà un avertissement générique).
Mis à jour par Lauréline Guérin il y a presque 3 ans
- Fichier 0001-datasource-don-t-fail-if-custom-view-does-not-exist-.patch 0001-datasource-don-t-fail-if-custom-view-does-not-exist-.patch ajouté
J'ai mis notify et record à True, car comme il s'agit d'une datasource dynamique, il n'y a pas de paramétrage pour ces flags.
Mis à jour par Lauréline Guérin il y a presque 3 ans
Mis à jour par Frédéric Péters il y a presque 3 ans
- Statut changé de Solution proposée à Solution validée
Mis à jour par Lauréline Guérin il y a presque 3 ans
- Statut changé de Solution validée à Résolu (à déployer)
commit f6c363e959ecd25e61dcf1959a9341a190815789 Author: Lauréline Guérin <zebuline@entrouvert.com> Date: Tue Jul 6 09:14:09 2021 +0200 datasource: don't fail if custom view does not exist (#55405)
Mis à jour par Frédéric Péters il y a presque 3 ans
- Statut changé de Résolu (à déployer) à Solution déployée
datasource: don't fail if custom view does not exist (#55405)