本文整理汇总了Python中MoinMoin.action.AttachFile.preprocess_filename方法的典型用法代码示例。如果您正苦于以下问题:Python AttachFile.preprocess_filename方法的具体用法?Python AttachFile.preprocess_filename怎么用?Python AttachFile.preprocess_filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoinMoin.action.AttachFile
的用法示例。
在下文中一共展示了AttachFile.preprocess_filename方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_action
# 需要导入模块: from MoinMoin.action import AttachFile [as 别名]
# 或者: from MoinMoin.action.AttachFile import preprocess_filename [as 别名]
def do_action(self):
""" Load """
status = False
_ = self._
form = self.form
request = self.request
comment = form.get('comment', [u''])[0]
comment = wikiutil.clean_input(comment)
filename = form.get('file__filename__')
rename = form.get('rename', [''])[0].strip()
if rename:
target = rename
else:
target = filename
target = AttachFile.preprocess_filename(target)
target = wikiutil.clean_input(target)
if target:
filecontent = form['file'][0]
if hasattr(filecontent, 'read'): # a file-like object
filecontent = filecontent.read() # XXX reads complete file into memory!
filecontent = wikiutil.decodeUnknownInput(filecontent)
self.pagename = target
pg = PageEditor(request, self.pagename)
try:
msg = pg.saveText(filecontent, 0, comment=comment)
status = True
except pg.EditConflict, e:
msg = e.message
except pg.SaveError, msg:
msg = unicode(msg)