[web2py] mysql problem after updating to 2.6.4

2013-09-25 Thread Wouter Pronk
Hello, I've updated web2py to version 2.6.4 and now I get a Mysql-error which I didn't have before: > (1064, u"You have an > error in your SQL syntax; check the manual that corresponds to your MySQL > server version for the right syntax to use near 'LONGTEXT))) AND > (relatie_datatypes.mess

Re: [web2py] Re: replacing T() with T.M()

2013-09-25 Thread Massimo Di Pierro
Yes the produce the same output but while T.M(s) caches the markmin output, MARKMIN(T(s)) only caches the translated string before MARKMIN rendering. Therefore T.M(s) is faster. On Wednesday, 25 September 2013 20:09:38 UTC-5, Anthony wrote: > > Sorry, that wasn't clear. But why can't you just do

Re: [web2py] Re: Using @auth.requires_login() in modules

2013-09-25 Thread Massimo Di Pierro
You may want to look at the lazy_cache decorator in gluon/cache.py. I think we need something like that for Auth. On Wednesday, 25 September 2013 22:45:46 UTC-5, Mandar Vaze wrote: > > > On Wed, Sep 25, 2013 at 7:53 PM, Massimo Di Pierro > > > wrote: > >> Let me clarify. You currently can pass

Re: [web2py] Re: Using @auth.requires_login() in modules

2013-09-25 Thread Mandar Vaze / मंदार वझे
On Wed, Sep 25, 2013 at 7:53 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > Let me clarify. You currently can pass auth to functions in modules and > they can call auth methods. It is the decorators that would cause problems. > Understood - in fact this is what we are doing right no

[web2py] Re: Web2py 2.6.4 xmlrpc bug?

2013-09-25 Thread IVINH
I have updated new code and it's work. Thanks. Vào 21:28:22 UTC+7 Thứ tư, ngày 25 tháng chín năm 2013, Massimo Di Pierro đã viết: > > I am using the code in trunk and this work: > > # in controller > @service.xmlrpc > def add(a,b): return a+b > def call(): return service() > > # in shell > >>> im

Re: [web2py] Re: replacing T() with T.M()

2013-09-25 Thread Anthony
Sorry, that wasn't clear. But why can't you just do: var ajax_error_500 = '{{=MARKMIN(T('An error occurred, please [[reload %s]]the page') % URL(args=request.args, vars=request.get_vars))}}' Anthony On Wednesday, September 25, 2013 5:47:31 PM UTC-4, dbdevelope

[web2py] Re: Model "before save" functionality?

2013-09-25 Thread Massimo Di Pierro
Look up db.table._before_insert db.table._before_update There is also form.process(onvalidation = lambda form: .) On Wednesday, 25 September 2013 19:34:01 UTC-5, User wrote: > > I have a model with latitude and longitude fields. The lat and lng should > be computed from the address via G

[web2py] Re: Amazon RDS Connection String

2013-09-25 Thread Massimo Di Pierro
can you show us the code? On Monday, 23 September 2013 14:12:53 UTC-5, Tushar Tuteja wrote: > > hey > I am using turnkey on EC2, > I am unable to connect o my db > it says unable to connect. > is their is some problem with the connection string ? > or security groups ? > > > > -- Resources: - h

[web2py] Model "before save" functionality?

2013-09-25 Thread User
I have a model with latitude and longitude fields. The lat and lng should be computed from the address via Google geocoding. Whenever the model is inserted or updated I want to update the lat and lng from the address of the model. In Yii PHP framework there a number of events that you can cu

Re: [web2py] Programmatic forms, add_button, and button order

2013-09-25 Thread Warren Block
The FORM section of the book specifically mentions add_button, right before the SQLFORM section. If it only works with SQLFORM, that should be moved. If it does work with FORM, a trivial example would be good right there. On Wed, 25 Sep 2013, Richard Vézina wrote: I think it is a method of

Re: [web2py] Re: need help to improve download of dynamic images (nginx)

2013-09-25 Thread Tito Garrido
I just got it to work checking the error log from nginx: location /home/www-data/web2py/applications/YOURAPP/uploads { internal; expires max; include /etc/nginx/conf.d/web2py/gzip.conf; alias /home/www-data/web2py/applications/

[web2py] Re: references how to create module in web2py

2013-09-25 Thread 黄祥
thank you so much for your detail explaination massimo. top level in the module is it define (request = current.request) as a global variable on the module? another question, is i read in the book : Bytecode compile your app using admin. even better - define functions in modules, import them and

[web2py] Re: Mail Not Working

2013-09-25 Thread 黄祥
> > "Mail.send failure:[Errno -3] Temporary failure in name resolution " > > i think it related to your dns, had you already check and configure your dns on your site and then match it with web2py mail.settings? best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (

[web2py] Field datetime default to something besides request.now/utcnow?

2013-09-25 Thread Tom H
Hi, Quick question: I'd like to use the backend database functions for setting the datetime defaults, for columns like created_on and modified_on I'm assuming web2py is using the timestamps in the request objects to do it client side as part of inserts/updates, instead of the db server setting

[web2py] Re: Amazon RDS Connection String

2013-09-25 Thread Tushar Tuteja
connection string is fine , I was unable to mange the security group. On Tuesday, September 24, 2013 1:32:24 AM UTC+5:30, Massimo Di Pierro wrote: > > What's your connections string? > > On Monday, 23 September 2013 14:12:53 UTC-5, Tushar Tuteja wrote: >> >> hey >> I am using turnkey on EC2, >> I

[web2py] Mail Not Working

2013-09-25 Thread Tushar Tuteja
Hey I hosted my site on EC2. when I use the host as ip address, I am able to send the mails. But when use my domain mydomain.com instead of an ip address it gives me following error "Mail.send failure:[Errno -3] Temporary failure in name resolution " thanks, regards, -- Resources: - http://

[web2py] Re: SQLite DLL with ICU - support multilingual LIKE statements and ORDER BY

2013-09-25 Thread Miloš Šabík
Last download on page (*Sqlite 3.7.4 with ICU 3.8*) contains clear SQLite without ICU. Please check it. Thank you for complilation. I have your older compilation and it works perfectly. Dňa utorok, 13. januára 2009 20:31:32 UTC+1 Petros Diveris napísal(-a): > > Hi, > > Following my previous pos

Re: [web2py] Re: need help to improve download of dynamic images (nginx)

2013-09-25 Thread Niphlod
did you enable it in nginx with the configurations explained in their wiki ? On Wednesday, September 25, 2013 5:53:05 PM UTC+2, Tito Garrido wrote: > > Hi Niphlod! > > I am using nginx as server and when I tried to use: > > response.headers['X-Accel-Redirect'] = os.path.join(request.folder, > 'up

Re: [web2py] request.url with scheme

2013-09-25 Thread Niphlod
check also request.env . holds all the pieces, although scheme=True and host=True usually cut the deal. On Wednesday, September 25, 2013 8:46:00 PM UTC+2, Richard wrote: > > Hello, > > I want to grab the actual url not just relative, request.url give me the > relative url. I thought of this : >

Re: [web2py] Re: replacing T() with T.M()

2013-09-25 Thread Vladyslav Kozlovskyy
T.M() uses MARKMIN (see docs in attachment). Using MARKMIN you can create message with link, img, tables, bold, italic, colors and so on. Vlad У ср, 2013-09-25 у 07:20 -0700, Anthony пише: > var ajax_error_500 = '{{=T.M('An error occurred, please > [[reload %s]] the page') % U

Re: [web2py] Programmatic forms, add_button, and button order

2013-09-25 Thread Richard Vézina
I think it is a method of SQLFORM. FORM() is a web2py helpers, it unique role is generate html. SQLFORM is another beast. Maybe further reading of the book could help you better understand the difference : http://web2py.com/books/default/chapter/29/07/forms-and-validators Richard On Wed, Sep 25,

[web2py] Print-friendly css for SQLTABLE?

2013-09-25 Thread Dave S
Is there an example of setting up print-friendly CSS for a page that uses SQLTABLE? If not, suggestions as to which file (...project/static/css/web2py.css, web2py_bootstrap.css, ...) I should start in to roll my own? If in Opera 12.16 on Fedora 16, trying to print a selection area inside the

Re: [web2py] Programmatic forms, add_button, and button order

2013-09-25 Thread Warren Block
And it's only just now I realize that "months" is a set, not a list. Changing it to ['January', ...] solves the order. I'm still curious why add_button does not work with a simple FORM(), though. On Wed, 25 Sep 2013, Warren Block wrote: This generates a random-hashed order also (although I h

[web2py] Re: session add value error on pythonanywhere

2013-09-25 Thread 黄祥
i downloaded in my local n then uploaded to pythonanywhere because download nightly build from console not work. the session value is worked when i test using nightly build. many thanks and best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http:

Re: [web2py] Programmatic forms, add_button, and button order

2013-09-25 Thread Warren Block
This generates a random-hashed order also (although I had to add more months to see it): months = {'January', 'February', 'March', 'April', 'May', 'June'} buttons = [] for month in months: buttons.append(TAG.button(month, _type="button")) form = SQLFORM.factory(db=None, b

[web2py] Re: session add value error on pythonanywhere

2013-09-25 Thread 黄祥
i've repeated many time, but still get the same result. tested download nightly build from chrome and firefox on pythonanywhere. here is the detail error : 18:56 ~ $ wget http://www.web2py.com/examples/static/nightly/web2py_src.zip --2013-09-25 1

[web2py] request.url with scheme

2013-09-25 Thread Richard
Hello, I want to grab the actual url not just relative, request.url give me the relative url. I thought of this : {{=T('To reproduce this report copy this link :')}} {{=URL(request.url, scheme=True)}} But request.url already have app include and controller that get duplicated by scheme=True...

[web2py] Re: Inserting NULL with SQLFORM, list:string, and multiple=True

2013-09-25 Thread Massimo Di Pierro
The idea was to distinguish between db.table.insert(field=None) # None and db.table.insert(field=[]) # "||" The latter comes from the fact that [1,2,3] gets serialized as "|1|2|3|". So we can search for "|2|" using string matching. You may be able to fix this using a custom validator. I

Re: [web2py] Programmatic forms, add_button, and button order

2013-09-25 Thread Richard Vézina
Why not using SQLFORM.factory() and get the new buttons attributes that let you manage as many buttons as you want? It also let you manage buttons positions much more easilly then manipulate the generated form. Richard On Wed, Sep 25, 2013 at 1:17 PM, Warren Block wrote: > Trying to generate a

[web2py] Programmatic forms, add_button, and button order

2013-09-25 Thread Warren Block
Trying to generate a small form that is all buttons: def month-example: months = {'January', 'February', 'March'} form = FORM() for month in months: # this fails form.add_button(month, URL(month)) return dict(form=form) This generates 'NoneType' object has no att

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-25 Thread step
Disregard my previous post, mine's definitely a different issue. Sorry for intruding. On Wednesday, September 25, 2013 6:48:34 PM UTC+2, step wrote: > > Devs ignore my question if you think it has nothing to do with this issue, > but I came looking for a similar pattern. Ever since I upgraded fr

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-25 Thread step
Devs ignore my question if you think it has nothing to do with this issue, but I came looking for a similar pattern. Ever since I upgraded from 2.6.1 to 2.6.3 and now 2.6.4 I have noticed cases where submitting a form POSTs to the wrong target page. In all cases '#' is the form action. My views

[web2py] Re: Selecting records that are not referenced by other records.

2013-09-25 Thread step
Got it now. In fact, I think this example is more meaningful than the one currently in the book to illustrate why one would want to nest select into belongs. Thanks. On Wednesday, September 25, 2013 8:29:53 AM UTC+2, Niphlod wrote: > > it's explained pretty well on the book > > > http://web2py.c

[web2py] Re: Inserting NULL with SQLFORM, list:string, and multiple=True

2013-09-25 Thread REM
Thanks for your response. I appreciate it! This is part of a legacy DB. I am moving my company from using PHP on the web to web2py and I would like to avoid doing a lot of re-hacking on the perl program which does all of the heavy lifting (or hacking on the millions of records already in the DB

Re: [web2py] getting current logged user in a model file used as a scheduler

2013-09-25 Thread Niphlod
you're making things much more complicated than they really are. the scheduler can't know about the user, but the controller that queues the task does. so, I'd work on a function to schedule like: def do_this(user_id): do_whatever_with_user_id and queue it with mysched.queue_task(do_this,

Re: [web2py] Re: need help to improve download of dynamic images (nginx)

2013-09-25 Thread Tito Garrido
Hi Niphlod! I am using nginx as server and when I tried to use: response.headers['X-Accel-Redirect'] = os.path.join(request.folder, 'uploads', document.file) return '' mine is: *... path = splits[0] + '.' + splits[1] + '/' + splits[2][:2] + '/' global_path = path + image filename = os.path.join(

[web2py] Re: Auth modal redirects to profile instead of index

2013-09-25 Thread raferbop
#default.py def index(): return dict() def handle_user(): return dict(form=auth()) #default/index.html {{=LOAD('default','handle_user.load',args='login',ajax=True,target='uniqseven',extension=False)}} {{=LOAD('default','handle_user.load', args='register',

Re: [web2py] getting current logged user in a model file used as a scheduler

2013-09-25 Thread Richard Vézina
Read this thread : https://groups.google.com/d/msg/web2py/5w4YbZYNcWM/2Wi7V3jAsBIJ You will see, what you try to do is not that easy. Richard On Wed, Sep 25, 2013 at 10:39 AM, ajith c t wrote: > is there any update or modification in comet_messenger, because I cannot > see a file comet_messe

Re: [web2py] getting current logged user in a model file used as a scheduler

2013-09-25 Thread ajith c t
is there any update or modification in comet_messenger, because I cannot see a file comet_messenger in the contrib folder. And I am not sure whether it is the solution, It seems like a websocket thing. What I need is how to find the current logged in user in scheduler task. I tried passing the

[web2py] Re: session add value error on pythonanywhere

2013-09-25 Thread Massimo Di Pierro
I do not know. Retry. It works for me. On Wednesday, 25 September 2013 03:23:23 UTC-5, 黄祥 wrote: > > i can't download trunk version on pythonanywhere (ERROR 403: Forbidden), > in my local environment can (trunk version). > test download stable version on pythonanywhere can. > > wget http://www.w

[web2py] Re: Web2py 2.6.4 xmlrpc bug?

2013-09-25 Thread Massimo Di Pierro
I am using the code in trunk and this work: # in controller @service.xmlrpc def add(a,b): return a+b def call(): return service() # in shell >>> import xmlrpclib >>> s = xmlrpclib.ServerProxy('http://127.0.0.1:8000/test/default/call/xmlrpc') >>> s.add(3,4) 7 On Wednesday, 25 September 2013 01:

[web2py] Re: references how to create module in web2py

2013-09-25 Thread Massimo Di Pierro
from gluon import current then you can use current.request, current.response, current.session, current.cache and current.T. The only catch is that you can use them in functions called by your app but not at top level. For example you cannot do: request = current.request at top level in the modu

[web2py] Re: Using @auth.requires_login() in modules

2013-09-25 Thread Massimo Di Pierro
Let me clarify. You currently can pass auth to functions in modules and they can call auth methods. It is the decorators that would cause problems. On Wednesday, 25 September 2013 09:23:10 UTC-5, Massimo Di Pierro wrote: > > You cannot with auth. If you pass it to modules you will run into issues

[web2py] Re: Using @auth.requires_login() in modules

2013-09-25 Thread Massimo Di Pierro
You cannot with auth. If you pass it to modules you will run into issues with threads. Open a ticket we can create a lazy_auth decorator that allows something like what you want. On Wednesday, 25 September 2013 00:10:45 UTC-5, Mandar Vaze wrote: > > Even I have come across such requirements. > S

[web2py] Re: replacing T() with T.M()

2013-09-25 Thread Anthony
> > var ajax_error_500 = '{{=T.M('An error occur*r*ed, please [[reload > %s]] the page') % URL(args=request.args, vars=request.get_vars) }}' The original included an HTML element. In your example above, does the [[... %s]] notation indicate that an element should be created? If so, what

[web2py] Re: Inserting NULL with SQLFORM, list:string, and multiple=True

2013-09-25 Thread Massimo Di Pierro
There is a function in dal.py def bar_encode(items): return '|%s|' % '|'.join(bar_escape(item) for item in items if str(item).strip()) I guess one could override it but it may break something in web2py. Why? On Tuesday, 24 September 2013 23:51:27 UTC-5, REM wrote: > > I am inserting data

[web2py] Re: Unable to get the data, ajax fail with status is 200

2013-09-25 Thread Anthony
Because jQuery is expecting a JSON response, if the returned data do not parse to valid JSON, you will get an error (even with a 200 status). Can you check the returned data in the failure cases and see if they are valid JSON? Anthony On Wednesday, September 25, 2013 1:22:17 AM UTC-4, Jayakuma

Fwd: [web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-25 Thread Michele Comitini
-- Forwarded message -- From: Michele Comitini Date: 2013/9/25 Subject: Re: [web2py] Re: batch script - best way to reopen a closed database connection? To: Ricardo Cárdenas Try using the auto_import see the following: db.commit() sleep(20) # <-- here I stop and restart the post

Re: [web2py] getting current logged user in a model file used as a scheduler

2013-09-25 Thread Richard Vézina
I don't think you can be sure you have logged user except by using comet_messenger.py contrib and tornado. There is many thread about this. Richard On Wed, Sep 25, 2013 at 9:04 AM, ajith c t wrote: > Hi, > > I have a scheduler which is setup in a model file. A set of task is > written in t

Re: [web2py] Pycharm 3.0 is here with web2py support

2013-09-25 Thread Richard Vézina
+1 Working with EAP since 2 months and it a charm. :) Richard On Tue, Sep 24, 2013 at 5:38 PM, Michele Comitini < michele.comit...@gmail.com> wrote: > +1 > > This is great! > > > 2013/9/24 Alfonso de la Guarda > >> Hi, >> >> Finally we got pycharm 3 with web2py support, there is also a >> co

[web2py] getting current logged user in a model file used as a scheduler

2013-09-25 Thread ajith c t
Hi, I have a scheduler which is setup in a model file. A set of task is written in the scheduler.py which is queued from the controller. My problem is I need to get the current logged in user in this scheduler.py file so that I can write query with respect to the logged in user. I can obta

Re: [web2py] Re: OFF topic - Git question

2013-09-25 Thread Marin Pranjić
1. I am not sure about windows 2. I am not sure about modules because I don't use them in my apps (not for now) I will check Marin On Wed, Sep 25, 2013 at 2:03 PM, Loïc wrote: > Hi Marin > > I tried what you suggested : use a symlink inside /applications folder > But I get an error on my modu

Re: [web2py] Re: OFF topic - Git question

2013-09-25 Thread Loïc
Hi Marin I tried what you suggested : use a symlink inside /applications folder But I get an error on my modules. I'm unsing mklink command on Win7, and my app works fine when located inside /applications folder without symlink... Do you have an idea? Ticket ID 127.0.0.1.2013-09-25.13-53-37.

[web2py] Re: how to assign classes to TDs in SQLFORM.grid

2013-09-25 Thread Tim Richardson
I think it would be nice to solve this when the SQLFORM.grid is made I've made a pull request and started a thread here https://groups.google.com/forum/#!topic/web2py-developers/qx70MzEnP-I -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2p

Re: [web2py] Re: OFF topic - Git question

2013-09-25 Thread Vinicius Assef
Yes, I use Marin's approach and I've never been in trouble with it. I just sent a post about web2py_devenv [1]. Maybe it can interest you. [1] https://github.com/viniciusban/web2py_devenv On Wed, Sep 25, 2013 at 7:59 AM, Marin Pranjić wrote: > Yes gitignore is the answer but I have been burned

[web2py] A project to easy Web2py development environment setup

2013-09-25 Thread Vinicius Assef
Hi folks. I'm working on a project I called web2py_devenv [1] which is a better approach than new_web2py_project.sh [2]. Actually, the 2nd approach is part of web2py_devenv and in near future they will have common features, like customizing a scaffolding application with an option. Now I'm focus

Re: [web2py] Re: OFF topic - Git question

2013-09-25 Thread Marin Pranjić
Yes gitignore is the answer but I have been burned once trying to git reset so I lost my app repo. Now I am using symbolic links inside /applications folder and I keep applications separated. Marin On Wed, Sep 25, 2013 at 12:49 PM, António Ramos wrote: > This in gitignore is the answer right? >

[web2py] Re: OFF topic - Git question

2013-09-25 Thread António Ramos
This in gitignore is the answer right? applications/* !applications/welcome !applications/welcome/* !applications/examples !applications/examples/* !applications/admin !applications/admin/* applications/*/databases/* applications/*/sessions/* applications/*/errors/* applications/*/cache/* applicat

[web2py] OFF topic - Git question

2013-09-25 Thread António Ramos
Hello , i´m starting to learn git but have a question I have my web2py cloned from git inside web2py i have the application folder if i git init inside app1 is there some kind of conflict with the web2py folder git? Thank you António -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Selecting records that are not referenced by other records.

2013-09-25 Thread Michael Hall
Hey guys this works a treat and I have learned something new. Thanks for the help. On Tuesday, 24 September 2013 11:16:52 UTC+1, Michael Hall wrote: > > I am not the most awesome SQL person and as such I am having trouble > constructing a query I need. > > I have two tables in a database called

Re: [web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-25 Thread Michele Comitini
Yes, but the connection in the pool will get dropped anyway. After some thought IMHO the correct way for you to fix the problem is: ...wait...wait... db = DAL(...) db.commit() #<- commit or rollback as soon as possible ...wait...wait... db = DAL(...) db.commit() #<- commit or rollback as soon a

Re: [web2py] Re: batch script - best way to reopen a closed database connection?

2013-09-25 Thread Ricardo Cárdenas
@michele, @niphlod I tried db.commit() and then waiting for more than wait_timeout (300 seconds). I also tried db._adapter.reconnect(). Neither worked for me: MySQL on PA still raises OperationalError: (2013, 'Lost connection to MySQL server during query') after the wait. (If I wait just under

[web2py] replacing T() with T.M()

2013-09-25 Thread Vladyslav Kozlovskyy
Hi all! During translating I have found in applications/welcome/views/web2py_ajax.html such calls (marked red):