Skip to content
This repository has been archived by the owner on Dec 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from bitprophet/client-from_dict-fix
Browse files Browse the repository at this point in the history
Import partial patch from upstream PR 2
  • Loading branch information
coderanger committed May 18, 2012
2 parents 62e90a3 + f25cf8f commit fd57d34
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions commis/clients/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ def create(self, *args, **kwargs):
client.generate_key()
return client

def from_dict(self, data, *args, **kwargs):
chef_client = chef.Client.from_search(data)
client, created = self.get_or_create(name=chef_client.name)
client.generate_key()
client.save()
client.private_key = client._key_cache.private_export()
return client

class Client(models.Model):
name = models.CharField(_('Name'), unique=True, max_length=1024)
Expand Down

0 comments on commit fd57d34

Please sign in to comment.