Robert Leftwich avatar Robert Leftwich committed ed4f0fb

Update default filenames to use platform specific locations

Comments (0)

Files changed (1)


     S3, FTP, WebDAV, memory and more.
-    default_filename = '~/keyring_pyf_pass.cfg'
+    _filename = 'keyring_pyf_pass.cfg'
     def __init__(self, crypter, filename=None, can_create=True,
         super(BasicPyfilesystemKeyring, self).__init__()
         self._crypter = crypter
-        self._filename = filename or self.default_filename
+        self._filename = (filename or 
+                          os.path.join(keyring.util.platform.data_root(), 
+                                       self.__class__._filename))
         self._can_create = can_create
         self._cache_timeout = cache_timeout
+    @properties.NonDataProperty
+    def file_path(self):
+        """
+        The path to the file where passwords are stored. This property
+        may be overridden by the subclass or at the instance level.
+        """
+        return os.path.join(keyring.util.platform.data_root(), self.filename)
     def filename(self):
         """The filename used to store the passwords.
     """Unencrypted Pyfilesystem Keyring
-    def __init__(self, filename=BasicPyfilesystemKeyring.default_filename,
-                 can_create=True, cache_timeout=None):
+    def __init__(self, filename=None, can_create=True, cache_timeout=None):
         super(UnencryptedPyfilesystemKeyring, self).__init__(
             NullCrypter(), filename=filename, can_create=can_create,
     """Encrypted Pyfilesystem Keyring
-    default_filename = '~/crypted_pyf_pass.cfg'
+    _filename = 'crypted_pyf_pass.cfg'
-    def __init__(self, crypter, filename=default_filename, can_create=True,
+    def __init__(self, crypter, filename=None, can_create=True,
         super(EncryptedPyfilesystemKeyring, self).__init__(
             crypter, filename=filename, can_create=can_create,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.