Changeset 262

Show
Ignore:
Timestamp:
08/25/08 18:14:07 (3 months ago)
Author:
akaihola
Message:

[threadedtopics] Added a bit of validation.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/threadedtopics/templatetags/threadedtopicstags.py

    r206 r262  
    122122        get_dict = self.get_dict.resolve(context) 
    123123        get_param_name = self.get_param_name.resolve(context) 
    124         topic_id_strings = get_dict.getlist(get_param_name) 
     124 
     125        # validate topic IDs: only integers and 'add' allowed 
     126        topic_id_strings = [s for s in get_dict.getlist(get_param_name) 
     127                            if s.isdigit() or s == 'add'] 
     128 
    125129        context[self.add_open_varname] = 'add' in topic_id_strings 
    126130        topic_ids = [int(s) for s in topic_id_strings if s and s != 'add']