Changeset 11103

Show
Ignore:
Timestamp:
05/22/12 20:49:33 (13 months ago)
Author:
edent
Message:

add more documentation and remove unnecessary methodes

Location:
ossiedev/branches/jsnyder/trunk/tools/cornetApps
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/DomainMan/views.py

    r11100 r11103  
    1212""" 
    1313 
    14 """Checks if running locally or on the web by testing which Django settings are used 
     14""" 
     15Checks if running locally or on the web by testing which Django settings are used 
    1516""" 
    1617def isOnWeb(): 
     
    3637Connects to a node given its floor and number 
    3738Returns the SSHClient connected to the server 
     39@param floor The floor of the node to connect to 
     40@param num The number of the node to connect to 
     41@param user The username to login with 
     42@param password The password of the user to login with 
     43@return The SSHClient connected to the server 
    3844""" 
    3945def connectViaNode(floor, num, user, password): 
     
    7177    return 0 
    7278 
    73 ''' 
     79""" 
    7480Starts default nodeBooter at a given ip and port 
    7581@param ip: The ip address of the server for the nodes 
     
    7783@param user: The user's username with access to the node 
    7884@param password: The user's password 
    79 ''' 
     85""" 
    8086def startNodebooter(request, floor, num, user, password): 
    8187    floor = int(floor) 
     
    106112    return 
    107113 
    108 """Populate the list of device managers 
     114""" 
     115Populate the list of device managers from a given node 
     116@param floor The floor of the node to connect to 
     117@param num The number of the node to connect to 
     118@param user The username to login with 
     119@param password The password of the user to login with 
     120@return An array of the list of device managers on the node 
    109121""" 
    110122def getDeviceManagers(floor, num, user, password): 
     
    115127    return stdout.readlines() 
    116128  
    117 """View for displaying device and domain managers 
     129""" 
     130View for displaying device and domain managers 
     131@param request The Django request parameter for views 
     132@param floor The floor of the node to connect to 
     133@param num The number of the node to connect to 
     134@param user The username to login with 
     135@param password The password of the user to login with 
     136@return HttpResponse object with template and local context dictionary or 
     137    Http404 if could not find user and password session variables 
    118138""" 
    119139def manager_view(request, floor, num, user, password): 
     
    122142        request.session["user"] = user 
    123143        request.session["password"] = password 
    124         print "user: "+user, password 
    125144    except: 
    126145        raise Http404(u'Could not set user and password in session variables') 
     
    133152""" 
    134153Start a device manager and a domain manager 
     154checks post and session variables. 
     155execute command based domain and device manager options 
     156@param request The Django request parameter for views 
     157@return HttpResponse object with template and local context dictionary or 
     158    Http404 if could not find user and password session variables 
    135159""" 
    136160def startManager(request): 
     
    161185""" 
    162186Gets the parameters to run domain manager 
     187@param request The Django request parameter for views 
     188@return The correct command based on the domainLocation session variable 
     189    -D if the domain manager is located on the same node 
     190    nothing if the domain manager is located on a remote node 
    163191""" 
    164192def getDomain(request): 
     
    174202""" 
    175203Gets the device manager's xml file to run based on a given POST request 
     204@param request The Django request parameter for views 
     205@return The string command for the device manager xml file 
     206    returns Http404 if cannot find the device parameter in the post request 
    176207""" 
    177208def getDeviceXML(request): 
     
    189220""" 
    190221Sets up the domain manager ip address to run based on a given POST request 
     222@param request The Django request parameter for views 
     223@return The domain string options using the -ORBInitRef and ip address using corba 
    191224""" 
    192225def getDomainIP(request): 
     
    228261@param user: The user's username with access to the node 
    229262@param password: The user's password 
     263@return HttpResponse with local variables as a context dictionary inserted into the console.html template 
    230264''' 
    231265def nodeBooter_page(request, ip, port, user, password): 
     
    243277 
    244278""" 
    245 Connect to a node through a form 
     279Connect to a node through post variables 
     280@param request Contains the post variables floor, number, user, and pass to connect to a node 
     281@return The local variables as dictionary into the DomainMan/runningNodebooter.html template 
     282    If one of the post variables are not there, it will print a "Missing ssh connection parameters" string 
    246283""" 
    247284def connect_to_node(request): 
     
    265302""" 
    266303Raise exception if the inputs of the floor and node number are invalid 
     304@param floor The given floor to check 
     305@param num The given node number to check 
     306@return Exception if the floor or node num is less than 1 or greater than 4 or 12, respectively 
    267307""" 
    268308def testValidInputs(floor, num): 
     
    273313 
    274314#@login_required 
     315""" 
     316Loads the DomainMan/nodes.html template based on a logging into a specific node 
     317@param floor_num The floor of the node to login to 
     318@param node_num The node number of the node to login to 
     319@return The HttpResponse object with the local variables added to the dictionary 
     320""" 
    275321def loadNode(request, floor_num, node_num): 
    276322    floor = int(floor_num) 
     
    289335""" 
    290336Returns connection form 
     337@param selectFloor The floor of the node to login to 
     338@param selectNum The node number of the node to login to 
     339@return the HttpResponse object with the local variable dictionary in the DomainMan/connect.html template 
    291340""" 
    292341def connect_to_node_view(request, selectFloor, selectNum): 
     
    297346    testValidInputs(selectedFloor, selectedNum) 
    298347    return render_to_response('DomainMan/connect.html', locals(), RequestContext(request)) 
    299  
    300 def ajax_example(request): 
    301     if not request.method == 'GET': 
    302         name = "did not work" 
    303         print request.GET 
    304         return render_to_response('DomainMan/ajax_example.html', locals(), context_instance=RequestContext(request)) 
    305     response_dict = {} 
    306     name = request.GET.get('name', False) 
    307     total = request.GET.get('total', False) 
    308     response_dict.update({'name': name, 'total': total}) 
    309     if total: 
    310         try: 
    311             total = int(total) 
    312         except: 
    313             total = False 
    314     if name and total and int(total) == 10: 
    315         response_dict.update({'success': True }) 
    316     else: 
    317         response_dict.update({'errors': {}}) 
    318         if not name: 
    319             response_dict['errors'].update({'name': 'This field is required'}) 
    320         if not total and total is not False: 
    321             response_dict['errors'].update({'total': 'This field is required'}) 
    322         elif int(total) != 10: 
    323             response_dict['errors'].update({'total': 'Incorrect total'}) 
    324     return render_to_response('DomainMan/ajax_example.html', response_dict, context_instance=RequestContext(request)) 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/LoginUser/views.py

    r11101 r11103  
    4343    return render_to_response("HtmlPages/account_page.html", locals(), context_instance=RequestContext(request)) 
    4444 
    45 ''' 
     45""" 
    4646Redirects user to the main page. 
    47 ''' 
     47""" 
    4848def logout_page(request): 
    4949        logout(request) 
    5050        return HttpResponseRedirect(url_on_web('/')) 
    5151 
    52 ''' 
     52""" 
    5353Create user account in registration page 
    5454Checks for posting form. 
    55 ''' 
     55""" 
    5656def register_page(request): 
    5757    if request.method == 'POST': 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/settings.py

    r11073 r11103  
    1  
    2  
    31# Django settings for running cornetApps project *locally* 
    42 
     
    1513    'default': { 
    1614        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
    17         #'NAME': 'cornetApps.db',                      # Or path to database file if using sqlite3. 
    1815            'NAME': 'cornetApps.db',  #webserver 
    1916        'USER': '',                      # Not used with sqlite3. 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/settingsWeb.py

    r11073 r11103  
    1313    'default': { 
    1414        'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 
    15         #'NAME': 'cornetApps.db',                      # Or path to database file if using sqlite3. 
    16                'NAME': '/home/webdemo/cornetApps/cornetApps.db',  #webserver 
     15        #'NAME': 'cornetApps.db',                      # webserver 
     16               'NAME': '/home/webdemo/cornetApps/cornetApps.db',  #Or path to database file if using sqlite3. 
    1717        'USER': '',                      # Not used with sqlite3. 
    1818        'PASSWORD': '',                  # Not used with sqlite3. 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/urls.py

    r11100 r11103  
    4343    url(r'^DomainMan/managers/(?P<floor>\d{1})/(?P<num>\d+)/(?P<user>.*)/(?P<password>.*)/$', 'DomainMan.views.manager_view'), 
    4444    url(r'^DomainMan/startManager/$', 'DomainMan.views.startManager'), 
    45     url(r'^xhr_test/$', 'DomainMan.views.xhr_test'), 
    46     url(r'^ajax/$', 'DomainMan.views.ajax_example'), 
    4745 
    4846    # url(r'^cornetApps/', include('cornetApps.foo.urls')),