Beispiel #1
0
    def clean(self):
        cleaned_data = super(KeepassImportForm, self).clean()

        try:
            db = keepass(cleaned_data['file'], cleaned_data['password'])
            cleaned_data['db'] = db
        except AuthenticationError:
            msg = _('Could not read keepass file, the password you gave may not be correct.')
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']
        except InvalidDatabase:
            msg = _('That file does not appear to be a valid KeePass file.')
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']

        return cleaned_data
Beispiel #2
0
    def clean(self):
        cleaned_data = super(KeepassImportForm, self).clean()

        try:
            db = keepass(cleaned_data['file'], cleaned_data['password'])
            cleaned_data['db'] = db
        except ValueError:
            msg = u'Could not read keepass file, check password.'
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']
        except IOError:
            msg = u'Could not read keepass file, was that a valid keepass file?'
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']

        return cleaned_data
Beispiel #3
0
    def clean(self):
        cleaned_data = super(KeepassImportForm, self).clean()

        try:
            db = keepass(cleaned_data['file'], cleaned_data['password'])
            cleaned_data['db'] = db
        except ValueError:
            msg = _('Could not read keepass file, the password you gave may not be correct.')
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']
        except IOError:
            msg = _('Could not read keepass file, was that a valid keepass file?')
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']

        return cleaned_data
Beispiel #4
0
    def clean(self):
        cleaned_data = super(KeepassImportForm, self).clean()

        try:
            db = keepass(cleaned_data['file'], cleaned_data['password'])
            cleaned_data['db'] = db
        except AuthenticationError:
            msg = _(
                'Could not read keepass file, the password you gave may not be correct.'
            )
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']
        except InvalidDatabase:
            msg = _('That file does not appear to be a valid KeePass file.')
            self._errors['file'] = self.error_class([msg])
            del cleaned_data['file']
            del cleaned_data['password']

        return cleaned_data