Ticket #914: admin_modify-mr.py.patch

File admin_modify-mr.py.patch, 888 bytes (added by gandalf@…, 19 years ago)

updated patch for magic-removal

  • admin_modify.py

     
    1818    return '_'.join([s.lower() for s in word_re.findall(name)[:-1]])
    1919
    2020def include_admin_script(script_path):
    21     return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path)
     21    url_pattern = (r'''(?x)((http|https|ftp)://(\w+[:.]?){2,}(/?|[^ \n\r"']+[\w/!?.=#])(?=[\s\.,>)"'\]]))''')
     22    if re.match(url_pattern, script_path) or script_path[0] == '/':
     23        return '<script type="text/javascript" src="%s"></script>' % (script_path)
     24    else:
     25        return '<script type="text/javascript" src="%s%s"></script>' % (settings.ADMIN_MEDIA_PREFIX, script_path)
    2226include_admin_script = register.simple_tag(include_admin_script)
    2327
    2428def submit_row(context):
Back to Top