[web2py] Re: Static form control in case of read only field

2014-01-21 Thread Annet
Hi Anthony, This line: _controls = DIV(controls, _help, _class='col-sm-6 controls') puts the content inside the DIV in question. If you don't want that in case of read-only fields, you'll need to first check whether controls is a form widget (i.e., input, select, or textarea), and don't

[web2py] running scheduler under a user

2014-01-21 Thread Jayadevan M
I wanted to set up the scheduler and execute a few jobs. To prevent the python files being executed by other users, I have added a condition auth.has_membership('scheduler') in the functions. How can I make the scheduler start with a user who in in the scheduler group? Or I am going down the

[web2py] google login and scheduler/appadmin etc

2014-01-21 Thread Jayadevan M
I have enabled google login. Once that is done, when I start web2py for admin activities (127.0.0.1) with password, I can go to the admin interface and then to edit of myapp. But from Edit, if I click on database administration, it errors out. That link points to redirects to

[web2py] scheduler files

2014-01-21 Thread Jayadevan M
In web2py, which is the 'right' place to put the python files with scheduler functions? Right now I have it under controllers. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: New to web2py

2014-01-21 Thread Ray Allen
I too have noticed that the syntax from the design tool isn't consistent with the requirements of web2py and causing me lots of errors. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: How to create a dropdown selection page?

2014-01-21 Thread 黄祥
had you already take a look at multiple forms per page in web2py book? ref: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Multiple-forms-per-page best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

Re: [web2py] Re: DAL usage

2014-01-21 Thread 黄祥
brilliant, never thought of that. thank you so much. yes i agree with you about the advantage of using models_to_run rather than importing tables from modules. thanks and best regards, stifan On Tuesday, January 21, 2014 1:17:57 AM UTC+7, Anthony wrote: appadmin is just a controller, like

[web2py] tools to edit web2py layout

2014-01-21 Thread 黄祥
hello folks, i just want to know which tools did you use to edit web2py layout (twitter bootstrap)? for web2py layout i usually replace it from bootswatch, download pingendo, create the layout, but don't know how to adopt it with web2py layout. any hints, or suggestions? thanks and best

