~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/fileservice_lib/listing.py

  • Committer: Matt Giuca
  • Date: 2009-04-23 08:15:09 UTC
  • Revision ID: matt.giuca@gmail.com-20090423081509-oyp1sxqwj5sfnb66
fileservice: Fixed a bug when browsing previous revisions, that the
    *existance* of a file or *whether or not it is a directory* was determined
    by the current version, not the historical version.
    Now checks the revision to see whether the file exists and whether it is a
    directory (so it will not look at the physical file system at all).

Show diffs side-by-side

added added

removed removed

Lines of Context:
159
159
    # that revision, this will terminate.
160
160
    revision = _get_revision_or_die(req, svnclient, path)
161
161
 
162
 
    if not os.access(path, os.R_OK):
163
 
        req.status = req.HTTP_NOT_FOUND
164
 
        req.headers_out['X-IVLE-Return-Error'] = 'File not found'
165
 
        req.write("File not found")
166
 
    elif os.path.isdir(path):
 
162
    if revision is None:
 
163
        if not os.access(path, os.R_OK):
 
164
            req.status = req.HTTP_NOT_FOUND
 
165
            req.headers_out['X-IVLE-Return-Error'] = 'File not found'
 
166
            req.write("File not found")
 
167
            return
 
168
        is_dir = os.path.isdir(path)
 
169
    else:
 
170
        is_dir = ivle.svn.revision_is_dir(svnclient, path, revision)
 
171
 
 
172
    if is_dir:
167
173
        # It's a directory. Return the directory listing.
168
174
        req.content_type = mime_dirlisting
169
175
        req.headers_out['X-IVLE-Return'] = 'Dir'