mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 23:53:15 +01:00
python: rework Directory.set_mtime
Fix the indentation within the docstring, remove useless remarks, do some trivial refactoring. Signed-off-by: Justus Winter <4winter@informatik.uni-hamburg.de>
This commit is contained in:
parent
798b74e859
commit
1737ff5290
1 changed files with 9 additions and 17 deletions
|
@ -679,27 +679,19 @@ class Directory(object):
|
||||||
don't store a timestamp of 0 unless you are comfortable with
|
don't store a timestamp of 0 unless you are comfortable with
|
||||||
that.
|
that.
|
||||||
|
|
||||||
:param mtime: A (time_t) timestamp
|
:param mtime: A (time_t) timestamp
|
||||||
:returns: Nothing on success, raising an exception on failure.
|
:raises: :exc:`XapianError` a Xapian exception occurred, mtime
|
||||||
:raises: :exc:`NotmuchError`:
|
not stored
|
||||||
|
:raises: :exc:`ReadOnlyDatabaseError` the database was opened
|
||||||
:attr:`STATUS`.XAPIAN_EXCEPTION
|
in read-only mode so directory mtime cannot be modified
|
||||||
A Xapian exception occurred, mtime not stored.
|
:raises: :exc:`NotInitializedError` the directory object has not
|
||||||
:attr:`STATUS`.READ_ONLY_DATABASE
|
been initialized
|
||||||
Database was opened in read-only mode so directory
|
|
||||||
mtime cannot be modified.
|
|
||||||
:attr:`STATUS`.NOT_INITIALIZED
|
|
||||||
The directory has not been initialized
|
|
||||||
"""
|
"""
|
||||||
self._assert_dir_is_initialized()
|
self._assert_dir_is_initialized()
|
||||||
#TODO: make sure, we convert the mtime parameter to a 'c_long'
|
|
||||||
status = Directory._set_mtime(self._dir_p, mtime)
|
status = Directory._set_mtime(self._dir_p, mtime)
|
||||||
|
|
||||||
#return on success
|
if status != STATUS.SUCCESS:
|
||||||
if status == STATUS.SUCCESS:
|
raise NotmuchError(status)
|
||||||
return
|
|
||||||
#fail with Exception otherwise
|
|
||||||
raise NotmuchError(status)
|
|
||||||
|
|
||||||
def get_mtime(self):
|
def get_mtime(self):
|
||||||
"""Gets the mtime value of this directory in the database
|
"""Gets the mtime value of this directory in the database
|
||||||
|
|
Loading…
Add table
Reference in a new issue