Re: [web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2014-01-21 Thread horridohobbyist
Yes, I did. But I shouldn't have included arguments in the 'view' function. That was the error. So how do I extract the arguments 'products' and '11' (in my example) in the view function? response._vars apparently does not contain them. Thanks. On Tuesday, 21 January 2014 01:35:52 UTC-5,

[web2py] Re: How to create a dropdown selection page?

2014-01-21 Thread Adrian Zhang
Thanks for reply. Actually SQLFORM is exactly my confusion.I need a drop-down list instead of input form. And I did view several posts about this problem (such as listed below), none of them works for me. http://www.web2pyslices.com/slice/show/1724/cascading-dropdowns-simplified

Re: [web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2014-01-21 Thread horridohobbyist
Ah, I think I know! The arguments are passed in request.args. Right? On Tuesday, 21 January 2014 08:00:19 UTC-5, horridohobbyist wrote: Yes, I did. But I shouldn't have included arguments in the 'view' function. That was the error. So how do I extract the arguments 'products' and '11' (in

[web2py] Re: Static form control in case of read only field

2014-01-21 Thread Annet
Hi Paolo, About the checkboxes and radio controls please note that the package works since Version 2.8.2-stable+timestamp.2013.12.17.16.49.17 of web2py. In the previous versions the related widget I downloaded web2py version 2.8..2 for normal users and for testers both are: Version

[web2py] Re: web2py --run-system-tests

2014-01-21 Thread Massimo Di Pierro
Windows has no fork. I do not think we have ever run tests on windows. Try with cygwin On Monday, 20 January 2014 23:16:12 UTC-6, Kiran Subbaraman wrote: Hello, I was trying to figure out how to run tests against web2py (in the case where I contribute changes to web2py). Ran python

[web2py] Re: Static form control in case of read only field

2014-01-21 Thread Anthony
# embed _help into _controls if not (isinstance(controls, INPUT) and isinstance(controls, SELECT) and isinstance(controls, TEXTAREA)): _controls = DIV(P(controls, _help, _class='form-control-static'), _class='col-sm-6 controls') else: _controls = DIV(controls, _help,

[web2py] Re: Overriding Grid/Smartgrid's 'Edit/Delete/View'

2014-01-21 Thread Anthony
links=[lambda row: A('View',_href=URL('view',args=[db.products,row.id]))], First, note that the URL function produces a string, so putting db.products in args is equivalent to str(db.products), which will result in just products. def view(table,id): return dict() As noted in the

[web2py] Re: tools to edit web2py layout

2014-01-21 Thread Anthony
As for tools, just a text editor should do. To adapt a layout, the best guide is to look at the welcome app layout as well as the bookhttp://web2py.com/books/default/chapter/29/05/the-views#Page-layout . Anthony On Tuesday, January 21, 2014 7:46:28 AM UTC-5, 黄祥 wrote: hello folks, i just

[web2py] Re: Routes.py not working with auth dialogs

2014-01-21 Thread Anthony
Perhaps you're using an older version of web2py. See https://github.com/web2py/web2py/blob/master/gluon/tools.py#L1127. Anthony On Tuesday, January 21, 2014 1:58:59 AM UTC-5, Joe Barnhart wrote: Ah... no such luck. def here(self): return current.request.env.request_uri On

[web2py] Re: Routes.py not working with auth dialogs

2014-01-21 Thread Anthony
The parameter based system was designed to make such common scenarios much easier. If all you want to do is remove the app name and the index function, your entire routes.py would just be: routers = dict( BASE = dict( default_application = 'myapp', default_controller =

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread americandewd
I attempted to copy/paste what you have so I can modify it for my needs. However it immediately errors out with: AttributeError: 'Table' object has no attribute 'parent' So I thought I would comment out everything for the menu except response.menu = [] and populate the database (have done

[web2py] Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-21 Thread 黄祥
just want to share, enjoy, n please let me know if you meet any problems Change : - Network Domain with your Network Domain Name - Server Name with your Server Name - Administrator Email Address with your Administrator Email Address - Change Path with your Own Path 1. Open

[web2py] Re: tools to edit web2py layout

2014-01-21 Thread 黄祥
yes, thank you so much, anthony, i think there is a special editor to make the layout design easier. btw, pardon, oot, i see in the other framework use something like {% %} in their view templates. is it supported also in web2py? thanks and best regards, stifan On Tuesday, January 21, 2014

[web2py] multiple functions in one view

2014-01-21 Thread En Ware
Hello, I am trying to figure out how to call more then function per view. I would like to be to have users fill out a form and and then as soon as they submit show the results sort of like SQLFORM. I also want to make the grid editable so that users can hide rows and columns. Thanks in

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread Massimo Di Pierro
First of all notice that if you use web2py2.8.2 you can do this: db.define_table('store_catalog', Field('title'), Field('slug',requires=IS_SLUG(),compute=lambda row: IS_SLUG.urlify(row.title)), Field('parent_id','reference store_catalog')) def menu_rec(items): return

[web2py] Re: tools to edit web2py layout

2014-01-21 Thread Massimo Di Pierro
You can set: response.delimiters = (r'{%',r'%}') But you would have to change the delimiters in all the views including layout.html, web2py_ajax.html and generic.*. Massimo On Tuesday, 21 January 2014 09:33:49 UTC-6, 黄祥 wrote: yes, thank you so much, anthony, i think there is a special

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-21 Thread Massimo Di Pierro
Can you post this on web2pyslices? Thanks you! On Tuesday, 21 January 2014 09:37:46 UTC-6, 黄祥 wrote: just want to share, enjoy, n please let me know if you meet any problems Change : - Network Domain with your Network Domain Name - Server Name with your Server Name - Administrator Email

[web2py] Updating DAL elements with a loop

2014-01-21 Thread Mark Billion
I have a database that accepts user data and then repurposes it for use in a different context. The problem is scrubbing for None; I can do it, but its ugly going line by line -- Id rather loop through it but I cant get it to work. Approach #1 for r in rows: . . . . for e

[web2py] Re: How to create a dropdown selection page?

2014-01-21 Thread 黄祥
i'm sorry, my bad, i focus on your layout before selection.html - ___ ___ | select a country | | submit | --- - ___ ___ | select a brand|

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-21 Thread 黄祥
done, i'm sorry, forgot to tell that it tested work in windows 7 ultimate 32 bit. ref: http://www.web2pyslices.com/slice/show/1941/install-web2py-on-windows-with-apache-and-mod-wsgi-using-command-line-nix-flavou best regards, stifan -- Resources: - http://web2py.com -

[web2py] Re: running scheduler under a user

2014-01-21 Thread Niphlod
the wording is a little bit incorrect. You may prevent users queuing tasks, and that's pretty much all about what can you do with auth.has_membership. python files being executed by other users seems to point to the security of the server itself, that web2py can't really manage. Can you be

[web2py] Re: web2py --run-system-tests

2014-01-21 Thread Niphlod
windows has it. but the guy who wrote those tests never give attention to the win world. When I run tests on windows, I delete that file. On Tuesday, January 21, 2014 2:39:52 PM UTC+1, Massimo Di Pierro wrote: Windows has no fork. I do not think we have ever run tests on windows. Try with

[web2py] DAL looping update

2014-01-21 Thread Mark Billion
I cannot seem to get this code to run, even though Im almost sure Im right.any thoughts would be appreciated! for r in rows: . . . . . for k, v in {'name': r.name, 'address': r.address . . . }.items(): if v is None:

[web2py] Re: multiple functions in one view

2014-01-21 Thread Anthony
You could put both the form and the grid in ajax components. When the form is submitted, it could send back a JS command to load the grid: In index.html: {{=LOAD('default', 'tracker_form.load', ajax=True)}} div id='content_grid'/div Change your two existing views to a .load extension (not

[web2py] Re: tools to edit web2py layout

2014-01-21 Thread 黄祥
a, i see, seems, you guys prepare everything. what a wonthefull web framework. thanks and best regards, stifan On Tuesday, January 21, 2014 10:48:42 PM UTC+7, Massimo Di Pierro wrote: You can set: response.delimiters = (r'{%',r'%}') But you would have to change the delimiters in all the

[web2py] Re: Form input prolem

2014-01-21 Thread DAL read and variables
Thank you very much, it works good :) Am Sonntag, 19. Januar 2014 19:28:23 UTC+1 schrieb Lucas Schreiber: Hi guys, i have this function: def login(): form = FORM( 'Name', INPUT(_name='name'), 'password', INPUT(_password='password'), INPUT(_type='submit')) if

[web2py] Re: Static form control in case of read only field

2014-01-21 Thread Annet
That doesn't look like it will work -- the first branch will only execute if controls is an instance of all three types of widgets, which will never be true. I think you want: if not isinstance(controls, (INPUT, SELECT, TEXTAREA)): No it didn't work :-) clicking through some forms

[web2py] Re: DAL looping update

2014-01-21 Thread Mark Billion
This is perfect, thanks. Meant it wouldnt run, and the values were NULL. On Tuesday, January 21, 2014 11:25:39 AM UTC-5, Anthony wrote: What do you mean it won't run? Do you get an error, or just don't see the changes you expect? Are the values in question in the database actually None

[web2py] Re: DAL looping update

2014-01-21 Thread Anthony
What do you mean it won't run? Do you get an error, or just don't see the changes you expect? Are the values in question in the database actually None (i.e., NULL), or are they empty strings ('')? If you're trying to change all the records in the table, would be easier to do: for field in

[web2py] Re: Static form control in case of read only field

2014-01-21 Thread Annet
Regarding the flash message position, here attached you'll find the patched files of my package. Now the default position is on the rightside but by adding in layout.html to the flash dom element the css class centered it will horizontally centered on the page or by adding the css

Re: [web2py] How to create a dropdown selection page?

2014-01-21 Thread Adrian Zhang
Thank you so much for your continue support. I tried some clue from manual and created a simple drop-down list with a bit defect.will post here tomorrow. Thank you again ! Have a nice day! Adrian 黄祥 steve.van.chris...@gmail.com于2014年1月21日星期二写道: i'm sorry, my bad, i focus on your layout before

[web2py] Re: Static form control in case of read only field

2014-01-21 Thread Anthony
On Tuesday, January 21, 2014 11:27:25 AM UTC-5, Annet wrote: That doesn't look like it will work -- the first branch will only execute if controls is an instance of all three types of widgets, which will never be true. I think you want: if not isinstance(controls, (INPUT, SELECT,

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
I am unable to make it past the point of the database definition. I put exactly what you have below in my db.py, and in my menu.py I left response.menu=[] so that I could populate the database because the function def menu_rec doesn't have anything so I thought to just avoid errors and for

[web2py] Button in Component Stealing Focus?

2014-01-21 Thread EW
I have a load component with a button in it that seems to automatically have the focus such that if I go to my URL and press the enter key, that is the button that is triggered. But, I also have a textbox and a button outside the component. I would like it so that when you type something in

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
My code above seems to only be lacking the proper embedded if conditional statement. I am able to output the same info I need without repeating it like in this example: rows = db(db.store_categories).select() for menucatchoice in rows: if menucatchoice['subcategory'] == '': print

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Here's what I've tried so far and here's the results if it helps any to get me on the right track, plus I hope this helps someone else looking for this to because this is something very commonly done in PHP. I have tried changing this: response.menu3[-1]+=([[(T(subcat.subcategory)), False,

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread James Burke
Sorry, I had the parent declared as catelog_parent in the table. If you change it to parent it should work ;) Also += is the same as append. On Wednesday, January 22, 2014 3:35:29 AM UTC+13, web2pygroup wrote: I attempted to copy/paste what you have so I can modify it for my needs. However

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Getting: global name 'active_page' is not defined What did you have for that so I can incorporate it? Or do I even need that since I'm not really caring at the moment about which page they're on (if I understand that variable correctly). How would I remove it to still achieve the same

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread James Burke
You could simply declare it for testing purposes. Set it to false. -- 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 because

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-21 Thread Paolo Valleri
Well done, under scripts/setup_* there are several scripts for deployments on linux environment, it would be very nice to have something for windows too. Paolo On Tuesday, January 21, 2014 5:04:12 PM UTC+1, 黄祥 wrote: done, i'm sorry, forgot to tell that it tested work in windows 7 ultimate

Re: [web2py] How to create a dropdown selection page?

2014-01-21 Thread Tim Richardson
to get drop downs you need to set a validator in the field definition. IS_IN_SET is one validator which causes SQLFORM to automatically make a dropdown. so you don't do anything in SQLFORM. Rather you set up your data model when defining tables. -- Resources: - http://web2py.com -

[web2py] Re: Button in Component Stealing Focus?

2014-01-21 Thread Niphlod
pack a minimal app to reproduce the behaviour. Without it, we'll just provide unuseful hints. On Tuesday, January 21, 2014 6:32:30 PM UTC+1, EW wrote: I have a load component with a button in it that seems to automatically have the focus such that if I go to my URL and press the enter key,

[web2py] Re: Grid in component edit twice issue

2014-01-21 Thread Niphlod
still can't reproduce in 2.8.2 with Firefox 26.0 or chrome 32 The edit link should have this attribute in the source-code *data-w2p_target *that enables the load into component behaviour. The button markup **should** look like a href=/test_grid/default/component.load/edit/person/2

[web2py] filepaths for library and images ?

2014-01-21 Thread Stef Mientki
hello, Q1: I want to store uploaded files manually, but I'm asking myself if this is the correct way to create the filepath, or is there a better way ? Filename = os.path.join ( 'applications', request.application,'static\images\pic_%s.png' % Edit_Select), 'wb') Q2: I made some

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-21 Thread 黄祥
i plan to use bat script or create an exe too using autoit for this. but the main problem in my pov is about the software version. let say in linux you just type e.g. sudo apt-get install -y apache2 it will get the latest version of apache, if you not explicit tell which version, yet in

[web2py] Re: multiple functions in one view

2014-01-21 Thread En Ware
Thank you so much; this awesome I appreciate your time. On Tuesday, January 21, 2014 9:37:04 AM UTC-6, En Ware wrote: Hello, I am trying to figure out how to call more then function per view. I would like to be to have users fill out a form and and then as soon as they submit show the

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Ok that works, and I'm curious about that variable if you could please explain maybe I could use it and not have to ask to many more questions :) Also I was wondering how I could incorporate what I had also posted originally - ([T(' Catalog'), False, '' - where this was the heading for the menu

[web2py] Re: filepaths for library and images ?

2014-01-21 Thread Anthony
Filename = os.path.join ( 'applications', request.application,'static\images\pic_%s.png' % Edit_Select), 'wb') os.path.join(request.folder, 'static', 'images', 'pic_%s.png' % Edit_Select) Q2: I made some libraries that I want to use more than one project. Now I stored these

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
I decided to try and make Catalog my first choice in the menu by setting it as the first entry in the DB. Then I put Animals with Catalog as its parent, then I added Dogs and set that with Animals as the parent. Unfortunately it does not show the Dogs category. Have I possibly done

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
I have also been trying your solution and have gotten to this point, when I try to run the shell to test it errors out immediately with: AttributeError: 'Rows' object has no attribute 'as_tree' Any hints on how to fix? Or something else I might try? I do have the 2.8.2 version.. I noticed

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Ok figured out I needed to change that to as_trees. However the database suggestion you gave is causing a IntegrityError: FOREIGN KEY constraint failed error immediately upon trying to put any data into any field. For example if I put Animals in the title and leave the other field parent_id

Re: [web2py] Re: filepaths for library and images ?

2014-01-21 Thread Stef Mientki
thanks Anthony, the import now works partially. The lib needs to know the database db is it possible to import that. from db import db doesn't work cheers, Stef On 21-01-14 23:55, Anthony wrote: Filename = os.path.join ( 'applications', request.application,'static\images\pic_%s.png'

[web2py] Re: Button in Component Stealing Focus?

2014-01-21 Thread Ezer Silva
Same here. In my case, always that the URL ends with a '#' (url.com/app/controller/function#) the focus goes to a text box; when the url doesn't end with '#' it doesn't occur. I don't know why it's generating this behaviour, because I'm passing only unnamed args (request.args), not named args

[web2py] SQLFORM.grid and smartgrid translate headings

2014-01-21 Thread Boris Aguilar
Do table headings can be translated when creating an smartgrid or grid? I can't find it on documentation. (and entries don't get created in my languages files) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

Re: [web2py] How to create a dropdown selection page?

2014-01-21 Thread Adrian Zhang
Thank you, Tim. My previous confusion comes from which field should be format as IS_IN_SET or IS_IN_DB once 2 tables have many-to-many links or single-to-many links, how to represent related field in controller and view. Previously listed web posts really take confusions to a beginner. So I

[web2py] Re: SQLFORM.grid and smartgrid translate headings

2014-01-21 Thread 黄祥
if you define the field label with translation it will support internationalization. e.g. db.book.title.label = T('Title') browse the page that select book table with others language selected, e.g. Indonesian then goes to languages folder and then translate it manually languages\id.py.

Re: [web2py] Re: filepaths for library and images ?

2014-01-21 Thread Anthony
Please see http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules . On Tuesday, January 21, 2014 7:14:05 PM UTC-5, aapaap wrote: thanks Anthony, the import now works partially. The lib needs to know the database db is it possible to import that. from

[web2py] pass as parameter or import

2014-01-21 Thread Jayadevan M
From my scheduler function under models, I can call my function under modules like this mymodule.myfunction(db) I can also do it this way - In db.py, from gluon import current .. current.db = db In my function in modules, do from gluon import current .. db =

[web2py] Re: Install Web2py on Windows with Apache and Mod WSGI (using command line, *nix flavour)

2014-01-21 Thread Massimo Di Pierro
I'd be happy to include it in web2py when you make it. On Tuesday, 21 January 2014 16:21:29 UTC-6, 黄祥 wrote: i plan to use bat script or create an exe too using autoit for this. but the main problem in my pov is about the software version. let say in linux you just type e.g. sudo apt-get

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread Massimo Di Pierro
Sorry typo. Let's try again: db.define_table('store_catalog', Field('title'), Field('slug',requires=IS_SLUG(),compute=lambda row: IS_SLUG.urlify(row.titl\ e)), Field('parent_id','reference store_catalog')) id1 = db.store_catalog.insert(title='main') id2 =