~roadmr/checkbox/1311462-remove-n-requirement

« back to all changes in this revision

Viewing changes to plainbox/plainbox/impl/session/storage.py

  • Committer: Daniel Manrique
  • Author(s): Zygmunt Krynicki
  • Date: 2014-04-30 22:33:31 UTC
  • mfrom: (2960.3.5 launchpad/session-peek-api)
  • Revision ID: daniel_manrique-20140430223331-s169swog501m28og
"automatic merge by tarmac [r=roadmr][bug=1272762][author=zkrynicki]"

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
        return self._location
207
207
 
208
208
    @property
 
209
    def id(self):
 
210
        """
 
211
        identifier of the session storage (name of the random directory)
 
212
        """
 
213
        return os.path.splitext(os.path.basename(self.location))[0]
 
214
 
 
215
    @property
209
216
    def session_file(self):
210
217
        """
211
218
        pathname of the session state file
404
411
                # Close the session file
405
412
                logger.debug(_("Closed descriptor %d"), session_fd)
406
413
                os.close(session_fd)
 
414
        except IOError as exc:
 
415
            if exc.errno == errno.ENOENT:
 
416
                # Treat lack of 'session' file as an empty file
 
417
                return b''
 
418
            raise
407
419
        finally:
408
420
            # Close the location directory
409
421
            logger.debug(_("Closed descriptor %d"), location_fd)
427
439
            finally:
428
440
                # Close the session file
429
441
                os.close(session_fd)
 
442
        except IOError as exc:
 
443
            if exc.errno == errno.ENOENT:
 
444
                # Treat lack of 'session' file as an empty file
 
445
                return b''
 
446
            raise
430
447
        finally:
431
448
            # Close the location directory
432
449
            os.close(location_fd)