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

« back to all changes in this revision

Viewing changes to ivle/fileservice_lib/listing.py

  • Committer: William Grant
  • Date: 2009-04-28 06:02:41 UTC
  • Revision ID: grantw@unimelb.edu.au-20090428060241-t4gnwl35maukfvfg
Move ivle.conf.mimetypes to ivle.mimetypes, and rename things in it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
 
111
111
import ivle.svn
112
112
import ivle.date
113
 
from ivle import (util, studpath)
114
 
import ivle.conf.mimetypes
 
113
import ivle.mimetypes
 
114
from ivle import studpath
115
115
 
116
116
# Make a Subversion client object
117
117
svnclient = pysvn.Client()
181
181
    elif return_contents:
182
182
        # It's a file. Return the file contents.
183
183
        # First get the mime type of this file
184
 
        # (Note that importing ivle.util has already initialised mime types)
185
184
        (type, _) = mimetypes.guess_type(path)
186
185
        if type is None:
187
 
            type = ivle.conf.mimetypes.default_mimetype
 
186
            type = ivle.mimetypes.DEFAULT_MIMETYPE
188
187
        req.content_type = type
189
188
        req.headers_out['X-IVLE-Return'] = 'File'
190
189
 
312
311
    d = {}
313
312
    if stat.S_ISDIR(file_stat.st_mode):
314
313
        d["isdir"] = True
315
 
        d["type_nice"] = util.nice_filetype("/")
 
314
        d["type_nice"] = ivle.mimetypes.nice_filetype("/")
316
315
        # Only directories can be published
317
316
        d["published"] = studpath.published(fullpath)
318
317
    else:
320
319
        d["size"] = file_stat.st_size
321
320
        (type, _) = mimetypes.guess_type(fullpath)
322
321
        if type is None:
323
 
            type = ivle.conf.mimetypes.default_mimetype
 
322
            type = ivle.mimetypes.DEFAULT_MIMETYPE
324
323
        d["type"] = type
325
 
        d["type_nice"] = util.nice_filetype(fullpath)
 
324
        d["type_nice"] = ivle.mimetypes.nice_filetype(fullpath)
326
325
    d["mtime"] = file_stat.st_mtime
327
326
    d["mtime_nice"] = ivle.date.make_date_nice(file_stat.st_mtime)
328
327
    d["mtime_short"] = ivle.date.make_date_nice_short(file_stat.st_mtime)