Changeset 074912e


Ignore:
Timestamp:
05/25/11 23:15:39 (2 years ago)
Author:
Tomas Edwardsson <tommi@…>
Branches:
master
Children:
c6075f0
Parents:
18798af (diff), ac3bc8a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Tomas Edwardsson <tommi@…> (05/25/11 23:15:39)
git-committer:
Tomas Edwardsson <tommi@…> (05/25/11 23:15:39)
Message:

Merge branch 'refs/heads/master' of http://opensource.ok.is/git/okconfig

Location:
adagios
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • adagios/configurator/views.py

    rfa5f57a r18798af  
    1 from django.shortcuts import render_to_response 
    2  
     1from django.shortcuts import render_to_response, redirect 
     2from django.core import serializers 
     3from django.http import HttpResponse, HttpResponseServerError 
     4from django.utils import simplejson 
    35 
    46from doit import * 
     
    68def test(request): 
    79        return index(request) 
     10 
     11def home(request): 
     12        return redirect('adagios') 
     13 
    814def index(request): 
    915        parse() 
     
    102108 
    103109 
     110def api_host(request, host_name=None, ext='xml'): 
     111        parse() 
     112        c = {} 
     113        c['hosts'] = get_hosts() 
     114                 
     115                 
     116        if host_name != None: 
     117                c['host'] = get_host( host_name ) 
     118                data = '' 
     119                if ext == 'xml': 
     120                        import xml.marshal.generic 
     121                        data = xml.marshal.generic.dumps(c['host']) 
     122                elif ext == 'html': 
     123                        return render_to_response('configuration/api/host.html', c) 
     124                elif ext == 'json': 
     125                        import json 
     126                        data = json.dumps(c['host']) 
     127                else: 
     128                        return HttpResponseServerError("fle") 
     129                return HttpResponse(data, mimetype='application/javascript') 
     130 
     131        return NotImplementedError 
     132 
     133def api_dnslookup(request, host_name=None): 
     134        import socket 
     135         
     136        raise NotImplementedError 
    104137 
    105138 
    106139 
    107  
  • adagios/settings.py

    rfa5f57a r8290820  
    33DEBUG = True 
    44TEMPLATE_DEBUG = DEBUG 
     5 
     6# Hack to allow relative template paths 
     7import os 
     8djangopath = os.path.abspath('.') 
    59 
    610ADMINS = ( 
     
    8286    # Always use forward slashes, even on Windows. 
    8387    # Don't forget to use absolute paths, not relative paths. 
    84     '/opt/adagios/templates/', 
     88    "%s/templates" % (djangopath), 
    8589) 
    8690 
  • adagios/urls.py

    rfa5f57a r18798af  
    77urlpatterns = patterns('', 
    88    # Example: 
    9      (r'^adagios/$', 'configurator.views.index'), 
    10      (r'^adagios/configurator$', 'configurator.views.index'), 
     9    (r'^$', 'configurator.views.home'), 
     10    (r'^adagios/api/host/(?P<host_name>.*)\.(?P<ext>.+)$', 'configurator.views.api_host'),  
     11    (r'^adagios/$', 'configurator.views.index'), 
     12    (r'^adagios/configurator$', 'configurator.views.index'), 
    1113    (r'^adagios/configurator/host$', 'configurator.views.test'), 
    1214    (r'^adagios/configurator/host/(?P<host_name>.+)/(?P<service_description>.+)/(?P<field_name>.+)=(?P<new_value>.+)$', 'configurator.views.edit_service'), 
Note: See TracChangeset for help on using the changeset viewer.