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

« back to all changes in this revision

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

  • Committer: mattgiuca
  • Date: 2008-01-15 03:06:54 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:229
Images: Reduced "small" icons from 22x22 to 16x16. Reduced "large" icons from
    128x128 to 96x96.
Changed some of the icons for Subversion so they make a bit more sense.
    (Missing and deleted are now distinct).
Modified JavaScript and CSS so the interface flows with 16x16 icons instead of
22. This makes each file vertically a lot shorter.
Made the bands of colour in the file listing much closer together in colour.

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
#               times.
103
103
#
104
104
# action=svnupdate: Bring a file up to date with the head revision.
105
 
#       path:   The path to the file to be updated. Can be specified multiple
106
 
#               times.
 
105
#       path:   The path to the file to be updated. Only one file may be
 
106
#               specified.
107
107
#
108
108
# action=svncommit: Commit a file(s) or directory(s) to the repository.
109
109
#       path:   The path to the file or directory to be committed. Can be
280
280
 
281
281
    Reads fields: 'path', 'data' (file upload)
282
282
    """
 
283
    # Important: Data is "None" if the file submitted is empty.
283
284
    path = fields.getfirst('path')
284
285
    data = fields.getfirst('data')
285
 
    if path is None or data is None:
 
286
    if path is None:
286
287
        raise ActionError("Required field missing")
287
288
    path = actionpath_to_local(req, path)
288
 
    data = data.file
 
289
    if data is not None:
 
290
        data = data.file
289
291
 
290
292
    # Copy the contents of file object 'data' to the path 'path'
291
293
    try:
292
294
        dest = open(path, 'wb')
293
 
        shutil.copyfileobj(data, dest)
 
295
        if data is not None:
 
296
            shutil.copyfileobj(data, dest)
294
297
    except OSError:
295
298
        raise ActionError("Could not write to target file")
296
299