| 1 |
|
|---|
| 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 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 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 |
out.write("Continue here: <a href=\"%s\">%s</a>" % (link[0], link[1])) |
|---|
| 24 |
return out.getvalue() |
|---|
| 25 |
else: |
|---|
| 26 |
out.write('<div class="system-message"><strong>Error: Redirection target not found.</strong></div>') |
|---|
| 27 |
else: |
|---|
| 28 |
out.write('<div class="system-message"><strong>Error: Missing redirection URL.</strong></div>') |
|---|
| 29 |
|
|---|