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

« back to all changes in this revision

Viewing changes to lib/fileservice_lib/action.py

  • Committer: mattgiuca
  • Date: 2008-06-23 12:17:48 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:790
fileservice_lib/action.py: Putfile (in overwrite mode) now gives an error if
    attempting to write where a directory already exists, rather than dying.
(This is visible in the editor, if you type the name of an existing directory
and click save).

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
    else:
340
340
        overwrite = True
341
341
 
342
 
    if not overwrite:
 
342
    if overwrite:
 
343
        # Overwrite files; but can't if it's a directory
 
344
        if os.path.isdir(path):
 
345
            raise ActionError("A directory already exists "
 
346
                    + "with that name")
 
347
    else:
343
348
        if os.path.exists(path):
344
349
            raise ActionError("A file already exists with that name")
345
350
 
373
378
    path = actionpath_to_urlpath(req, path)
374
379
    goterror = False
375
380
 
376
 
 
377
381
    for datum in data:
378
382
        # Each of the uploaded files
379
383
        filepath = os.path.join(path, datum.filename)