Exemple #1
0
	def GET(self):
		form = subtractionForm()
		num1 = randint(1,20)
		form.get('num1').value = num1
		num2 = randint(1,20)
		form.get('num2').value = num2
		return render.subtraction(form, num1, num2, "subtract")
Exemple #2
0
	def GET(self):
		form = additionForm()
		num1 = randint(1,20)
		form.get('num1').value = num1
		num2 = randint(1,20)
		form.get('num2').value = num2
		return render.addition(form, num1, num2, "add")
Exemple #3
0
	def GET(self):
		form = multiplicationForm()
		num1 = randint(1,20)
		form.get('num1').value = num1
		num2 = randint(1,20)
		form.get('num2').value = num2
		return render.multiplication(form, num1, num2, "multiply")
Exemple #4
0
	def POST(self):
		form = addScoreForm()
		if not form.validates():
			return render.index(render.add_new_score(form))
		d = shelve.open('high_score.db')
		data = d['scores']
		data.sort(key=lambda r:r[1])
		x = check_score(data, (form.get('Initials'), session.num_right))
		add_score(data, (form.get('Initials'), session.num_right), x)
		session.num_right = 0
		d.close()
		raise web.seeother('/show_scores')
	def GET(self):
		webInput = web.input(check="false", id="", heading=0, lat=None, lng=None, title=None, owner=None, qa_status="not_checked", date_added=time.strftime("%Y/%m/%d"))
		if webInput.check=="true" or webInput.id=="":
			# Build the checking tool form
			form = checkForm()
			form.get("Title").value = webInput.title
			form.get("Owner").value = webInput.owner

			return render.checkPano(checkForm, gmaps_id=webInput.id, heading=webInput.heading)
		
		elif webInput.id=="":
			web.ctx.status = '400 Bad Request'
			return 'explicit 400'

		else:
			db.insert('panoramas', gmaps_id=webInput.id, heading=webInput.heading, lat=webInput.lat, lng=webInput.lng, title=webInput.title, owner=webInput.owner, qa_status=webInput.qa_status, date_added=time.strftime("%Y/%m/%d"))
Exemple #6
0
def view():
    rendered = form.render()
    return add_technology_links(rendered,
                                form.get("bluetooth").value,
                                form.get("cellular").value)
Exemple #7
0
 def GET(self):
     if(session.user == "anonymous"):
         return "Seccion restringida"
     
     form = profileForm()
     userName = str(session.user).lower()
     
     userData = loadUser(userName)
     
     try:
         form.get("nickName").value = session.user
         form.get("name").value = userData["name"]
         form.get("surname").value = userData["surname"]
         form.get("dni").value = userData["dni"]
         form.get("email").value = userData["email"]
         form.get("day").value = int(userData["day"])
         form.get("month").value = int(userData["month"])
         form.get("year").value = int(userData["year"])
         form.get("address").value = userData["address"]
         form.get("payWay").value = userData["payway"]
         form.get("password").value = ""
         form.get("passwordConfirm").value = ""
         
         #form.validators.append(form.Validator("Las constrasenias no coiniciden", lambda x: form.d.password == None or (form.d.password != None and form.d.password == form.d.passwordConfirm)))
         
     except KeyError:
         return "Ha ocurrido un error, por favor avise a un administrador"
     
     #saveUser(form.d.nickName, form.d.name, form.d.surname, form.d.dni, form.d.email, form.d.day, form.d.month, form.d.year, form.d.address, form.d.password, form.d.payWay)
     
     content = render.formtest(form, "Guardar")
     return getContent(content)
