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

« back to all changes in this revision

Viewing changes to www/apps/fileservice/listing.py

  • Committer: mattgiuca
  • Date: 2008-01-13 23:38:58 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:213
Fileservice / Files (Python and JS files):
    Added code to handle "nice filetypes" and "nice svn status".
    New JSON value for dir listings, "type_nice" which contains the nice
    filetype calculated by the server.
    The client calculates the nice svn status.
    Added new icons for svn status for added, deleted, missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
187
187
        mtime = os.path.getmtime(path)
188
188
        listing["."] = {"isdir" : True,
189
189
            "mtime" : mtime, "mtime_nice" : make_date_nice(mtime),
190
 
            "mtime_short" : make_date_nice_short(mtime)}
 
190
            "mtime_short" : make_date_nice_short(mtime),
 
191
            "type_nice" : util.nice_filetype("/")}
191
192
 
192
193
    # Listing is a nested object inside the top-level JSON.
193
194
    listing = {"listing" : listing}
211
212
    file_stat = os.stat(fullpath)
212
213
    if stat.S_ISDIR(file_stat.st_mode):
213
214
        d["isdir"] = True
 
215
        d["type_nice"] = util.nice_filetype("/")
214
216
    else:
215
217
        d["isdir"] = False
216
218
        d["size"] = file_stat.st_size
218
220
        if type is None:
219
221
            type = conf.mimetypes.default_mimetype
220
222
        d["type"] = type
 
223
        d["type_nice"] = util.nice_filetype(filename)
221
224
    d["mtime"] = file_stat.st_mtime
222
225
    d["mtime_nice"] = make_date_nice(file_stat.st_mtime)
223
226
    d["mtime_short"] = make_date_nice_short(file_stat.st_mtime)
248
251
        file_stat = os.stat(fullpath)
249
252
        if stat.S_ISDIR(file_stat.st_mode):
250
253
            d["isdir"] = True
 
254
            d["type_nice"] = util.nice_filetype("/")
251
255
        else:
252
256
            d["isdir"] = False
253
257
            d["size"] = file_stat.st_size
255
259
            if type is None:
256
260
                type = conf.mimetypes.default_mimetype
257
261
            d["type"] = type
 
262
            d["type_nice"] = util.nice_filetype(filename)
258
263
        d["mtime"] = file_stat.st_mtime
259
264
        d["mtime_nice"] = make_date_nice(file_stat.st_mtime)
260
265
        d["mtime_short"] = make_date_nice_short(file_stat.st_mtime)