[web2py] Re: How can I update a row dynamically from vars?

2014-07-12 Thread Annet
Doesn't this work? db.post(id=ID).update_record(FIELD=VALUE) Regards, Annet -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message

Re: [web2py] How can I update a row dynamically from vars?

2014-07-12 Thread Vinicius Assef
You can create a dict and pass to update: def post_update(): ID = request.vars.id FIELD = request.vars.field VALUE = request.vars.value data = {FIELD: VALUE} db(db.post.id==ID).update(**data) Note: this solution is pure Python. No feature from Web2py here. On Sat, Jul 12, 2014 at

[web2py] Re: functional test

2014-07-12 Thread 黄祥
a, pardon me, i realized my mistaken, i've complicated it. *modules/functional_test.py* #!/usr/bin/env python # coding: utf8 import sys; sys.path.append('../../../') from gluon.contrib.webclient import WebClient client = WebClient('http://127.0.0.1:8000/testapp/', postbacks =

[web2py] How can I update a row dynamically from vars?

2014-07-12 Thread Najtsirk
Hi, let say that i pass vars id, field & value to a controller. Than I want to preform an update. def post_update(): ID = request.vars.id FIELD = request.vars.field VALUE = request.vars.value db(db.post.id==ID).update(FIELD=VALUE) This, obviously, does not work. How can I achieve th

Re: [web2py] ¿How to hide app, controller and function from url?

2014-07-12 Thread Vinicius Assef
You can use routes. On Sat, Jul 12, 2014 at 9:17 AM, Lisandro wrote: > I'm quite a novice regarding to regular expresions, and I'm stuck with this > idea: I want to hide appname, controller and function from specific url, > lletting visible only the arguments of the url. > > For example, for this

[web2py] My gulpjs experiment to allow coffeescript jade and stylus inside web2py

2014-07-12 Thread António Ramos
after learning about gulp.js i had to do this https://www.youtube.com/watch?v=zt5gnKk40Zw my Gulpfile.coffee gulp = require 'gulp' stylus = require 'gulp-stylus' prefix = require 'gulp-autoprefixer' cssmin = require 'gulp-cssmin' jade = require 'gulp-jade' minifyHTML = re

