[web2py] Code organization help

2015-08-07 Thread David Ripplinger
Hi all, This is a request for ideas on good code organization for my application. I've been reading up on the preferred organization for web2py as well as typical REST HTTP conventions, and I'm trying to use some ideas of both where they make sense. If I understand correctly, web2py takes more

Re: [web2py] Re: Emailing

2015-08-07 Thread Anthony Smith
Are got it. thankyou On Sat, Aug 8, 2015 at 9:58 AM, 黄祥 wrote: > e.g. > *private/appconfig.ini* > [smtp] > server = smtp.gmail.com:587 > sender = em...@gmail.com > login = email:password > > *models/db.py* > from gluon.tools import Auth, Crud, Service, PluginManager, prettydate > auth = Auth(d

[web2py] Re: 2.12.1 is out

2015-08-07 Thread JorgeH
thanks for the great job massimo and team!! Is bootstrap 3 + as default? On Friday, August 7, 2015 at 11:59:13 AM UTC-5, Massimo Di Pierro wrote: > > Changelog: > > - security fix: Validate for open redirect everywhere, not just in login() > > - allow to pack invidual apps and selected files as p

[web2py] Re: Emailing

2015-08-07 Thread 黄祥
e.g. *private/appconfig.ini* [smtp] server = smtp.gmail.com:587 sender = em...@gmail.com login = email:password *models/db.py* from gluon.tools import Auth, Crud, Service, PluginManager, prettydate auth = Auth(db) mail = auth.settings.mailer mail.settings.server = 'logging' if request.is_local

[web2py] Re: Emailing

2015-08-07 Thread Anthony Smith
I have looked at that but still cant figure out, do you have example cheers tony -- 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 mess

[web2py] Re:

2015-08-07 Thread Anthony
How is request.vars.table being set? For that to work, presumably you would need "?table=some_table" in the query string of the URL used to access the grid. Anthony On Friday, August 7, 2015 at 6:27:52 PM UTC-4, ESRA GÜÇLÜ wrote: > > > Hi , > I'm pretty new to web2py, I'm developing a project f

[web2py]

2015-08-07 Thread ESRA GÜÇLÜ
Hi , I'm pretty new to web2py, I'm developing a project for my internship and i have a problem. My program gets a choice from user and according to the choice it shows db table on the SQLFORM.grid. SQLFORM.grid is displaying but the user cannot add new record or delete or update. This is my co

[web2py] web2py - display nslookup result

2015-08-07 Thread Heinrich Piard
Hi, I this default.py import os import sys def nslookup(): form = SQLFORM.factory(Field('hostname', label='Please enter a valid HOSTNAME to resolve:', requires=IS_NOT_EMPTY())) if form.process().accepted: response

[web2py] Re: 2.12.1 is out

2015-08-07 Thread Massimo Di Pierro
Ne because it iI do not know for sure that is a bug in web2py. On Friday, 7 August 2015 14:14:18 UTC-5, ermolaev.icrea...@gmail.com wrote: > > pickled.HIGHPROTOCOL - fixed? > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source cod

[web2py] Re: CSV save on Server

2015-08-07 Thread forumweb2py
Oh right, the point was the point ... now it works fine with: open('test.csv', 'wb').write(str(db(db.person.id).select())) thanks a lot Am Freitag, 7. August 2015 20:39:32 UTC+2 schrieb forum...@gmail.com: > > He group, > > i create serial letters with web2py and pdfLatex. It works fine with

[web2py] Re: CSV save on Server

2015-08-07 Thread Anthony
I assume that's not the actual code, as there is a syntax error (no "." before the "write"). Also, you appear to be doing the same thing twice -- first using str() to convert the Rows to CSV, and then using the export_to_csv_file method. As detailed in the book, those methods are the same -- ju

[web2py] Re: CSV save on Server

2015-08-07 Thread forumweb2py
Ok, i change the code but i get an error: @auth.requires_login() def create_csv(): from gluon.contenttype import contenttype import os response.headers['Content- Type'] = contenttype('.csv') response.headers['Content-disposition'] = 'attachment; filename=%s_database.csv' % (

[web2py] Re: 2.12.1 is out

2015-08-07 Thread ermolaev . icreator
pickled.HIGHPROTOCOL - fixed? -- 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 you are subscribed to the Google Groups "

[web2py] Re: CSV save on Server

2015-08-07 Thread Anthony
See http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#CSV--one-Table-at-a-time-. No need for StringIO -- just create an open file and pass it to the export method (then close the file). Anthony On Friday, August 7, 2015 at 2:39:32 PM UTC-4, forumweb...@gmail.com wro

[web2py] sessions in cookies

2015-08-07 Thread ermolaev . icreator
> > To *store sessions in cookies* instead you can do: > > session.connect(request,response,cookie_key='yoursecret',compression_level=None) I do that - but folders continue to created in app/sessions -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.co

[web2py] CSV save on Server

2015-08-07 Thread forumweb2py
He group, i create serial letters with web2py and pdfLatex. It works fine with a static csv-file in private folder. But i want to create the csv and save directly to the folder. No Download! I create the csv ... no Problem: @auth.requires_login() def create_csv(): from gluon.contenttype i

[web2py] Re: 127.0.0.1 and ip address are not interchangeable, and Port 80 Error

2015-08-07 Thread Massimo Di Pierro
python web2py.py -i 0.0.0.0 -p 80 will use any IP address you have and port 80. Your OS may block port 80 so be careful. On Thursday, 6 August 2015 21:57:27 UTC-5, Zhihong Zeng wrote: > > Hello, > > I just start using web2py, and get the following questions: > > 1) Based on my experience on apa

[web2py] Re: avoid controller to sanitize html

2015-08-07 Thread Anthony
On Friday, August 7, 2015 at 12:18:12 PM UTC-4, Luis Valladares wrote: > > Thanks Anthony! using the option helper and returning without the > dictionary solved my issue, there is other errors on the javascript but i > already solved it, now works well, one more question: There is no built-in >

[web2py] Re: How to set response Content-Length parameter by file size

2015-08-07 Thread Anthony
See answer here: http://stackoverflow.com/a/31882961/440323 Unless you need the file-listing functionality of Expose, don't bother with it -- instead just use response.stream (even if you do need Expose for listing the files, you can still use response.stream to do the individual file serving).

[web2py] 2.12.1 is out

2015-08-07 Thread Massimo Di Pierro
Changelog: - security fix: Validate for open redirect everywhere, not just in login() - allow to pack invidual apps and selected files as packed exe files - allow bulk user registration with default bulk_register_enabled=False - allow unsorted multiword query in grid search - better MongoDB su

[web2py] Re: web2py 1.12.1 is out

2015-08-07 Thread Massimo Di Pierro
yes. re-posting. On Friday, 7 August 2015 09:17:05 UTC-5, Jack Kuan wrote: > > surely you meant 2.12.1 ? > -- 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: avoid controller to sanitize html

2015-08-07 Thread Luis Valladares
Thanks Anthony! using the option helper and returning without the dictionary solved my issue, there is other errors on the javascript but i already solved it, now works well, one more question: There is no built-in function that creates a dropdown list from a DAL select? El viernes, 7 de agosto

[web2py] Re: avoid controller to sanitize html

2015-08-07 Thread Anthony
If your function returns a dictionary, web2py assumes you want to execute a view. If you haven't created a view, it will use generic.html (by default, this only works for local requests). If you just want to return the raw HTML generated in the controller without then executing a view, then just

[web2py] Re: gluon.contrib.populate didn't fill upload and password field type

2015-08-07 Thread Ben Lawrence
Thanks Stifan, I don't have any code, but just type this into the shell: from gluon.contrib.populate import populate populate(db.auth_user,10) but you have shown me another way I can do it. On Friday, August 7, 2015 at 12:48:41 AM UTC-7, 黄祥 wrote: > > IntegrityError: FOREIGN KEY constraint fail

[web2py] Re: Problem with calling Field Methods after upgrading to 2.11.2 from 2.9.10

2015-08-07 Thread Umpei Kurokawa
It is a Method Field, Field.Method('do_someting', . ) On Thursday, August 6, 2015 at 10:55:22 PM UTC-4, Massimo Di Pierro wrote: > > what is out.dog.do_something()? > Is it an example of a VirtualMethod? > > On Thursday, 6 August 2015 16:36:13 UTC-5, Umpei Kurokawa wrote: >> >> I'm having p

[web2py] avoid controller to sanitize html

2015-08-07 Thread Luis Valladares
Hello! I've a form where i store country, state and municipality and i need to dynamcally change the value based on the select, i mean: If i select a X country i need to display only the states of the country "X" in the states dropdown, the same with municipality I used a basic approach that i

[web2py] Re: web2py 1.12.1 is out

2015-08-07 Thread Jack Kuan
surely you meant 2.12.1 ? -- 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 you are subscribed to the Google Groups "web2

[web2py] Re: How to set response Content-Length parameter by file size

2015-08-07 Thread Alehandro Ramoz Rodrigez
Should it looks like http_response.headers['Content-Length'] = int(request.env.content_length) ? -- 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 re

[web2py] Re: one to many relationship

2015-08-07 Thread Lisandro
Hi there. Web2py has some cool field types called "list:string", "list:integer" and "list:reference table". Check them here: http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-types In your case, you could avoid the creation of the third table with *list:refer

[web2py] Re: How to set response Content-Length parameter by file size

2015-08-07 Thread 黄祥
perhaps you can use request.env.content_length ref: http://web2py.com/books/default/chapter/29/04/the-core#request best regards, stifan On Friday, August 7, 2015 at 3:14:18 PM UTC+7, Alehandro Ramoz Rodrigez wrote: > > My application should respond to remote application request with data from >

[web2py] How to set response Content-Length parameter by file size

2015-08-07 Thread Alehandro Ramoz Rodrigez
My application should respond to remote application request with data from attached file. By default web2py has "Transfer-Encoding: Chunked" parameter and for some reason remote app can get only first string from file, so I need to use "Content-Length" parameter that set to file bytes size. My c

Re: [web2py] can web2py be used as a static website generator?

2015-08-07 Thread Mark Graves
Hello, I realize this is a bit of an old thread, but I figured I'd post an answer anyway as I came up with this same problem recently. For development, sometimes I create static sites before I get into the dynamic interaction. I handled this case with a simple routes.py in the "web2py folder"

Re: [web2py] To display random questions one by one

2015-08-07 Thread 黄祥
perhaps you can use random ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#orderby--groupby--limitby--distinct--having-orderby_on_limitby-left-cache https://groups.google.com/forum/#!topic/web2py/-Y2JL2cIQEI best regards, stifan On Thursday, August 6, 2015 at 4:1

[web2py] Re: gluon.contrib.populate didn't fill upload and password field type

2015-08-07 Thread 黄祥
IntegrityError: FOREIGN KEY constraint failed ? perhaps you modify auth_user table, could you show some code. no, i don't use populate, i insert it manually. e.g. controllers/install.py # -*- coding: utf-8 -*- # index def index(): if db(db.auth_permission).isempty() and db(db.auth_membership).ise

[web2py] Re: Emailing

2015-08-07 Thread 黄祥
please take a look at the book : http://web2py.com/books/default/chapter/29/08/emails-and-sms best regards, stifan -- 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] web2py 1.12.1 is out

2015-08-07 Thread Massimo Di Pierro
Changelog: - security fix: Validate for open redirect everywhere, not just in login() - allow to pack invidual apps and selected files as packed exe files - allow bulk user registration with default bulk_register_enabled=False - allow unsorted multiword query in grid search - better MongoDB su

[web2py] Emailing

2015-08-07 Thread Anthony Smith
Hi All, I have a app where I records sales, but I want to email different part of the sale to different people eg the person I brought only need to know what I item and how much, then another person needs to know how many and the item and how much. I can get this by using a post,but I cant wor