Commit 80071eb9 by Scott Duckworth

treat KeyInfo as object not tuple

parent c14af483
......@@ -75,17 +75,18 @@ class UserKey(models.Model):
def clean(self):
type, b64key, comment, self.fingerprint = key_parse(self.key)
if comment:
self.key = "%s %s %s" % (type.decode(), b64key.decode(), comment)
info = key_parse(self.key)
self.fingerprint = info.fingerprint
if info.comment:
self.key = "%s %s %s" % (info.type.decode(), info.b64key.decode(), info.comment)
self.key = "%s %s" % (type.decode(), b64key.decode())
self.key = "%s %s" % (info.type.decode(), info.b64key.decode())
except SSHKeyFormatError as e:
raise ValidationError(str(e))
if not
if not comment:
if not info.comment:
raise ValidationError('Name or key comment required') = comment = info.comment
def validate_unique(self, exclude=None):
if is None:
......@@ -146,7 +146,8 @@ def lookup_by_fingerprint_main():
type, b64key, comment, fingerprint = key_parse(key)
info = key_parse(key)
fingerprint = info.fingerprint
except SSHKeyFormatError as e:
sys.stderr.write("Error: " + str(e))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment