[web2py] Re: grid that only show search field

2015-03-16 Thread Val K
Hi! Yes, it is possible: search query store in request.vars.keywords if request.vars.keywords is not None - just redefine fields' list. There are some gotchas - if query (i.e. request.vars.keywords) will be not precise, i.e. it will be not containing table_name.field_name, it will search

[web2py] Re: SQLForms DAL error

2015-03-16 Thread Val K
Hi! As I see, you defined your table in the db.py, but 'db=DAL(...) ' is already exist in this file, I mean auth-settings and etc. If you want to use another database for your tables, I suppose, you must use another storage (not storage.sqlite) and another name for it ('my_db' instead 'db' for

[web2py] Re: DAL: INSERT-query's devilry

2015-03-16 Thread Val K
OK pydal.py/base.py: TABLE_ARGS=set((... , 'insert_with_returning')) pydal.py/objects.py: class Table(object): ... def __init__(...): ... self._insert_with_returning=args.get('insert_with_returning', True) ... pydal.py/adapters/postgres.py: def

[web2py] Re: SQLFORM with IS_IN_SET(..., multiple=True) not SELECTED in FORM

2015-03-20 Thread Val K
Hi Robin! Are you sure that your record is not None? (If it's None you just get insert-mode, no error) Check field's type, it must be list:string/list:integer On Friday, March 20, 2015 at 11:52:29 AM UTC+2, Robin Manoli wrote: Hi! Using an SQLFORM with a Field that has IS_IN_SET(...,

[web2py] Re: web2py creating subfolders

2015-03-20 Thread Val K
Hi I hope this will help you: calling custom_store and custom_retrieve using parameters https://groups.google.com/forum/#!topic/web2py/8X-QlbtyxEQ On Friday, March 20, 2015 at 5:02:57 PM UTC+2, Vikash Sharma wrote: Hi I would like to create subfolders for uploading documents as per name

[web2py] Re: Secure view {{code}} - disabling import and dangerous commands

2015-03-21 Thread Val K
{{code}} - it's not pure Python, it's using Python as template language From {{code}} it's possible to access all web2py environment (session, request and etc. ) I think, If you want to execute users' code at your server, you have to execute it as separate process under truncated system account

[web2py] web2py book, upload field

2015-03-21 Thread Val K
There is nothing about custom_store/custom_retrieve options of upload field in the web2py book. Why? -- 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

[web2py] cannot perform INSERT RETURNING on VIEW

2015-03-10 Thread Val K
Hi! I am falling in love with web2py!!! But I had got a little problem when migrated to 2.9.11-stable+timestamp.2014.09.15.23.35.11. After submit INSERT-form, I had got an error: class 'psycopg2.NotSupportedError' cannot perform INSERT RETURNING on relation table_view HINT: You need an

[web2py] Re: DAL: INSERT-query's devilry

2015-03-11 Thread Val K
OK guys! My concrete suggestion: - Add attrubute _insert_with_returning to Table class - Fix adapter Postgres.py : def _insert(self, table, fields): table_rname = table.sqlsafe if fields: keys = ','.join(f.sqlsafe_name for f, v in fields)

[web2py] Re: DAL: INSERT-query's devilry

2015-03-13 Thread Val K
Thanks for your reply! You are right, if we are talking about some application with full built-in logic and it would like to be independent on any DBEngine. But IMHO there are a lot of opposite situations: DB-App with many different clients. In this case VIEW is very helpful solution, it

[web2py] define_table argument is not a Field or Table. (Table Subclass)

2015-03-24 Thread Val K
Hi! I try to define subclass of Table: model.py: - db=DAL('sqlite://...') from dal.objects import Table , Field class my_tab(Table): def __init__(self, db, tablename, *fields, **args): fields=( Field('num', 'integer'),

[web2py] SQLite: select within transaction

2015-03-31 Thread Val K
Hi! Here is controller's logic: 1. Get field value: fld_v= db.table[i].any_field 2. Evaluate new value depending on existing one: new_fld_v=fun(fld_v) 3. Update record with new value: db(db.table.id==i).update(any_field=new_fld_v) The problem: After

[web2py] Re: SQLFORM.factory adding dynamic form

2015-03-23 Thread Val K
I think, there is no problem, but I am not sure that I understand what you want: - do you want to edit/insert multiple records of/to the same table (person-address-relation for example) at once, per single form's accept? - do you want to edit/insert single records of/to few tables at once? or

[web2py] Re: Working with MSSQL with codepage other than latin1 or unicode

2015-03-23 Thread Val K
Hi! If you haven't solved this problem yet try something like this: def MSACCESS_adapt(s,f): for it in f.items(): if type(it[1])==str: f[it[0]]=it[1].decode('utf8').encode('1251') elif type(it[1])==datetime.datetime: f[it[0]]=it[1].strftime('%Y-%m-%d %H:%M:%S')

[web2py] Wanted abstract SQLFORM.grid, i.e. GRID like HTML-helper

2015-04-04 Thread Val K
Hi! SQLFORM.grid is very useful tool, but would be better to have a similar HTML-helper without any link to DAL. I'm thinking about a Class with some method (search/create/edit/delete) that can be assigned to custom functions. Is there anything was done in that scope? I've found the issues#680

[web2py] Re: SQLite: select within transaction

2015-04-01 Thread Val K
, Val K wrote: Hi! Here is controller's logic: 1. Get field value: fld_v= db.table[i].any_field 2. Evaluate new value depending on existing one: new_fld_v=fun(fld_v) 3. Update record with new value: db(db.table.id==i).update(any_field=new_fld_v

[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2015-08-09 Thread Val K
Hi! I have the same problem (twice submission). Here is my little test: #paste in default.py #!!! for pure test clean cookies before run!!! def print_form_keys(): ret=DIV(_class=container) for i in xrange(5): frm_k= '_formkey[%s]' % ('frm_id%s/create'%i) #- see html.FORM

[web2py] Re: web2py return list of uploaded files with original filenames

2015-08-12 Thread Val K
Hi! Here is my solution for upload/download files with originals filename. I hope it help you. 1. Make a *modUle* file (don't confuse with m*O*del ) with name *file_serv.py: * # coding: utf8 # # - file_serv.py --- from gluon import * import os import shutil #

[web2py] Re: Ajax callback with current select value

2015-08-17 Thread Val K
Hi, Gael! I think in ajax call must be [name='my_select'] or just '[name]' -- 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

[web2py] Re: pass javascript value into sqlform

2015-08-16 Thread Val K
Just for fun - paste in any controller and go to .../sql_frm_js def sql_frm_js(): t_name='any_tbl' # just for more readable because SQLFORM.factory f1_name='any_fld_1' f2_name='any_fld_2' f_id=lambda f, t=t_name: '%s_%s'%(t, f) # return id of html INPUT-element corresponding to

[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2015-08-11 Thread Val K
). This is mentioned in the book: http://web2py.com/books/default/chapter/29/03/overview?search=win32. For more details, see https://docs.python.org/2.7/using/windows.html#pywin32 Anthony On Monday, August 10, 2015 at 8:06:12 PM UTC-4, Val K wrote: As I see, the problem is that ajax request (may

[web2py] Re: Ajax callback with current select value

2015-08-11 Thread Val K
Hello. Keep in mind that ajax() - is a simple web2py function which is based on Jquery (see web2py.js , its code is very short and clear) It can pass to controller the values of the input elements only, see http://api.jquery.com/serialize/. So your select controls must have a name -

[web2py] Re: Multi file upload

2015-08-13 Thread Val K
Hi! It seems, that your view has no form-tag (i.e. form ... ) and no submit-button ... so, I suppose, it doesn't send anything at all! But may be there are some mega-cool-js-hidden-magic? How it works? On Wednesday, August 12, 2015 at 11:36:43 PM UTC+3, Luis Valladares wrote: Hello!

[web2py] Re: Field validatio with multiple columns

2015-08-13 Thread Val K
Forget all what you've read there (joke) If you want this rules works anywhere and independent of any insert/update EVEN BY PROGRAM - use db.table._before_insert/update and so on (see http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer ) It's almost SQL-level, I

[web2py] Re: error with list:reference table

2015-08-13 Thread Val K
I try 'list:reference table' and it doesn't work at all ! (even DB-admin!) (2.12.1-stable+timestamp.2015.08.07.07.22.06 (Running on Rocket 1.2.6, Python 2.7.9)) - run from source on Win7x32 I got: type 'exceptions.TypeError' isinstance() arg 2 must be a class, type, or tuple of classes and

[web2py] Re: Keep values with a list:string field?

2015-08-13 Thread Val K
Hello! Looks some terrible, but does what you want! Just paste in any controller and go to .../list_fld_keep_values_tst or you can preset list-values by URL('your_controller', ' list_fld_keep_values_tst', vars=dict(defs=['val_1','val_2','val_3'])) def list_fld_keep_values_tst():

[web2py] Re: Field validatio with multiple columns

2015-08-13 Thread Val K
Forget all what you've read there (joke) If you want this rules works anywhere and independent of any insert/update EVEN BY PROGRAM - use db.table._before_insert/update and so on (see http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer ) It's almost SQL-level, I

[web2py] Re: error with list:reference table

2015-08-13 Thread Val K
may be there are any workaronds to prevent error and it is still in your code. -- 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

[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2015-08-09 Thread Val K
I realize your advice - no effect! I analyzed *session.connect* and found strange place at the biginig of *connect *definition: ... self._unlock(response) # - *unconditional unlock *session file witch have a name == response.session_id ... Then I changed definition of ajx_bug():

[web2py] Re: Multiples ajax forms (with LOAD). It is possible?

2015-08-10 Thread Val K
still be completing one after another). It would be helpful if you could attach a minimal app that demonstrates the problem. Anthony On Sunday, August 9, 2015 at 12:30:01 PM UTC-4, Val K wrote: I realize your advice - no effect! I analyzed *session.connect* and found strange place

[web2py] Re: Ajax callback with current select value

2015-08-12 Thread Val K
know why? Regards. Il giorno martedì 11 agosto 2015 22:32:06 UTC+2, Val K ha scritto: Hello. Keep in mind that ajax() - is a simple web2py function which is based on Jquery (see web2py.js , its code is very short and clear) It can pass to controller the values of the input elements only

[web2py] Re: PostgreSQL

2015-10-28 Thread Val K
Postgresql can be fully portable and runing from flash (including PgAdminIII). All you need - write batch-file in few rows. It's fantastic, I love it! On Wednesday, October 21, 2015 at 4:30:28 PM UTC+3, Massimo Di Pierro wrote: > > >

[web2py] Form DOM: Search selected option's text

2015-12-10 Thread Val K
Hi! It just to help others I wasted a pair hours to find right matching expression for searching selected option's *text*-value (not key-value ). It must be like: selected_opt_text = form.element('[name=my_select_field_name] option[ *selected=selected*]')[0] just *'... option[selected]'*

[web2py] Re: Form DOM: Search selected option's text

2015-12-11 Thread Val K
r 2015 14:10:01 UTC-6, Val K wrote: >> >> Hi! >> It just to help others >> >> I wasted a pair hours to find right matching expression for searching >> selected option's *text*-value (not key-value ). It must be like: >> >> selected_opt_text = form.elem

[web2py] Re: Pre-populated Forms

2015-12-11 Thread Val K
1. get prototype record 2. overwrite field.default with corresponding prototype value 3. don't pass record to SQLFORM On Monday, December 7, 2015 at 7:15:46 AM UTC+3, Anthony Smith wrote: > > Hi All, > > I have a products table: > db.define_table('product', >

[web2py] DB design

2015-12-26 Thread Val K
I'm not IT-specialist, but I know any theory has own root-idea that may be explained by fingers. I was looking for it in DB theory and I've found it for myself! It is "PerformanceDBA" 's articles at StackOverflow. I think these articles may be very useful for everyone. -- Resources: -

[web2py] Re: Pre-populated Forms

2015-12-18 Thread Val K
t; >> On Sunday, 13 December 2015 17:53:36 UTC, Anthony Smith wrote: >>> >>> Hi Val, >>> >>> Thanks for your reply, but unable to find any about get prototype record >>> in the book. >>> >>> Do you have an examples >>> >&

[web2py] Re: how to wrap an already existing input element in a new div in web2py

2015-12-18 Thread Val K
if you mean custom view of SQLFORM you can try something like this: def your_controller() ... form=SQLFORM(...) # or SQLFORM.factory ... form.process() ... # creating view - must be after form.process() fcw = form.custom.widget # see web2py book fcl = form.custom.label

[web2py] Re: Append fields within form, iteratively add fields inside form, List:string append, custom forms

2016-05-31 Thread Val K
Hi! Try this controller: def create_table(): a_list = 'My skills and experience:' form1 = SQLFORM(db.Project, hidden=dict(add_term_f1='')) form2 = SQLFORM(db.add_list_item, submit_button=' + Add', hidden=dict(add_term_f2='')) request.post_vars.added_term =

[web2py] Re: readonly field only in SQLFORgrid edit page if field is not empty

2016-05-26 Thread Val K
Where and how can I set the db.foobar.text.writable = False? request.args(1) = 'edit' On Thursday, May 26, 2016 at 12:46:45 PM UTC+3, Mike Constabel wrote: > > Hello, > > I try to find a solutiuon for a hopefully simple problem. > > Example: > > db.define_table("foobar", > Field("uuid",

[web2py] Re: Very simple issue: redirect on login - auth.settings.login_next

2016-05-26 Thread Val K
Hi! As I understand *requires() * designed to decorate and *back* redirection after login, so it ignores *auth.settings.login_next * If you want to redirect after login just do it from your *check_condition()* directly On Thursday, May 26, 2016 at 5:15:15 PM UTC+3, 黄祥 wrote: > >

[web2py] Re: This jquery conditional form at pg 505 in book doesn't work. What's the problem?

2016-01-14 Thread Val K
Hi! Try to replace *.attr('checked')* with *.prop('checked')* On Thursday, January 14, 2016 at 12:32:46 PM UTC+3, aston...@gmail.com wrote: > > I am using the latest web2py version > > On Thursday, January 14, 2016 at 2:58:00 PM UTC+5:30, aston...@gmail.com > wrote: >> >> db =

[web2py] Re: Field Type Data

2016-01-14 Thread Val K
Hi! See IS_DATETIME validator in the web2py book On Thursday, January 14, 2016 at 4:49:17 AM UTC+3, Lorenzo Zonca wrote: > > Goodmorning to everyone. > > Through a field "date " with calendar of a

[web2py] Re: Hide form field

2016-01-14 Thread Val K
hidden=dict(...) - just *extra *hidden fields, it doesn't change attributes of any Field(...) On Thursday, January 14, 2016 at 12:20:22 PM UTC+3, desta wrote: > > Thanks Massimo. I tried what you suggested but they are still visible. > > I was able to achieve what I want using: > form =

[web2py] Re: best advice on customer/client picklist popup.

2016-01-18 Thread Val K
Hi Lucas! I had similar problem and here is my solution: For search I use SQLFORM.grid with buttons (button per row) having data-attributes, for example, in your case attrs may be: data-client_id, data-client_name with corresponding values Then I use LOAD() with ajax_trap=True to embed

[web2py] Re: connection string syntax of postgres on pythonanywhere

2016-01-16 Thread Val K
try this 'postgres://alexglaros:myPassWord@alexglaros-97. postgres .pythonanywhere-services.com:10097/postgres_es

[web2py] Re: SQLFORM.grid and jQuery-bootgrid help

2016-01-17 Thread Val K
Hi! > Using Bootgrid the TD column html is converted into string. It's very strange, do you check your SQLFORM.grid without using Bootgrid? May be it happens (html to string) at server-side? In your example why do you set *data-formatter* if TD contains already rendered link? On Sunday,

[web2py] Re: Field Type Data

2016-01-14 Thread Val K
As I see you want to customize date format at form level, i.e. user picks the date from calendar and the field is filled with 'Monday ...' (name of the day) If it's what you want you can use the following: There are two JS-variables are used by calendar (see your_app/views/web2py_ajax.html):

[web2py] Re: OFF TOPIC: Collaborative data modeling environment

2016-02-07 Thread Val K
Hi Alex! Furtunaly, I'm thinking about the same! I mean the synchronization Postgres-DAL while developing. First of all, I belive you can find the script *extract_pgsql_models.py* in your web2py/scripts directiory, but it just generates models to stdout and you can improve it but why? So, I

[web2py] Embedding Rapydscript

2016-02-07 Thread Val K
Hi! Coding Python with switching to coding JS - really painful. So, I tried Rapydscript (RS) and I like it very much! Unfortunately, I couldn't find how to automate compilation RS-files to pure JS. Here is my solution to embed RS to web2py 1. Download and install Node.js

Re: [web2py] Embedding Rapydscript

2016-02-08 Thread Val K
this w/o extra coding, but I use Pyscripter only. On Monday, February 8, 2016 at 11:50:08 AM UTC+3, mcm wrote: > > Very nice. > Did you evaluate running compile_pyjs() as a web2py's scheduler task? > It could simplify your code and make it more resilient. > > > 2016-02-08

[web2py] Re: web2py UnicodeDecodeError: 'utf8' codec can't decode byte 0xc7 in position 15: invalid continuation

2016-02-08 Thread Val K
Hi! I had a similar problem with MS Access. Error like this means that your database encoding isn't utf-8, you should figure out which is it? After that, you can try to set db_codec to proper encoding (see DAL signature in the web2py book) On Thursday, February 4, 2016 at 5:52:02 PM UTC+3,

[web2py] Re: OFF TOPIC: Collaborative data modeling environment

2016-02-08 Thread Val K
It seems you haven't Python installed on your comp (Python isn't windows standard), you can try to use web2py/py.exe to process python-files On Monday, February 8, 2016 at 11:14:35 PM UTC+3, Alex Glaros wrote: > > looks like what I need Val > > can you direct me in how to run it? > > I typed

[web2py] Re: Problems with Upload files

2016-02-11 Thread Val K
I think you haven't from.process() form=SQLFORM() # or SQLFORM.factory - just makes a set of html-like-component (set of DIV(), INPUT() and so on) form.process() - filters and fills form with request.vars, does validation and so on On Friday, February 12, 2016 at 2:50:14 AM UTC+3,

[web2py] Re: Displalay a form in light box or pop up window in view

2016-02-11 Thread Val K
pass an argument to my controller > "modal_content". How do I pass a request.args(0) from my view to the > controller in above? Just like I would do > > onclick='window.open("{{=URL("*modal_content*",args=something.id)}}", > "mywindow");'>Apply >

[web2py] Re: Problems with Upload files

2016-02-12 Thread Val K
Upload field has custom_store param-see https://www.google.ru/url?q=https://groups.google.com/forum/m/%23!topic/web2py/8X-QlbtyxEQ=U=0ahUKEwiL2r_DlvLKAhWBOSwKHYgSDIwQFggNMAA=WkaSH-wCNyJiXG0Su3f8uA=AFQjCNEu9h6olQktR8ir7Lk7KgBi1y8aoA -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Displalay a form in light box or pop up window in view

2016-02-12 Thread Val K
the argument. If we need to call the LOAD from the view, its > > {{=LOAD('default','manage_things',ajax=True)}} > > Then it fails for m_count. > > > On Friday, February 12, 2016 at 12:20:10 AM UTC-5, Val K wrote: >> >> LOAD() works like URL(), so, to pass a

[web2py] Re: File picker

2016-02-12 Thread Val K
http://www.web2py.com/books/default/chapter/29/14/other-recipes#Publishing-a-folder On Tuesday, February 9, 2016 at 5:35:41 AM UTC+3, Heinrich Piard wrote: > > Hi all, > > does anyone have an example of a web button which allows me to browse > through the local file system on the web server to

[web2py] Re: Displalay a form in light box or pop up window in view

2016-02-11 Thread Val K
Hi! Here is my solution. I have modal_wrapper function. In controller file, I have two controllers - main_page and modal_content: def main_page(): main_pg=DIV() m_cont = LOAD(f='*modal_content**.load*', ajax=True, ajax_trap=True ) dialog = modal_wrapper(m_cont,

[web2py] Re: Problems with Upload files

2016-02-11 Thread Val K
1. If you specify uploadfolder, it must be absolute path - something like os.path.join(request.folder, 'path_relative_to_your_app') 2. To store file I use like this: dst = open('your_file_absolute_name', 'wb') shutil.copyfileobj(form.vars.file, dst) dst.close() it works On Friday,

[web2py] Re: need help connecting to a second database for a copy of application

2016-02-08 Thread Val K
Hi! 1. I believe one pg-install=one pg-server 2. I think that pg listens only one port until you set another one and restart server Why do you think you have to have another pg-server? One pg-server can services many databases - just use different names for DAL, i.e. db=DAL() db1=DAL() to

[web2py] DAL: query using JSON field

2016-02-28 Thread Val K
Hi! Is there any way to produce query using JSON field? It seems that web2py treats args of that query as string: db(db.tabl.json_fld==[1])._select() - "... WHERE tabl.json_fld=='[1]'" db(db.tabl.json_fld[0]==1)._select() - "... WHERE (SUBSTR(tabl.json_fld,1,(2 - 1)) = '1')" I use PostgreSQL

[web2py] Re: DAL: query using JSON field

2016-02-28 Thread Val K
clude "WHERE" in the query -- the DAL will add that. Also, > because this query is opaque to the DAL, you must specify fields to select > in the .select() call so the DAL knows what table to query. > > Anthony > > On Sunday, February 28, 2016 at 7:56:21 AM UTC-5, Val K wrote

[web2py] Re: Join subqueries

2016-02-29 Thread Val K
Hi! There are many aliases with sub select in your query, it's difficult to understand tables structure. Post tables definition and some comment about what do you want to do, please On Monday, February 29, 2016 at 8:11:09 AM UTC+3, Bill Black wrote: > > SELECT a.*,b.num_passed > FROM

[web2py] Re: constraints

2016-02-29 Thread Val K
I see serial(fk) in your tables definition, but FK couldn't be serial, serial means generative id by sequence There is a little singularity in web2py - if you specify "id" as "reference ..." but don't specify it as primarykey=['id'] explicit then web2py treats it as serial id and ignores fk-

[web2py] Re: SQLFORM.grid() control detect_record_change

2016-02-29 Thread Val K
Hi! Web2py does following (roughly): - retrieves DB-record to update and compute hash that is function(record) - stores record-hash and *formkey* as {formkey:hash} in session, so, even the same user opens many forms for the same record, after confirming one of them he'll receive warning while

[web2py] Re: Join subqueries

2016-02-29 Thread Val K
| quiz_id (fk), passed (boolean) > > quiz - question, quiz - result are one to many relations. > > I'm trying to get the 'quiz name, # of questions in the quiz, # of passed > (result) for the quiz' > > > On Monday, February 29, 2016 at 12:43:41 PM UTC-5, Val K wrote: >&

[web2py] Re: Join subqueries

2016-02-29 Thread Val K
t; quiz - question, quiz - result are one to many relations. > > I'm trying to get the 'quiz name, # of questions in the quiz, # of passed > (result) for the quiz' > > > On Monday, February 29, 2016 at 12:43:41 PM UTC-5, Val K wrote: >> >> Hi! >> There are

Re: [web2py] Receiving array passed in from jQuery $.ajax() into Storage object

2016-02-22 Thread Val K
How about including in web2py this module? Here is my variant returning Storage (original returns dict). Usage: post_vars = jquery_unparam_w2p(request.body.read()) # -*- coding: utf-8 -*- # based on jquery-unparam 2.0.0 import re try: from

[web2py] improving DAL for normalized DB

2016-01-23 Thread Val K
Hi guys! I have an idea to improve DAL in scope of work with normalized DB. As known It's a common practice to avoid NULL value by creating separate (option) table(s) to store non required fields. So, it would be great to have a field type like "storedin table_name.field_name" For example:

[web2py] Re: regarding permission

2016-02-17 Thread Val K
Hi! There is a model only in your message, what does your controller like? After "auth = Auth(db)", auth.user_id == id of logged in user (None means nobody logged in) On Wednesday, February 17, 2016 at 12:36:53 PM UTC+3, prashant joshi wrote: > > is there any way to provide permission to

[web2py] Re: SQLFORM.factory - form.process().accepted fails first time but works after that

2016-02-17 Thread Val K
It seems after first click your form is reloaded, may be there is nested forms in your html-page or something else. What does your LOAD-call like? try ajax=true or ajax_trap=true On Wednesday, February 17, 2016 at 12:17:04 AM UTC+3, Jim S wrote: > > I have a simple SQLFORM.factory form. > >

[web2py] Re: Prepping upload file browser

2016-02-20 Thread Val K
It's possible - just write your own browser ;) You can't access the file system from any browser due to security reasons On Saturday, February 20, 2016 at 4:25:46 AM UTC+3, Dave S wrote: > > Using SQLFORM for a table with a Field('x', 'upload'), is there a way to > tell the file chooser widget

[web2py] Handling JSON stream

2016-02-21 Thread Val K
How do you serialize form? Jquery.param makes json in extended format by default, try use traditional=true -- 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) ---

[web2py] Re: Handling JSON stream

2016-02-21 Thread Val K
UTC+3, Kenneth wrote: > > Hi, > > I don't access to change the webform, so I need to get by what I receive. > It is a standard webform in Drupal that sends the JSON. > > > Kenneth > > > Den söndag 21 februari 2016 kl. 13:01:40 UTC+2 skrev Val K: >> >>

[web2py] Re: reading from external db

2016-02-14 Thread Val K
Be careful with legacy databases! You can do involuntary changes by db.define_table(), to avoid this use migrate=False. If you're going to read only (i.e. only select-query), connect to DB using limited user/role account On Saturday, February 13, 2016 at 1:01:36 AM UTC+3, yarecki wr wrote:

[web2py] Re: How i can do a form factory 2 tables with bulkdata

2016-03-10 Thread Val K
Hi! 1. it is not quite clear for me, what is the goal of client/property fields? Are they search fields? 2. If you want user to fill/edit/del all these fields (without server interaction) and submit result at once - it's impossible without having some JS-coding 3. Your

[web2py] Re: iterating through form fields with rows

2016-03-15 Thread Val K
Hi! Just for clarity: *row.field_name* - access to field value of *record retrieved from DB *( by db().select() ) *form.vars.field_name *- access to field value of *submitted from *( *after* form.process() ) form.vars - just a Storage() object like a dict() form.vars.keys() - list of all

[web2py] Re: fighting with the widget

2016-03-15 Thread Val K
e (i.e. not > .w2p_list) > > On Tuesday, March 15, 2016 at 9:44:04 PM UTC+1, Val K wrote: >> >> See web2py.js >> There is : >> $(ul).find(":text").after('+-'). >> keypress(function(e) { >> return(e.which == 13) ? pe(ul

[web2py] Re: fighting with the widget

2016-03-15 Thread Val K
See web2py.js There is : $(ul).find(":text").after('+-'). keypress(function(e) { return(e.which == 13) ? pe(ul, e) : true; }).next().click(function(e) { pe(ul, e); e.preventDefault(); }).next().click(function(e) { rl(ul, e);

[web2py] Re: fighting with the widget

2016-03-15 Thread Val K
There is no problem with bootstrap - you can write your own widgets using its classes, but if you customize/override web2py.js/web2py-bootsrup3.js/widgtes.py you have a chance to get a pain with updating web2py (bootstrap is updated much rarely) optimal solution (I think) - write your own

Re: [web2py] please help with new widgets

2016-03-15 Thread Val K
Date/Time/Datetime Widget - doesn't become hidden after click on another input ( have to click on any non-input, tested in Opera) On Tuesday, March 15, 2016 at 9:40:39 AM UTC+3, Sukrut Joshi wrote: > > please send me college management system which developed in web2py.. > which contain >

[web2py] Re: DAL: reference to FK-field causes an error

2016-03-13 Thread Val K
t 3:51:59 AM UTC+3, Anthony wrote: > > You can submit an issue to the pyDAL repo. > > On Saturday, March 12, 2016 at 6:03:10 PM UTC-5, Val K wrote: >> >> >> I've solved my problem - just additional condition >> in dal\pydal\adapters\base.py: >> >>

[web2py] Re: DAL: reference to FK-field causes an error

2016-03-12 Thread Val K
I explicitly define 'id' as primary key in b_tbl, in this case web2py creates table with id as just INTEGER (not incremental) - I've checked it, - it isn't problem The problem is that web2py doesn't perform recursively search for base type of referenced field. It consider that FK-field

[web2py] DAL: reference to FK-field causes an error

2016-03-12 Thread Val K
Hi! I have a problem - look at example: db.define_table('a_tbl', Field('name')) db.define_table('b_tbl', Field('id', 'reference a_tbl') ,Field('name'), primarykey=['id']) db.define_table('c_tbl', Field('b_tbl_id', 'reference b_tbl') ,Field('name')) *c_tbl* definition causes an error (see

[web2py] Re: DAL: reference to FK-field causes an error

2016-03-12 Thread Val K
format. > > Anthony > > On Saturday, March 12, 2016 at 4:52:53 AM UTC-5, Val K wrote: >> >> Hi! >> I have a problem - look at example: >> >> db.define_table('a_tbl', Field('name')) >> db.define_table('b_tbl', Field('id', 'reference a_tbl') ,Field('name

[web2py] Re: DAL: reference to FK-field causes an error

2016-03-12 Thread Val K
? if not rfield.unique and len(rtable._primarykey)>1: # then it has to be a table level FK if rtablename not in TFK: works fine! On Sunday, March 13, 2016 at 12:17:06 AM UTC+3, Val K wrote: > > OK! Let's dance > > Th

[web2py] Re: Advice for small database on GAE

2016-03-13 Thread Val K
Hi! If your DB is so small and could be entirely placed in memory, you could have one yet web2py app on PythonAnywhere.com ( it's free) and use it as just data source. I mean - "every couple of months with 3 or 4 more" your GAE app reload all data from your PythonAnywhere app On

[web2py] Re: custom authentication

2016-03-20 Thread Val K
Store user_id (or something else) in session and write your own decorator or just test in your controller "who is logged in" On Saturday, March 19, 2016 at 2:31:11 PM UTC+3, T.R.Rajkumar wrote: > > I have the username, password, role in legacy SQL server database. In my > login from I

[web2py] Re: multiple id selection using request.vars.name

2016-03-20 Thread Val K
ids= isinstance(request.vars.name, basestring) and [ids] or ids # so it will be a list in anyway post_selected= db(Post._id.belongs(ids)).select() On Sunday, March 20, 2016 at 12:41:24 AM UTC+3, Ron Chatterjee wrote: > > > I have checkbox and from there I read my ids, which is

[web2py] Re: How to insert different grid elements in tab panels?

2016-03-02 Thread Val K
As I know it's impossible to have 2 "static" (not ajax) SQLFORM.grids at the same page, because each of them will treat request.args as its own On Wednesday, March 2, 2016 at 8:12:49 PM UTC+3, Ron Chatterjee wrote: > > > If I have two independent grid, when I search in one grid, it gets >

[web2py] PostgreSQL: json_agg()

2016-03-06 Thread Val K
Hi! This is useful aggregate function for PG-users (tested with PostgreSQL 9.3 ): def json_agg_sql(flds_lst, as_alias): json_fld_sql = """ '"%s":' || to_json(%s) """ json_row = [json_fld_sql % (f.name, f.name) for f in flds_lst] json_row_sql = "'{' || " + "|| ','

[web2py] Serialize object having js-function()

2016-04-27 Thread Val K
Hi! I made mini but useful and universal class to hold json-serializable objects. Main goal - serialize objects having items-function() as js-objects from types import MethodType from gluon.contrib import simplejson as sj class Smart_Storage(dict): """ A Smart_Storage object is like

[web2py] Re: I need help with db.executesql()

2016-04-28 Thread Val K
is there "# -*- coding: utf-8 -*-" as first line of your file.py? On Friday, April 22, 2016 at 4:13:54 PM UTC+3, c.lp...@gmail.com wrote: > > hi,All: >when i execute the following code: > >>> from gluon import * > >>> db = >

Re: [web2py] Re: How can I pre populate a option column of a form?

2016-04-28 Thread Val K
'form.vars.field = any' must be placed before form.process() So, in your case: form = SQLFORM(db.pratiche) form.vars.stato_pratica = 'aperta' form.add_button('Back', URL('index')) if form.process().accepted: On Friday, April 22, 2016 at 12:23:59 AM UTC+3, Andrea Marin wrote: > >

[web2py] JS: very small but very useful

2016-05-06 Thread Val K
Very small py-function that wraps any js-content in anonymous js-function def JS_fun(*args_lst): def _inner(body): return "(function(%s){ %s ;})" % (','.join(args_lst), body) return _inner >>> JS_fun( 'a', 'b' )( 'console.log(a,b)' ) '(function(a,b){ console.log(a, b) ;})' >>>

Re: [web2py] Re: login by ajax

2016-05-04 Thread Val K
Hi! It seems, that ajax_login isn't exist yet? if not user: self.log_event(self.messages['login_failed_log'], request.post_vars) # invalid login session.flash =

[web2py] Re: I would like to know how to redirect the url after login

2016-05-10 Thread Val K
Hi! auth.settings.login_next = *URL(...)* On Tuesday, May 10, 2016 at 2:50:17 AM UTC+3, cron...@udg.co.cu wrote: > > Hello I am new to web2py and I would like to know how to redirect the url > after login, so I forwarded to the same home page. > greetings and thanks in advance > > i found

[web2py] Field.Virtual: unexpected behaviour

2016-05-09 Thread Val K
Hi! I am angry, I wasted half a day to catch this error: db.define_table('tbl', Field('name'), Field.Virtual('alias_name', lambda row: row.name) # right notation is `row.tbl.name` ) in controller: rows = db(db.tbl).select() #it's OK!

[web2py] Re: Field.Virtual: unexpected behaviour

2016-05-09 Thread Val K
all a little differently: Field.Virtual('alias_name', lambda row: *None*) #- works OK! i.e. row.alias_name *exists* and row.alias_name == *None* *but * Field.Virtual('alias_name', lambda row: row.*bla_bla*) #- causes that row. alias_name *doesn't* *exist at all!* On Monday, May 9, 2016 at

  1   2   3   4   >