# Copyright (c) 2009, 2010 hut <hut@lavabit.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Classes |
| |
- __builtin__.object
-
- Bookmarks
class Bookmarks(__builtin__.object) |
|
Bookmarks is a container which associates keys with bookmarks.
A key is a string with: len(key) == 1 and key in ALLOWED_KEYS.
A bookmark is an object with: bookmark == bookmarktype(str(instance))
Which is true for str or FileSystemObject. This condition is required
so bookmark-objects can be saved to and loaded from a file.
Optionally, a bookmark.go() method is used for entering a bookmark. |
|
Methods defined here:
- __contains__(self, key)
- Test whether a bookmark-key is defined
- __getitem__(self, key)
- Get the bookmark associated with the key
- __init__(self, bookmarkfile, bookmarktype=<type 'str'>, autosave=False)
- <bookmarkfile> specifies the path to the file where
bookmarks are saved in.
- __iter__(self)
- __setitem__(self, key, value)
- Bookmark <value> to the key <key>.
key is expected to be a 1-character string and element of ALLOWED_KEYS.
value is expected to be a filesystemobject.
- delete(self, key)
- Delete the bookmark with the given key
- enter(self, key)
- Enter the bookmark with the given key.
Requires the bookmark instance to have a go() method.
- load(self)
- Load the bookmarks from path/bookmarks
- remember(self, value)
- Bookmarks <value> to the key '
- save(self)
- Save the bookmarks to the bookmarkfile.
This is done automatically after every modification if autosave is True.
- update(self)
- Update the bookmarks from the bookmark file.
Useful if two instances are running which define different bookmarks.
- update_if_outdated(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- autosave = True
- last_mtime = None
- load_pattern = <_sre.SRE_Pattern object at 0xec7430>
| |
Data |
| |
ALLOWED_KEYS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`'" |