Projet

Général

Profil

0001-minimal-flag-in-formdef-category-substitutions.patch

Thomas Noël, 03 mars 2014 18:32

Télécharger (2,26 ko)

Voir les différences:

Subject: [PATCH] "minimal" flag in formdef & category substitutions

we don't want category details on formdata substitution variables:
propagate the "minimal" flag to formdef.get_substitution_variables, so
to category.get_substitution_variables.
 wcs/categories.py | 9 ++++++---
 wcs/formdata.py   | 2 +-
 wcs/formdef.py    | 4 ++--
 3 files changed, 9 insertions(+), 6 deletions(-)
wcs/categories.py
74 74
            form.store()
75 75
        StorableObject.remove_self(self)
76 76

  
77
    def get_substitution_variables(self):
77
    def get_substitution_variables(self, minimal=False):
78 78
        d = {
79
            'category': self,
80 79
            'category_name': self.name,
81
            'category_description': self.description,
82 80
            'category_id': self.url_name,
83 81
        }
82
        if not minimal:
83
            d.update({
84
                'category': self,
85
                'category_description': self.description,
86
            })
84 87
        return d
85 88

  
86 89
    def get_url(self):
wcs/formdata.py
335 335
        d['form_status'] = self.get_status_label()
336 336

  
337 337
        # formdef and category variables
338
        d.update(self.formdef.get_substitution_variables())
338
        d.update(self.formdef.get_substitution_variables(minimal=minimal))
339 339

  
340 340
        if minimal:
341 341
            d = copy.deepcopy(d)
wcs/formdef.py
564 564

  
565 565
        return text
566 566

  
567
    def get_substitution_variables(self):
567
    def get_substitution_variables(self, minimal=False):
568 568
        d = {
569 569
            'form_name': self.name,
570 570
        }
571 571
        if self.category:
572
            d.update(self.category.get_substitution_variables())
572
            d.update(self.category.get_substitution_variables(minimal=minimal))
573 573
        return d
574 574

  
575 575

  
576
-