Exemple #8
0
def update_fields(service_id):
    properties = get_properties(service_id)
    if not properties.keys():
        return

    if get_value(properties, "AutoConnect") == "true":
        autoconn = "Yes"
    else:
        autoconn = "No"
    form.get('autoconnect').value = autoconn

    form.get('nameservers').value = get_str_value(properties,
                                                  "Nameservers.Configuration")
    form.get('timeservers').value = get_str_value(properties,
                                                  "Timeservers.Configuration")
    form.get('domains').value = get_str_value(properties,
                                              "Domains.Configuration")
    value = get_dict_value(properties, "Proxy.Configuration", "Method")
    if value == "":
        value = "auto"
    form.get('proxymethod').value = value
    form.get('proxyurl').value = get_dict_value(properties,
                                                "Proxy.Configuration", "URL")
    form.get('proxyservers').value = get_dict_value(properties,
                                                    "Proxy.Configuration",
                                                    "Servers")
    form.get('proxyexcludes').value = get_dict_value(properties,
                                                     "Proxy.Configuration",
                                                     "Excludes")
    form.get('ipv4method').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Method")
    form.get('ipv4address').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Address")
    form.get('ipv4netmask').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Netmask")
    form.get('ipv4gateway').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Gateway")
    form.get('ipv6method').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Method")
    form.get('ipv6address').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Address")
    value = get_dict_value(properties, "IPv6.Configuration",
                           "PrefixLength")
    if value != "":
        value = "%d" % value
    form.get('ipv6prefixlen').value = value
    form.get('ipv6gateway').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Gateway")
    form.get('ipv6privacy').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Privacy")
Exemple #9
0
def view():
    rendered = form.render()
    return add_technology_links(rendered,
                                form.get("bluetooth").value)
Exemple #10
0
 def GET(self):
     if(session.user == "anonymous"):
         return "Seccion restringida"
     
     form = profileForm()
     userName = str(session.user).lower()
     
     userData = loadUser(userName)
     
     form.get("nickName").value = session.user
     form.get("name").value = userData["name"]
     form.get("surname").value = userData["surname"]
     form.get("dni").value = userData["dni"]
     form.get("email").value = userData["email"]
     form.get("day").value = int(userData["day"])
     form.get("month").value = int(userData["month"])
     form.get("year").value = int(userData["year"])
     form.get("address").value = userData["address"]
     form.get("payWay").value = userData["payway"]
     form.get("password").value = ""
     form.get("passwordConfirm").value = ""
     
     content = render.formtest(form, "Guardar")
     return getContent(content)
Exemple #11
0
def update_fields(service_id):
    properties = get_properties(service_id)
    if not properties.keys():
        return

    if get_value(properties, "AutoConnect") == "true":
        autoconn = "Yes"
    else:
        autoconn = "No"
    form.get('autoconnect').value = autoconn

    form.get('nameservers').value = get_str_value(properties,
                                                  "Nameservers.Configuration")
    form.get('timeservers').value = get_str_value(properties,
                                                  "Timeservers.Configuration")
    form.get('domains').value = get_str_value(properties,
                                              "Domains.Configuration")
    value = get_dict_value(properties, "Proxy.Configuration", "Method")
    if value == "":
        value = "auto"
    form.get('proxymethod').value = value
    form.get('proxyurl').value = get_dict_value(properties,
                                                "Proxy.Configuration", "URL")
    form.get('proxyservers').value = get_dict_value(properties,
                                                    "Proxy.Configuration",
                                                    "Servers")
    form.get('proxyexcludes').value = get_dict_value(properties,
                                                     "Proxy.Configuration",
                                                     "Excludes")
    form.get('ipv4method').value = get_dict_value(properties,
                                                  "IPv4.Configuration",
                                                  "Method")
    form.get('ipv4address').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Address")
    form.get('ipv4netmask').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Netmask")
    form.get('ipv4gateway').value = get_dict_value(properties,
                                                   "IPv4.Configuration",
                                                   "Gateway")
    form.get('ipv6method').value = get_dict_value(properties,
                                                  "IPv6.Configuration",
                                                  "Method")
    form.get('ipv6address').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Address")
    value = get_dict_value(properties, "IPv6.Configuration", "PrefixLength")
    if value != "":
        value = "%d" % value
    form.get('ipv6prefixlen').value = value
    form.get('ipv6gateway').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Gateway")
    form.get('ipv6privacy').value = get_dict_value(properties,
                                                   "IPv6.Configuration",
                                                   "Privacy")