Commit 9d4ed075 by Scott Duckworth

move sshkey_re to util.py

parent 57301416
...@@ -18,10 +18,7 @@ ...@@ -18,10 +18,7 @@
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django_sshkey.util import sshkey_fingerprint from django_sshkey.util import sshkey_re, sshkey_fingerprint
import re
sshkey_re = re.compile(r'(?P<type>[\w-]+)\s+(?P<b64key>\S+)(?:\s+(?P<comment>\S+))?$')
class UserKey(models.Model): class UserKey(models.Model):
user = models.ForeignKey(User, db_index=True) user = models.ForeignKey(User, db_index=True)
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
# You should have received a copy of the GNU Lesser General Public License # You should have received a copy of the GNU Lesser General Public License
# along with django-sshkey. If not, see <http://www.gnu.org/licenses/>. # along with django-sshkey. If not, see <http://www.gnu.org/licenses/>.
import re
sshkey_re = re.compile(r'(?P<type>[\w-]+)\s+(?P<b64key>\S+)(?:\s+(?P<comment>\S.+))?$')
def sshkey_fingerprint(b64key): def sshkey_fingerprint(b64key):
import base64 import base64
import hashlib import hashlib
......
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