| 1 | # vim: expandtab tabstop=4 |
|---|
| 2 | from StringIO import StringIO |
|---|
| 3 | import re |
|---|
| 4 | import string |
|---|
| 5 | from trac import WikiFormatter |
|---|
| 6 | from trac.WikiFormatter import CommonFormatter |
|---|
| 7 | |
|---|
| 8 | def execute(hdf, args, env): |
|---|
| 9 | db = env.get_db_cnx() |
|---|
| 10 | out = StringIO() |
|---|
| 11 | fmt = CommonFormatter(hdf, env, db) |
|---|
| 12 | if args: |
|---|
| 13 | link = fmt._expand_module_link(args) |
|---|
| 14 | if link[0] != None: |
|---|
| 15 | # out.write("<tt>"); |
|---|
| 16 | # out.write(link[0]); |
|---|
| 17 | # out.write("</tt>"); |
|---|
| 18 | out.write("<script language=\"JavaScript\">\n") |
|---|
| 19 | out.write("document.location=\"") |
|---|
| 20 | out.write(link[0]) |
|---|
| 21 | out.write("\";\n") |
|---|
| 22 | out.write("</script>") |
|---|
| 23 | return out.getvalue() |
|---|
| 24 | else: |
|---|
| 25 | out.write('<div class="system-message"><strong>Error: Redirection target not found.</strong></div>') |
|---|
| 26 | else: |
|---|
| 27 | out.write('<div class="system-message"><strong>Error: Missing redirection URL.</strong></div>') |
|---|