class documentation

class WriteMode(bb.Union): (source)

View In Hierarchy

Your intent when writing a file to some path. This is used to determine what constitutes a conflict and what the autorename strategy is. In some situations, the conflict behavior is identical: (a) If the target path doesn't refer to anything, the file is always written; no conflict. (b) If the target path refers to a folder, it's always a conflict. (c) If the target path refers to a file with identical contents, nothing gets written; no conflict. The conflict checking differs in the case where there's a file at the target path with contents different from the contents you're trying to write. This class acts as a tagged union. Only one of the ``is_*`` methods will return true. To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method. :ivar files.WriteMode.add: Do not overwrite an existing file if there is a conflict. The autorename strategy is to append a number to the file name. For example, "document.txt" might become "document (2).txt". :ivar files.WriteMode.overwrite: Always overwrite the existing file. The autorename strategy is the same as it is for ``add``. :ivar str files.WriteMode.update: Overwrite if the given "rev" matches the existing file's "rev". The supplied value should be the latest known "rev" of the file, for example, from :type:`FileMetadata`, from when the file was last downloaded by the app. This will cause the file on the Dropbox servers to be overwritten if the given "rev" matches the existing file's current "rev" on the Dropbox servers. The autorename strategy is to append the string "conflicted copy" to the file name. For example, "document.txt" might become "document (conflicted copy).txt" or "document (Panda's conflicted copy).txt".

Class Method update Create an instance of this class set to the ``update`` tag with value ``val``.
Method get_update Overwrite if the given "rev" matches the existing file's "rev". The supplied value should be the latest known "rev" of the file, for example, from :class:`FileMetadata`, from when the file was last downloaded by the app...
Method is_add Check if the union tag is ``add``.
Method is_overwrite Check if the union tag is ``overwrite``.
Method is_update Check if the union tag is ``update``.
Class Variable add Undocumented
Class Variable overwrite Undocumented
Method _process_custom_annotations Undocumented
Class Variable _catch_all Undocumented
@classmethod
def update(cls, val): (source)

Create an instance of this class set to the ``update`` tag with value ``val``. :param str val: :rtype: WriteMode

def get_update(self): (source)

Overwrite if the given "rev" matches the existing file's "rev". The supplied value should be the latest known "rev" of the file, for example, from :class:`FileMetadata`, from when the file was last downloaded by the app. This will cause the file on the Dropbox servers to be overwritten if the given "rev" matches the existing file's current "rev" on the Dropbox servers. The autorename strategy is to append the string "conflicted copy" to the file name. For example, "document.txt" might become "document (conflicted copy).txt" or "document (Panda's conflicted copy).txt". Only call this if :meth:`is_update` is true. :rtype: str

def is_add(self): (source)

Check if the union tag is ``add``. :rtype: bool

def is_overwrite(self): (source)

Check if the union tag is ``overwrite``. :rtype: bool

def is_update(self): (source)

Check if the union tag is ``update``. :rtype: bool

Undocumented

overwrite = (source)

Undocumented

def _process_custom_annotations(self, annotation_type, field_path, processor): (source)

Undocumented

_catch_all = (source)

Undocumented