comparison 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
comparison
equal deleted inserted replaced
1909:be140a589f11 1910:5c3dffe2abf1
146 @rtype: string (in config.charset encoding) 146 @rtype: string (in config.charset encoding)
147 @return: complete path/filename of attached file 147 @return: complete path/filename of attached file
148 """ 148 """
149 return os.path.join(getAttachDir(request, pagename), filename).encode(config.charset) 149 return os.path.join(getAttachDir(request, pagename), filename).encode(config.charset)
150 150
151 def exists(request, pagename, filename):
152 """ check if page <pagename> has a file <filename> attached """
153 fpath = getFilename(request, pagename, filename)
154 return os.path.exists(fpath)
151 155
152 def info(pagename, request): 156 def info(pagename, request):
153 """ Generate snippet with info on the attachment for page `pagename`. 157 """ Generate snippet with info on the attachment for page `pagename`.
154 """ 158 """
155 _ = request.getText 159 _ = request.getText