~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:04:15 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:789
browser.js: Replaced the old "The server returned an invalid directory
    listing" error (which is an unexpected error but we see it all the time
    for one reason or another) with a more helpful screen which differs based
    on whether an action or a listing is being requested, and provides
    suggestions to the user and a refresh button (so it is clear to click the
    refresh button and move on, rather than just "it broke").

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
    else:
340
340
        overwrite = True
341
341
 
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:
 
342
    if not overwrite:
348
343
        if os.path.exists(path):
349
344
            raise ActionError("A file already exists with that name")
350
345
 
378
373
    path = actionpath_to_urlpath(req, path)
379
374
    goterror = False
380
375
 
 
376
 
381
377
    for datum in data:
382
378
        # Each of the uploaded files
383
379
        filepath = os.path.join(path, datum.filename)
405
401
            try:
406
402
                dest = open(filepath_local, 'wb')
407
403
                if data is not None:
408
 
                    shutil.copyfileobj(filedata, dest)
 
404
                    shutil.copyfileobj(cStringIO.StringIO(filedata), dest)
409
405
            except OSError:
410
406
                goterror = True
411
407