Disabling the AttachFile action
The AttachFile action lets a page have multiple attached files.
Since file uploads could be abused for DoS (Denial of Service) attacks, AttachFile is an action that can be disabled by the wiki administrator. See Configuration of MoinMoin for details.
Creating attachments
To create a new attachment, you can either add an attachment link to any page (see below on how to do that), or click on the AttachFile link at the bottom of the page. In the first case, you will see an Upload new attachment link after saving the page. Clicking on it will lead you to the upload page, just like directly clicking on the AttachFile link.
The upload form consist of two fields. In addition to the file input there is an optional field (Rename to), used to give the file a different name than on your own computer.
Existing attachments may be viewed, downloaded, or removed, depending on the configuration of the wiki and the access rights of the user. For example, an attachment cannot be deleted if the user doesn't have the delete permission on the particular page.
Any upload or deletion of attachments is reflected on RecentChanges and thus subject to peer review. Unlike page changes, there is no history though, so keep a local copy of files so you can revert possible vandalism.
Listing and information about attachments
Two macros are defined which give information about attachments on a page. The <<AttachInfo>> macro gives a short sentence about any attachments:
There are 8 attachment(s) stored for this page.
The <<AttachList>> macro lists files attached to a page:
--> -->
OSError
[Errno 2] No such file or directory: '/var/www/CAKE/wiki/underlay/pages/HelpOnActions(2f)AttachFile/attachments/unzip6b.png'
If you want to report a bug, please save this page and attach it to your bug report.
Traceback
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/usr/lib/python2.6/site-packages/MoinMoin/request/__init__.py in run (self=<MoinMoin.request.request_cgi.Request object at 0x1110290>)
- 1309 self.page.send_page()
- 1310 else:
- 1311 handler(self.page.page_name, self)
- 1312
- 1313 # every action that didn't use to raise MoinMoinFinish must call this now:
- handler = <function do_show at 0x119fcf8>
- self = <MoinMoin.request.request_cgi.Request object at 0x1110290>
- self.page = <MoinMoin.Page.Page object at 0x12466d0>
- self.page.page_name = u'HelpOnActions/AttachFile'
/usr/lib/python2.6/site-packages/MoinMoin/action/__init__.py in do_show (pagename=u'HelpOnActions/AttachFile', request=<MoinMoin.request.request_cgi.Request object at 0x1110290>, content_only=0, count_hit=1, cacheable=1, print_mode=0)
- 251 count_hit=count_hit,
- 252 print_mode=print_mode,
- 253 content_only=content_only,
- 254 )
- 255
- content_only = 0
/usr/lib/python2.6/site-packages/MoinMoin/Page.py in send_page (self=<MoinMoin.Page.Page object at 0x124f4d0>, **keywords={'content_only': 0, 'count_hit': 1, 'print_mode': 0})
- 1198 format_args=pi['formatargs'],
- 1199 do_cache=do_cache,
- 1200 start_line=pi['lines'])
- 1201
- 1202 # check for pending footnotes
- start_line undefined
- pi = {'acl': <MoinMoin.security.AccessControlList instance at 0x1247cb0>, 'format': u'wiki', 'formatargs': u'', 'language': u'en', 'lines': 7}
/usr/lib/python2.6/site-packages/MoinMoin/Page.py in send_page_content (self=<MoinMoin.Page.Page object at 0x124f4d0>, request=<MoinMoin.request.request_cgi.Request object at 0x1110290>, body=u'== Disabling the AttachFile action ==\n\nThe `Atta...e target page must be an already existing page).\n', format=u'wiki', format_args=u'', do_cache=1, **kw={'start_line': 7})
- 1292 try:
- 1293 code = self.loadCache(request)
- 1294 self.execute(request, parser, code)
- 1295 except Exception, e:
- 1296 if not is_cache_exception(e):
- self = <MoinMoin.Page.Page object at 0x124f4d0>
- self.execute = <bound method Page.execute of <MoinMoin.Page.Page object at 0x124f4d0>>
- request = <MoinMoin.request.request_cgi.Request object at 0x1110290>
- parser = <MoinMoin.parser.text_moin_wiki.Parser instance at 0x127fd40>
- code = <code object <module> at 0x12cbf30, file "HelpOnActions/AttachFile", line 2>
/usr/lib/python2.6/site-packages/MoinMoin/Page.py in execute (self=<MoinMoin.Page.Page object at 0x124f4d0>, request=<MoinMoin.request.request_cgi.Request object at 0x1110290>, parser=<MoinMoin.parser.text_moin_wiki.Parser instance at 0x127fd40>, code=<code object <module> at 0x12cbf30, file "HelpOnActions/AttachFile", line 2>)
- 1323 __file__ = os.path.join(MoinMoin.__loader__.archive, 'dummy')
- 1324 try:
- 1325 exec code
- 1326 except "CacheNeedsUpdate": # convert the exception
- 1327 raise Exception("CacheNeedsUpdate")
- code = <code object <module> at 0x12cbf30, file "HelpOnActions/AttachFile", line 2>
/var/www/CAKE/wiki/HelpOnActions/AttachFile in
() /usr/lib/python2.6/site-packages/MoinMoin/formatter/__init__.py in macro (self=<MoinMoin.formatter.text_html.Formatter instance at 0x1247f80>, macro_obj=<MoinMoin.macro.Macro instance at 0x127fbd8>, name=u'AttachList', args=None, markup=u'<<AttachList>>')
- 308 # call the macro
- 309 try:
- 310 return macro_obj.execute(name, args)
- 311 except ImportError, err:
- 312 errmsg = unicode(err)
- macro_obj = <MoinMoin.macro.Macro instance at 0x127fbd8>
- macro_obj.execute = <bound method Macro.execute of <MoinMoin.macro.Macro instance at 0x127fbd8>>
- name = u'AttachList'
- args = None
/usr/lib/python2.6/site-packages/MoinMoin/macro/__init__.py in execute (self=<MoinMoin.macro.Macro instance at 0x127fbd8>, macro_name=u'AttachList', args=None)
- 127 else:
- 128 raise ImportError("Cannot load macro %s" % macro_name)
- 129 return execute(self, args)
- 130
- 131 def _m_lang(self, text):
- execute = <function <lambda> at 0x7f524f9b7320>
- self = <MoinMoin.macro.Macro instance at 0x127fbd8>
- args = None
/usr/lib/python2.6/site-packages/MoinMoin/macro/__init__.py in
(_self=<MoinMoin.macro.Macro instance at 0x127fbd8>, _args=None) - 114 call = wikiutil.importPlugin(self.cfg, 'macro', macro_name,
- 115 function='macro_%s' % macro_name)
- 116 execute = lambda _self, _args: _self._wrap(call, _args, [self])
- 117 except wikiutil.PluginAttributeError:
- 118 # fall back to old execute() method, no longer recommended
- execute undefined
- _self = <MoinMoin.macro.Macro instance at 0x127fbd8>
- _args = None
- _self._wrap = <bound method Macro._wrap of <MoinMoin.macro.Macro instance at 0x127fbd8>>
- call = <function macro_AttachList at 0x7f524f9b7410>
- self = <MoinMoin.macro.Macro instance at 0x127fbd8>
/usr/lib/python2.6/site-packages/MoinMoin/macro/__init__.py in _wrap (self=<MoinMoin.macro.Macro instance at 0x127fbd8>, function=<function macro_AttachList at 0x7f524f9b7410>, args=None, fixed=[<MoinMoin.macro.Macro instance at 0x127fbd8>])
- 96 try:
- 97 return wikiutil.invoke_extension_function(self.request, function,
- 98 args, fixed)
- 99 except ValueError, e:
- 100 return self.format_error(e)
- args = None
- fixed = [<MoinMoin.macro.Macro instance at 0x127fbd8>]
/usr/lib/python2.6/site-packages/MoinMoin/wikiutil.py in invoke_extension_function (request=<MoinMoin.request.request_cgi.Request object at 0x1110290>, function=<function macro_AttachList at 0x7f524f9b7410>, args=None, fixed_args=[<MoinMoin.macro.Macro instance at 0x127fbd8>])
- 2001 kwargs_to_pass.keys()[0]))
- 2002
- 2003 return function(*fixed_args, **kwargs)
- 2004
- 2005
- function = <function macro_AttachList at 0x7f524f9b7410>
- fixed_args = [<MoinMoin.macro.Macro instance at 0x127fbd8>]
- kwargs = {'mime_type': u'*', 'pagename': None}
/usr/lib/python2.6/site-packages/MoinMoin/macro/AttachList.py in macro_AttachList (macro=<MoinMoin.macro.Macro instance at 0x127fbd8>, pagename=u'HelpOnActions/AttachFile', mime_type=u'*')
- 20 if not pagename:
- 21 pagename = macro.formatter.page.page_name
- 22
- 23 return _build_filelist(macro.request, pagename, 0, 1, mime_type=mime_type)
- 24
- global _build_filelist = <function _build_filelist at 0x11ec848>
- macro = <MoinMoin.macro.Macro instance at 0x127fbd8>
- macro.request = <MoinMoin.request.request_cgi.Request object at 0x1110290>
- pagename = u'HelpOnActions/AttachFile'
- mime_type = u'*'
/usr/lib/python2.6/site-packages/MoinMoin/action/AttachFile.py in _build_filelist (request=<MoinMoin.request.request_cgi.Request object at 0x1110290>, pagename=u'HelpOnActions/AttachFile', showheader=0, readonly=1, mime_type=u'*')
- 310 mt = wikiutil.MimeType(filename=file)
- 311 fullpath = os.path.join(attach_dir, file).encode(config.charset)
- 312 st = os.stat(fullpath)
- 313 base, ext = os.path.splitext(file)
- 314 parmdict = {'file': wikiutil.escape(file),
- st = posix.stat_result(st_mode=33188, st_ino=60009, s...623809, st_mtime=1275565507, st_ctime=1293687935)
- global os = <module 'os' from '/usr/lib64/python2.6/os.pyc'>
- os.stat = <built-in function stat>
- fullpath = '/var/www/CAKE/wiki/underlay/pages/HelpOnActions(2f)AttachFile/attachments/unzip6b.png'
OSError
[Errno 2] No such file or directory: '/var/www/CAKE/wiki/underlay/pages/HelpOnActions(2f)AttachFile/attachments/unzip6b.png'
- args = (2, 'No such file or directory')
- errno = 2
- filename = '/var/www/CAKE/wiki/underlay/pages/HelpOnActions(2f)AttachFile/attachments/unzip6b.png'
- message = ''
- strerror = 'No such file or directory'
System Details
- Date: Sun, 05 Feb 2012 07:15:38 +0000
- Platform: Linux attic.omnifarious.org 2.6.32.26-175.fc12.x86_64 #1 SMP Wed Dec 1 21:39:34 UTC 2010 x86_64
- Python: Python 2.6.2 (/usr/bin/python)
- MoinMoin: Release 1.8.8 (release)
