Ticket #486: template-args-fix.patch

File template-args-fix.patch, 1021 bytes (added by Simon Willison, 19 years ago)

Fix for argimunt bug in template system

  • template.py

     
    295295            if registered_filters[filter_name][1] == True and arg is None:
    296296                raise TemplateSyntaxError, "Filter '%s' requires an argument" % filter_name
    297297            if registered_filters[filter_name][1] == False and arg is not None:
    298                 raise TemplateSyntaxError, "Filter '%s' should not have an argument" % filter_name
     298                raise TemplateSyntaxError, "Filter '%s' should not have an argument (argument is '%s')" % (filter_name, arg)
    299299            self.filters.append((filter_name, arg))
    300300            if self.current is None:
    301301                break
    302302
    303303    def read_filter(self):
    304304        self.current_filter_name = self.read_alphanumeric_token()
     305        self.current_filter_arg = None
    305306        # Have we reached the end?
    306307        if self.current is None:
    307308            return (self.current_filter_name, None)
Back to Top