Hi, I whipped up a little macro to allow including external http files.
I had some style questions wrt to the macros. Hopefully someone w/
some more experience might be able to help out?
* Am I using the txt properly for arguments? Are these parsed into an
array if there are multiple arguments?
* What's the preferred way to throw errors in Trac? (obviously not how
I have it coded)
def execute(hdf, txt, env):
args = txt or ''
if args:
import urllib
f = urllib.urlopen(args)
return f.read()
else:
return '<span class="error">The include macro requires an
argument</span>'
I had some style questions wrt to the macros. Hopefully someone w/
some more experience might be able to help out?
* Am I using the txt properly for arguments? Are these parsed into an
array if there are multiple arguments?
* What's the preferred way to throw errors in Trac? (obviously not how
I have it coded)
def execute(hdf, txt, env):
args = txt or ''
if args:
import urllib
f = urllib.urlopen(args)
return f.read()
else:
return '<span class="error">The include macro requires an
argument</span>'