# Path: locksmith/common.py
# def apicall(url, signkey, **params):
#     params['signature'] = get_signature(params, signkey)
#     data = sorted([(k,v) for k,v in params.iteritems()])
#     body = urllib.urlencode(data)
#     urllib2.urlopen(url, body)
# 
# Path: locksmith/hub/models.py
# def resolve_model(model, fields):
#     def __unicode__(self):
#     def __unicode__(self):
#     def mark_for_update(self):
#     def __unicode__(self):
# def kps_callback(sender, instance, created, raw, **kwargs):
#     def clean_email(self):
#     def clean(self):
# class Api(models.Model):
#     class Meta:
# class Key(models.Model):
#     class Meta:
# class KeyPublicationStatus(models.Model):
#     class Meta:
# class Report(models.Model):
#     class Meta:
# class KeyForm(forms.ModelForm):
#     class Meta:
# class ResendForm(forms.Form):


import datetime
import urllib2
from urlparse import urljoin
from django.core.management.base import NoArgsCommand
from django.core.mail import mail_managers
from django.conf import settings
from locksmith.common import apicall
from locksmith.hub.models import KeyPublicationStatus, UNPUBLISHED, PUBLISHED, NEEDS_UPDATE

class Command(NoArgsCommand):
    help = 'push keys that are marked as dirty to the hub'

    def handle_noargs(self, **options):
        verbosity = int(options.get('verbosity', 1))
        endpoints = {UNPUBLISHED: 'create_key/', NEEDS_UPDATE: 'update_key/'}

# Path: locksmith/common.py
# def apicall(url, signkey, **params):
#     params['signature'] = get_signature(params, signkey)
#     data = sorted([(k,v) for k,v in params.iteritems()])
#     body = urllib.urlencode(data)
#     urllib2.urlopen(url, body)
# 
# Path: locksmith/hub/models.py
# def resolve_model(model, fields):
#     def __unicode__(self):
#     def __unicode__(self):
#     def mark_for_update(self):
#     def __unicode__(self):
# def kps_callback(sender, instance, created, raw, **kwargs):
#     def clean_email(self):
#     def clean(self):
# class Api(models.Model):
#     class Meta:
# class Key(models.Model):
#     class Meta:
# class KeyPublicationStatus(models.Model):
#     class Meta:
# class Report(models.Model):
#     class Meta:
# class KeyForm(forms.ModelForm):
#     class Meta:
# class ResendForm(forms.Form):


# Path: locksmith/hub/management/commands/pushkeys.py
import datetime
import urllib2
from urlparse import urljoin
from django.core.management.base import NoArgsCommand
from django.core.mail import mail_managers
from django.conf import settings
from locksmith.common import apicall
from locksmith.hub.models import KeyPublicationStatus, UNPUBLISHED, PUBLISHED, NEEDS_UPDATE


class Command(NoArgsCommand):
    help = 'push keys that are marked as dirty to the hub'

    def handle_noargs(self, **options):
        verbosity = int(options.get('verbosity', 1))
        endpoints = {UNPUBLISHED: 'create_key/', NEEDS_UPDATE: 'update_key/'}

        actions = {UNPUBLISHED: 0, NEEDS_UPDATE: 0}