FAQ Database Discussion Community


Kendo UI all elements of grid showing up on Kendo Console, but grid is not rendering

javascript,jquery,kendo-ui,web2py
Hi I'm using Kendo UI Javascript version. Having a real problem with the grids. Here is the html <div class="row"> <div class="main-container-section"> <div class="table1"> <span class="header_title">Portfolio Weighting</span> <div class="table-bg-white" id="grid"></div> </div> </div> </div> and here is the script (I'm using web2py as framework) <script> var data = {{=XML(thisdata)}}; $("#grid").kendoGrid({ columns:...

Conditional statement using request.env.http_referer Web2py

web2py
I am trying to use request.env.http_referer but it seems I am missing something. This is what I tried in the View: {{if request.env.http_referer != 'http://127.0.0.1:8000/test_wp/default/show_test/1':}} <h1>Something</h1> {{pass}} This works but depending on the args, the URL will have a different ending. How can I make this work with any number...

How to install packages into gluon.contrib with web2py

python,web2py
I want to install jsonpickle into web2py (mac osx yosemite, most recent version of web2py). I did: cd /Applications/web2py/Contents/Resources/gluon/contrib pip install jsonpickle -t . And it seemed to install nicely into that directory. However, in my module, I tried from gluon.contrib import jsonpickle, but it gave me an ImportError: No...

How to pass generic keyword arguments and values to the update_record() function in web2py

python,web2py
My application is submitting tiny bits of information from a form element via ajax (onblur) to the controller my_function. request.vars are <Storage {'my_field': 'the submitted data'}>. I understand that it is possible to update a record with db.table(id).update_record(the_field = 'text') if the_field is a field in the table. But I...

How to use the Comodo certificate in Web2py?

ssl,web2py
When using web2py, it asks a single ssl certificate file. But what I got from Comodo are two files, one .crt file and one .ca-bundle file. I tried with using only provide the .crt file when setting up web2py, in the beginning it works. But when I go to my...

How to self-submit a web2py-component at change-event

javascript,web2py
I load two different components (A,B), where i can drag and drop elements from A to B. Is it possible to trigger a "self-submit" on component B and pass arguments when the drag-target container is changed? Thanks in advance. Edit 1: The components are very simple solutions, A displays a...

Web2py - Insert Record in Second Tabel on Registration

web2py
I'm building a Web2py application that uses MongoDB as its primary database. To simplify authentication, I'm sticking with SQLite (eventually MySQL) for member management. When a user registers, a record is created in the SQL database. Upon registration, I'd like the same record to be inserted in MongoDB. I can...

Conditional fields for a SQLFORM.factory in web2py

python,web2py
Say I construct a form using SQLFORM.factory like so: my_fields = [Field('field1', default='some value'), Field('field2', default = 'some other value')] form = SQLFORM.factory(*my_fields) Now I want field2 to show only if field equals some value. However, when I try to do something like: my_fields[1].show_if = my_fields[0] == 'some value' (before...

How Initialize web2py with password in terminal

python,web2py,initializing
I need create a terminal alias for inicialize web2py, but I dont see how initialize the web2py with password parameter. I edit the "~/.bashrc" like this: alias w2p="python web2py -p 8000" And I need put the password here too. Exists some parameter for this ou another way?...

How to filter words in db.body

web2py,web2py-modules
I am working on a program that I want to filter out some words, with nltk style of removing the stopwords as follows: def phrasefilter(phrase): phrase = phrase.replace('hi', 'hello') phrase = phrase.replace('hey', 'hello') phrase = re.sub('[^A-Za-z0-9\s]+', '', phrase.lower()) noise_words_set = ['of', 'the', 'at', 'for', 'in', 'and', 'is', 'from', 'are', 'our',...

Google App Engine, Web2Py, and Cron, unable to assign value to attribute for url error

python,google-app-engine,cron,web2py
I'm having some trouble creating a Google App Engine Cron task for my Web2Py application. I've looked at the instructions for GAE Cron, and this is the task I created as a test: my cron.yaml file is in the same directory as my app.yaml, the path to my python controller...

web2py form with DB check [closed]

forms,validation,web2py
I'm using web2py forms, but I need to set up a limit for 20 users registration. How can I do it? PS: Edit to make easy to understand Thanks in advance. Best regards!...

Multiple Validators for a single field

python,validation,web2py
I have a table nsksystem which is getting value for its two field nskmachinename and nskreleaseid from another table nskrelease. The requirement is nsksystem.nskreleaseid + nsksystem.nskmachinename should be unique and nsksystem.nskreleaseid is from nskrlease database. I am not enforcing any constraints in table. db.define_table('nsksystem', Field('nskuserid',length=512,requires=IS_EMAIL(error_message='invalid email!'),default = auth.user.email if auth.user...

What does 'times=X' in Web2py LOAD-helper?

web2py
In the Web2Py book I found this: It states that: times specifies how many times the component is to be requested. Use "infinity" to keep loading the component continuously. This option is useful for triggering regular routines for a given document request. How and when could this be used?...

web2py: global name 'crud' is not defined

python,web2py
I am currently following a web2py tutorial and I am asked to append to my controls/default.py: def entry_post(): """returns a form where the can entry a post""" form = crud.create(db.post) return dict(form=form) Which is fine but if I try to go to: mywebsite/app/default/entry_post I get a ticket error: global name...

Fixing cursor issues in Web2Py on Google AppEngine?

python,google-app-engine,web2py
I have a simple UI for interacting with a database set up on a Google AppEngine application using Web2Py. I'm using the default Grid builder to settings to display it. Here is my full controller function: @auth.requires_login() def managePeople(): # To hide the ID column from being seen on this...

Can not run the web2py scheduler using postgresql database

postgresql,web2py,scheduler
I can run the scheduler using sqlite database, but I will got the error when I change to using postgres database. Code (task.py): def AutoRemoveCacheData(): return 'OK' from gluon.scheduler import Scheduler scheduler = Scheduler(db,dict(AutoRemoveCacheData=AutoRemoveCacheData),migrate=True) Error message: [email protected]:/var/www/web2py# python web2py.py -K ScheduleApp web2py Web Framework Created by Massimo Di Pierro, Copyright...

Web2py - Custom Registration & Login Form in One

web2py
I'd like to allow users to register and login from one form. The form would require only an email address and a password. If a user enters an email address that does not exist, I'd like to register the user with the email address and password combination provided. Otherwise, the...

Is it unsafe to insert data from ajax requests to the database in web2py

web2py
Is it possible to insert malicious code via ajax requests from input fields to the database if the data is not form-processed? The DAL connection is used....

performance advantages of using bottle for routing?

python,performance,architecture,web2py,bottle
I started developing a web application based on the bottle web framework a couple of years ago. I chose Bottle at that time because it was the easiest solution to get up and running fast, and I was just working on building a prototype of an idea I had. Now,...

How to read a JSON static file in web2py

python,json,web2py
I'm putting together my first web2py app, and I've run into a bit of a problem. I have some data stored in static/mydata.json that I'd like to access in a couple places (specifically, in one of my models, as well as a module). If this were a normal python script,...

web2py serving zip file

zip,web2py,icalendar
I am trying to create and serve a zip file for user that contains ical files for different workers (each worker has his own ical file) The problem is that i get the right number of iCal files in my zip but the last file has all the data from...

How to add a SSL certificate after running Web2py 'one step production deployment'

python,linux,ssl,web2py
I have set up a web2py environment on a linux server using the 'one step production deployment' descriped in the web2py document. Now I can go to my website by typing my domain name into a web browser, except now it is untrusted by the browser. Then I got a...

Web2py: Can you password protect a page?

web2py
The specific functionality I'm looking for: A member creates a page to display information. The member can keep the page public, or set to "private" so that only a select group can view it. When the member sets the page to private, they enter a password. The member then shares...

Web2py Authentication for Restful service and also application users

web2py,restful-authentication
In web2py we can have restful services as mentioned below, auth.settings.allow_basic_login = True @auth.requires_login() @request.restful() def api(): def GET(s): return 'access granted, you said %s' % s return locals() This service will be called by external system. Now how to define two level of service usage. One user who can...

Web2py: Submit Javascript Vars with Form

javascript,web2py
I'm attempting to submit additional data to the server when I submit a form. Here is the form: <form class="class" action="{{=URL('default','function')}}" method="post"> <input type="text" id="first" name="first" class="span3"/> <button id="button" type="submit" class="btn">Submit</button> </div> </form> I've tried to do submit the additional data a couple different ways: <script> $('#button').submit(function(){ var cost =...

web2py CAS custom fields

single-sign-on,web2py,cas,jasig
I've setup my web2py application to work with JASIG CAS (CAS 2) as follows in db.py: from gluon.contrib.login_methods.cas_auth import CasAuth auth.settings.login_form=CasAuth( urlbase = "https://sso.mysite.co.za", actions = ['login','serviceValidate','logout'], casversion = 2, casusername = "cas:user") My CAS server is configured to pass some custom fields, which I've added as such on the...

Rendering HTML from a python String in web2py, generate @usename links python

javascript,jquery,python,html,web2py
Rendering HTML from a python String in web2py I am trying to render an anchor link in an html file generated server side in web2py <a href="http://app/default/profile/">@username</a> and the link generates correctly; however when I call it in my view {{=link}} the page does not render it as HTML. I...

Auth user message when user is logged in Web2py

web2py
I am doing a project where I am not using the default layout.html. In this case, how can I display the "Welcome User" message when the user is logged in? I looked through everything but I can't figure out how to do it....

Web2py - Setting Title & Meta Tags in Views

web2py
I'm attempting to set unique title and meta tags for each of my views. If I set tags in the following way at the top of my view... {{ response.title='My Product view' response.meta.keywords='phones,calls,smartphone' response.meta.description='This is a phone seller site made with web2py' response.meta.author='me' }} {{extend 'layout.html'}} ...the tags appear to...

web2py custom reset password

python,web2py,reset-password
How to create custom reset password form in Web2Py? request_reset_password def request_reset_password(): site_url = 'www.site.com/myproject/' auth.settings.request_reset_password_next = URL('account', args='request sent') auth.messages.reset_password ='please click this link http://' + site_url+ 'account/reset_password'+ '/?key='+'%(key)s to reset your password' form= auth.request_reset_password() form.custom.submit['_data-theme'] = 'e' form.custom.submit['_data-ajax'] = 'false' return dict(form=form) reset_password def reset_password():...

Web2py with Multiple Controllers

web2py
I have a Web2py application in production that contains more than 40 functions in the default controller. Some functions are reasonably complex, consisting of a few hundred lines of code that manage a web of database transactions, while others are relatively simple. When should developers think about using multiple controllers...

Database field length is not enforced

python,sqlite3,web2py
I am using web2py (python) with sqlite3 database (test flowers database :) ). Here is the declaration of the table: db.define_table('flower', Field('code', type='string', length=4, required=True, unique=True), Field('name', type='string', length=100, required=True), Field('description', type='string', length=250, required=False), Field('price', type='float', required=True), Field('photo', 'upload')); Which translates into correct SQL in sql.log: CREATE TABLE flower( id...

mail.send() feature in web2py for bounced email/ email address that doesnt exist

python,email,gmail,web2py
So I made a small app that sends emails from web2py, connected to the gmail smtp server. The problem here is that it always gives me a success message! Even when the email-id is invalid. I have tested the bounce back feature of gmail by sending mails from gmail to...

running web2py scheduler in production

python,deployment,web2py,production-environment
I know that I can run the scheduler manually by using python web2py.py -K myapp But where should this be specified in production environment? I am using standard web2py deployment script for apache, on ubuntu....

how to let the domin ip point to a web2py app instead of the default “welcome” app

apache,mod-wsgi,web2py
I want to enter my app by http://my.domain.ip/ instead of http://my.domain.ip/myapp.should I change the apache config(conf.d/deault.conf) or do something else? I want to bind some domin names to other apps in web2py/applications if this domin ip test success. NameVirtualHost *:80 NameVirtualHost *:443 <VirtualHost *:80> WSGIDaemonProcess web2py user=apache group=apache processes=1 threads=1...

web2py displays id too

python,database,field,web2py
I got this code in default.py : form_0 = SQLFORM(db.base_folder, record=db.base_folder(1)) query = db.base_folder.folder != '' set = db(query) rows = set.select() if rows: form_0.vars.folder = rows[0]['folder'] and in db.py : db.define_table( 'base_folder', Field('folder', type='string', default='You need to set up a directory to backup to !', ), format='%(folder)s' ) and...

Web2py with paramiko for ssh functionality

python,ssh,web2py,paramiko
I have a form built via web2py that i need to use to validate and register a machine and store it into a database. The validation is not passing through. I am always getting error that "Houston there seems to be a problem with Machine name or super password". If...

The correct way to implement login with google account

oauth-2.0,google-plus,web2py,janrain
What is the correct way to implement user login with google account in web2py? I can not use janrain (for some reason there is no google option when choosing widgets in my account, but google is configured as a provider.)

web2py: module function that behaves normally in shell fails browser mode

function,python-2.7,web2py
I have a very simple helper function that helps creates column definitions for a javascript framework I"m using. def tocol(fields,title=None,width=None,attributes=None): cols = dict((name,eval(name)) for name in ['title','width','attributes'] if eval(name) is not None) cols["field"] = fields return cols when I try this in a web2py shell the result is as I'd...

Web2py: Limiting a dropdown value only to Logged in user

python,forms,validation,web2py
I am trying this form a while. I have a page which displays a form and whose databse definition looks like: db.define_table('nskrelease', Field('sprid',length=128,requires=IS_IN_SET(['R3.2', 'R3.3', 'R3.4'],zero=T('choose one'),error_message='must be R3.2 or R3.3 or R3.4 '),label = T('SPR')), Field('releaseid',length=128, requires = IS_NOT_EMPTY(error_message='Release ID cant be empty'),label = T('Release')), Field('coordinator',requires=IS_EMAIL(error_message='invalid email!') ,label=T('Co-ordinator Email')), Field('startdate',...

Web2py - Run Loop & Break Loop Without Locking Application

python,selenium,web2py
Not sure how to approach this type of problem (let alone do it efficiently). In my application, users should be able to click a button to initiate a process via ajax. They should also be able to stop that process at any time by clicking a stop button. Something like:...

web2py SQLFORM.grid () get field values on process

sql,forms,grid,web2py
on my edit/add page for SQLFORM.grid I would like to get the values of some fields on process. In case this value in combination with another field (userid) already exists user has to be notified about it. any suggestions?...

web2py error: You might need to add explicit type casts

python,sql,web2py
I have web2py application for which I have to write an SQL query. There is a table called homework in which the column of my interest is receiver. This column contains a list of students who have received the assignment. This column is created by db.define_table('homework', Field('title'), Field('description'), Field('sender', db.auth_user),...

ImportError: cannot import name secure_dumps

web2py,data-access-layer,bottle
I'm trying to use a standalone version of web2py's DAL. I have looked at a couple other posts (here and the link referenced therein) but still haven't been able to solve the problem. What I have done is copied the gluon folder from the web2py directory into my diretory, and...

Web2py - Howto Auto Convert Username field to uppercase

python,ldap,web2py,web-frameworks
I am looking to have all users that sign in have their name converted(Transformed) to uppercase in the DB records or before it hits the DB. Currently I am using LDAP. So people are free to use sign ins like this: ['PREACTIVE','Preactive','preactive','PREactive','preACTIVE'] Each one of those will get a new...

web2py - Unit testing @auth.requires_login()

python,unit-testing,web2py,python-unittest
All, I have created a unit test for my web2py app. I mainly followed this slice: http://www.web2pyslices.com/slice/show/1465/unittesting-doctesting-and-userinterface-testing I can register and login users with tests. I cannot however get around the problem of testing the auth.requires_login() decorator. I run tests that log the user in, i can see the resultant...