def provider(request): providers = [] provider_types = PROVIDERS.keys() provider_types.sort() for p in provider_types: providers.append([p, PROVIDERS[p]['display_name']]) variables = RequestContext(request, { 'provider_types': providers, 'user': request.user, }) return render_to_response('provider.html', variables)
import json import datetime import logging from IPy import IP from django.db import models, transaction from provisioning.controllers import ProviderController from provisioning.provider_meta import PROVIDERS provider_meta_keys = PROVIDERS.keys() provider_meta_keys.sort() PROVIDER_CHOICES = ([(key, key) for key in provider_meta_keys]) # libcloud states mapping STATES = { 0: 'Running', 1: 'Rebooting', 2: 'Terminated', 3: 'Pending', 4: 'Unknown', } def get_state(state): if state not in STATES: state = 4 return STATES[state]