diff MoinMoin/action/AttachFile.py @ 1910:5c3dffe2abf1

new function AttachFile.exists to reduce code duplication
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 25 Mar 2007 22:37:45 +0200
parents 82667e81b928
children 0b2ad3099fcf
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sun Mar 25 21:55:13 2007 +0200
+++ b/MoinMoin/action/AttachFile.py	Sun Mar 25 22:37:45 2007 +0200
@@ -148,6 +148,10 @@
     """
     return os.path.join(getAttachDir(request, pagename), filename).encode(config.charset)
 
+def exists(request, pagename, filename):
+    """ check if page <pagename> has a file <filename> attached """
+    fpath = getFilename(request, pagename, filename)
+    return os.path.exists(fpath)
 
 def info(pagename, request):
     """ Generate snippet with info on the attachment for page `pagename`.