[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Anthony
Sure. Note, you don't need to replace the whole widget -- just update the attribute directly: form.element('input', _id='%s_%s' % (table_name, field.name)).update( data={'show-trigger': '%s_%s' % (table_name, field.show_if.first.name)}) Anthony On Saturday, July 12, 2014 4:38:58 PM UTC-4, L

[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Louis Amon
I think a framework like web2py shouldn't break by default, and work only if you know which parameter to set. Anyway here's a better example: db.define_table('person', Field('name')) db.define_table('other', Field('show_trigger', 'boolean')) db.person.name.show_if = (db.other.show_trigger ==

[web2py] Hidden fields: a more complete approach

2014-07-12 Thread Louis Amon
I want a hidden input with a custom attribute (e.g.: data-geo) to be stored in the database upon form validation. How can I achieve this ? 1. Adding raw html to a custom form, although custom forms have a lot of drawbacks in web2py 2. Messing with DOM. At your own risks.

[web2py] Re: functional test

2014-07-12 Thread Anthony
Have you confirmed that "CHOPARD" is in the HTML delivered by the server? Note, the webclient will not run any Javascript or Ajax requests, so if "CHOPARD" is added to the DOM via Javascript after the initial HTML is sent from the server, you won't be able to test for it. Anthony On Saturday,

[web2py] Re: What is the proper way to truncate a table from appadmin?

2014-07-12 Thread Anthony
Put db.trip.id > 0 in the query and check the delete box. Anthony On Saturday, July 12, 2014 11:51:58 AM UTC-4, JoeCodeswell wrote: > > Dear web2py-users, > > What is the proper way to truncate table from appadmin? > > The following does a truncate but shows errors in response.flash. > > In https

[web2py] Re: Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Anthony
Instead, you can just do this: form = SQLFORM.factory(db.person, table_name='person') Anthony On Saturday, July 12, 2014 2:02:45 PM UTC-4, Louis Amon wrote: > > Not sure if somebody noticed before, but the show_if syntax (backed by > web2py.js) is actually breaking if you use SQLFORM.factory to

[web2py] Enhancement : show_if in SQLFORM.factory

2014-07-12 Thread Louis Amon
Not sure if somebody noticed before, but the show_if syntax (backed by web2py.js) is actually breaking if you use SQLFORM.factory to generate your form. Example: db.define_table('person', Field('name', 'string'), Field('show_trigger', > 'boolean')) > db.person.name.show_if = (db.person.show_t

Re: [web2py] Easy to Understand SQLFORM.grid Custom Search

2014-07-12 Thread villas
I would also like to add an optional 'extra' because it is nice to be able to search like this: search_text = '"David Cameron" uk' By quoting search 'phrases' as well as words, you can get a better result. After all, I would not want every David in the UK to be listed. I have found tha

[web2py] What is the proper way to truncate a table from appadmin?

2014-07-12 Thread JoeCodeswell
Dear web2py-users, What is the proper way to truncate table from appadmin? The following does a truncate but shows errors in response.flash. In https:// ...appadmin/select/db?query=db.trip.id%3E0 Query: Update: [x] db.trip.truncate() Delete: [ ] RESULT: db.trip is truncated

Re: [web2py] Re: CKeditor in a loaded component

2014-07-12 Thread Jim Steil
I'm aware of that. But I can't get it to work inside if s component loaded on my page. Works fine when not in a component. Jim On Jul 12, 2014 4:33 AM, "Tim Richardson" wrote: > The plugin is on web2pyslices and can be installed via admin. The book > talks about using web2pyslices and plugins.

[web2py] ¿How to hide app, controller and function from url?

2014-07-12 Thread Lisandro
I'm quite a novice regarding to regular expresions, and I'm stuck with this idea: I want to hide *appname, controller and function* from specific url, lletting visible only the arguments of the url. For example, for this url: http://mydomain.com/init/default/store/erbalito should look like this

Re: [web2py] Re: can web2py expose coffee files to allow source maps ?

2014-07-12 Thread António Ramos
The link has a transcription to text of the video comments Em 12/07/2014 08:49, "Massimo Di Pierro" escreveu: > What does the video say? Can you summarize it? I have limited bandwidth > today. > > On Friday, 11 July 2014 17:22:24 UTC-5, Ramos wrote: >> >> Can this help to use coffeescript instead

[web2py] Re: functional test

2014-07-12 Thread 黄祥
hi, pardon me for opening the old discussion. i had controllers (master.py) that contain grid function (brand), and want to test it in command prompt (functional test), yet in the web browser it show the value (running well as expected), but not in the terminal. any idea what's going on the ba

[web2py] Re: Selecting posts with multiple categories

2014-07-12 Thread Massimo Di Pierro
Do not do dal queries in a try..except. If the db query fails it may not be automatically rolled back. I think you want: category = request.args(0) and db.blog_cat(slug=request.args(0)) query = db.blog_post.blog_cat.contains(category.id) if category else db.plog_post posts = db(query).select(ord

[web2py] Selecting posts with multiple categories

2014-07-12 Thread Ruud Schroen
Hi group! I'm building a small blog where the user has the ability to assign multiple categories to blog posts. My quesition is.. what is the proper way to query those posts? db.define_table('blog_cat', Field('name', 'string', label=T('Name of the category')), Fie

[web2py] Re: CKeditor in a loaded component

2014-07-12 Thread Tim Richardson
The plugin is on web2pyslices and can be installed via admin. The book talks about using web2pyslices and plugins. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Iss

[web2py] Re: can web2py expose coffee files to allow source maps ?

2014-07-12 Thread Massimo Di Pierro
What does the video say? Can you summarize it? I have limited bandwidth today. On Friday, 11 July 2014 17:22:24 UTC-5, Ramos wrote: > > Can this help to use coffeescript instead of javascript ? > > > http://tarantsov.com/WorkflowThu/source-maps-with-coffeescript-and-uglify-js/ > > web2py does not

[web2py] Re: Encode problem in response.cookies

2014-07-12 Thread Massimo Di Pierro
I am not 100% sure but why are you storing information in cookies when not in session? It is more error prone and does not add anything. Are you disabling sessions for speed somehow? On Friday, 11 July 2014 11:23:13 UTC-5, Arthur Alves wrote: > > Hello guys, > > I have a problem with response.c

[web2py] Re: app engine bug? Invalid view reported for app engine but not elsewhere

2014-07-12 Thread Massimo Di Pierro
This is a security issue. All action (defined as functions in controllers) but have a view, unless accessed locally. This prevents you for accidentally exposing internal objects. On Friday, 11 July 2014 10:34:44 UTC-5, Carl Hunter Roach wrote: > > In my default.py I add a function newview > > wh

[web2py] Re: update_or_insert - handling record created/modified timestamps

2014-07-12 Thread Massimo Di Pierro
Mind web2py offers all of this out of the box: db.define_table('stuff',Field('name'), auth.signature) auth.signature adds created_on, created_by, modified_on, modified_by and is_active. These fields can be used by auth for full auditing if enabled by auth.enable_record_versioning(db) Any

[web2py] Re: Process uploaded file

2014-07-12 Thread Massimo Di Pierro
for example, let's say you want to upload text files. db.define_table('one',Field('filename','upload'),Field('processed','boolean',default=False,writable=False)) db.define_table('two',Field('one','reference one'),Field('results','text')) def index(): return dict(form = SQLFORM.grid(db.one))

[web2py] Re: Running web2py with settings in a config file

2014-07-12 Thread Massimo Di Pierro
Can you try: --config=T:/MyFolder/etc/config.py It is not finding the file. On Thursday, 10 July 2014 03:56:37 UTC-5, Kuba Kozłowicz wrote: > > I have following project structure: > > T:/MyFolder/web2py.py > T:/MyFolder/etc/config.py > > I am trying to run the instance with following command: >

[web2py] Re: TV Centric websites

2014-07-12 Thread Massimo Di Pierro
I do not think there is any real issue here. You can create web applications with web2py that runs in a TV browser. It is mostly a matter of choosing a layout that fits the screen size and restrict to JS libraries that are supported by TV browsers. In fact any web2py app will run on a TV brows