Thomas Gläßle avatar Thomas Gläßle committed 27b658c

Handle passwort_prompt=None more canonically

Comments (0)

Files changed (1)

     def __init__(self, bus, filter_file=None, prompt=None):
         self.log = logging.getLogger('udiskie.mount.Mounter')
         self.bus = bus
+        self.prompt = prompt
 
         if not filter_file:
             filter_file = os.path.join(xdg_config_home, self.CONFIG_PATH)
         self.filters = udiskie.match.FilterMatcher((filter_file,))
 
-        if not prompt:
-            self.prompt = lambda text, title: None
-        else:
-            self.prompt = prompt
-
-
     def mount_device(self, device):
         """
         Mount the device if not already mounted.
             return False
 
         # prompt user for password
-        password = self.prompt(
+        password = self.prompt and self.prompt(
                 'Enter password for %s:' % (device,),
                 'Unlock encrypted device')
         if password is None:
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 ProjectModifiedEvent.java.
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.