comparison MoinMoin/action/AttachFile.py @ 3266:f62792cb2d24

macro.EmbedObject: adjusted to changes of argument parser, escaped output.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 16 Mar 2008 17:35:30 +0100
parents ba0707fe183d
children 65be8803b8df
comparison
equal deleted inserted replaced
3265:bd322703c85e 3266:f62792cb2d24
989 date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time 989 date = "%d-%02d-%02d %02d:%02d:%02d" % zinfo.date_time
990 request.write(wikiutil.escape("%-46s %s %12d\n" % (zinfo.filename, date, zinfo.file_size))) 990 request.write(wikiutil.escape("%-46s %s %12d\n" % (zinfo.filename, date, zinfo.file_size)))
991 request.write("</pre>") 991 request.write("</pre>")
992 return 992 return
993 993
994 # reuse class tmp from Despam to define macro 994 from MoinMoin import macro
995 from MoinMoin.action.Despam import tmp 995 from MoinMoin.parser.text import Parser
996 macro = tmp() 996
997 macro.request = request 997 macro.request = request
998 macro.formatter = request.html_formatter 998 macro.formatter = request.html_formatter
999 p = Parser("##\n", request)
1000 m = macro.Macro(p)
999 1001
1000 # use EmbedObject to view valid mime types 1002 # use EmbedObject to view valid mime types
1001 from MoinMoin.macro import EmbedObject
1002 if mt is None: 1003 if mt is None:
1003 request.write('<p>' + _("Unknown file type, cannot display this attachment inline.") + '</p>') 1004 request.write('<p>' + _("Unknown file type, cannot display this attachment inline.") + '</p>')
1004 link = (fmt.url(1, getAttachUrl(pagename, filename, request)) + 1005 link = (fmt.url(1, getAttachUrl(pagename, filename, request)) +
1005 fmt.text(filename) + 1006 fmt.text(filename) +
1006 fmt.url(0)) 1007 fmt.url(0))
1007 request.write('For using an external program follow this link %s' % link) 1008 request.write('For using an external program follow this link %s' % link)
1008 return 1009 return
1009 1010 request.write(m.execute('EmbedObject', u'target=%s, pagename=%s' % (filename, pagename)))
1010 request.write(EmbedObject.macro_EmbedObject(macro, filename, pagename=pagename))
1011 return 1011 return
1012 1012
1013 1013
1014 def _do_view(pagename, request): 1014 def _do_view(pagename, request):
1015 _ = request.getText 1015 _ = request.getText