[web2py] Re: weird auth bug

2013-12-11 Thread dederocks
My mistake: I was trying to connect to a non-existent postgresql db without 
psycop2!
Sorry for the noise.

Le mercredi 11 décembre 2013 12:22:20 UTC+1, dederocks a écrit :
>
> Hello,
>
> I have a weird auth bug: in an app that used to run just fine, all of a 
> sudden login (and user creation) is impossible: I get a 'Bad Request - 
> HTTP body is incomplete' message for the corresponding actions.
> What is weird is that login works just fine for the other apps I have! I 
> also checked file & folder access rights -- they are fine.
>
> Does someone have a clue where I should look for solving this?
>
> Thanks, Andre
>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] weird auth bug

2013-12-11 Thread dederocks
Hello,

I have a weird auth bug: in an app that used to run just fine, all of a 
sudden login (and user creation) is impossible: I get a 'Bad Request - HTTP 
body is incomplete' message for the corresponding actions.
What is weird is that login works just fine for the other apps I have! I 
also checked file & folder access rights -- they are fine.

Does someone have a clue where I should look for solving this?

Thanks, Andre

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: chat-tornado in web2py using websocket_messaging.py

2013-11-06 Thread dederocks
Thanks for the feedback -- I'm still using 2.5.1.

Le mercredi 6 novembre 2013 15:49:11 UTC+1, Massimo Di Pierro a écrit :
>
> This should be fixed in trunk, no?
>
> On Wednesday, 6 November 2013 06:48:58 UTC-6, dederocks wrote:
>>
>> Hi, 
>> I don't know if this could have solved your issue, but I had the same 
>> problem using Chromium on Ubuntu. This dissapeared when using Chrome on the 
>> same platform -- I have no idea why!
>>
>> Le samedi 5 octobre 2013 00:42:17 UTC+2, Junior Phanter a écrit :
>>>
>>> greetings ,
>>> sorry my bad english , I 'm trying to implement a chat using the tornado 
>>> and websocket_messaging.py , but I'm having trouble hearing the tornado 
>>> server . the server receives the tornado MESSAGES using :
>>>
>>> websocket_send ( ' http://127.0.0.1: ', ' Hello World ', ' mykey ', 
>>> ' mygroup ' )
>>>
>>> but the script :
>>> -
>>>
>>>$(document).ready(function(){
>>>   var data;
>>>   web2py_websocket('ws://127.0.0.1:/realtime/mygroup
>>> ',function(e){data=eval('('+e.data+')')});
>>>});
>>>
>>> -
>>> does not capture the listener .
>>>
>>> I tested the application that comes as an example within the 
>>> websocket_messaging.py and neither worked .
>>>
>>> - exemplo dentro do websocket_messaging.py 
>>> --
>>>
>>> Here is a complete sample web2py action:
>>>
>>> def index():
>>> form=LOAD('default','ajax_form',ajax=True)
>>> script=SCRIPT('''
>>> jQuery(document).ready(function(){
>>>   var callback=function(e){alert(e.data)};
>>>   if(!web2py_websocket('ws://127.0.0.1:/realtime/mygroup
>>> ',callback))
>>> alert("html5 websocket not supported by your browser, 
>>> try Google Chrome");
>>> });
>>> ''')
>>> return dict(form=form, script=script)
>>>
>>> def ajax_form():
>>> form=SQLFORM.factory(Field('message'))
>>> if form.accepts(request,session):
>>> from gluon.contrib.websocket_messaging import websocket_send
>>> websocket_send(
>>> 'http://127.0.0.1:
>>> ',form.vars.message,'mykey','mygroup')
>>> return form
>>>
>>>
>>> -
>>>
>>>
>>>
>>> I'm using the Tornado 2.1 and 2.6.4 web2py
>>>
>>>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: chat-tornado in web2py using websocket_messaging.py

2013-11-06 Thread dederocks
Hi, 
I don't know if this could have solved your issue, but I had the same 
problem using Chromium on Ubuntu. This dissapeared when using Chrome on the 
same platform -- I have no idea why!

Le samedi 5 octobre 2013 00:42:17 UTC+2, Junior Phanter a écrit :
>
> greetings ,
> sorry my bad english , I 'm trying to implement a chat using the tornado 
> and websocket_messaging.py , but I'm having trouble hearing the tornado 
> server . the server receives the tornado MESSAGES using :
>
> websocket_send ( ' http://127.0.0.1: ', ' Hello World ', ' mykey ', ' 
> mygroup ' )
>
> but the script :
> -
>
>$(document).ready(function(){
>   var data;
>   web2py_websocket('ws://127.0.0.1:/realtime/mygroup
> ',function(e){data=eval('('+e.data+')')});
>});
>
> -
> does not capture the listener .
>
> I tested the application that comes as an example within the 
> websocket_messaging.py and neither worked .
>
> - exemplo dentro do websocket_messaging.py 
> --
>
> Here is a complete sample web2py action:
>
> def index():
> form=LOAD('default','ajax_form',ajax=True)
> script=SCRIPT('''
> jQuery(document).ready(function(){
>   var callback=function(e){alert(e.data)};
>   if(!web2py_websocket('ws://127.0.0.1:/realtime/mygroup
> ',callback))
> alert("html5 websocket not supported by your browser, try 
> Google Chrome");
> });
> ''')
> return dict(form=form, script=script)
>
> def ajax_form():
> form=SQLFORM.factory(Field('message'))
> if form.accepts(request,session):
> from gluon.contrib.websocket_messaging import websocket_send
> websocket_send(
> 'http://127.0.0.1:
> ',form.vars.message,'mykey','mygroup')
> return form
>
>
> -
>
>
>
> I'm using the Tornado 2.1 and 2.6.4 web2py
>
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Python Module, USB device, web2py

2013-09-11 Thread dederocks
Hi, 

I've done (I think) something similar to what you are trying to achieve.
The way we've done it is as follows:
1. Have a separate thread with a python script that pulls the values from 
your USB instrument (in my case it was a serial port, don't know how to 
deal with a USB port) into a redis queue. Something like
# usb_data_pull_function
import redis
import json
r =redis.Redis(host='127.0.0.1')
while True:
data = [get USB value]
r.rpush('datalist',json.dumps(data))
if json.loads(r.get('stopAcquisition')):
break
 

You start this thread with a web2py function or when the computer starts - 
up to you - with
from threading import Thread

dataPuller=Thread(target=usb_data_pull_function)
dataPuller.start()


Then in web2py have a function that when called returns the redis data 
extracted from the redis queue
And finaly have an ajax function on the view that calls this web2py 
function at a given interval and displays the values returned the way you 
want.
I hope this helps.
Andre


Le mercredi 11 septembre 2013 01:58:41 UTC+2, viniciusban a écrit :
>
> It depends. 
>
> Is you multimeter in the same computer your web2py instance is running? 
>
> On Tue, Sep 10, 2013 at 5:33 PM, Zachary Burrows 
> > 
> wrote: 
> > Hello all! 
> > 
> > My boss wants me to use web2py to call a script that reads a value from 
> a 
> > multimeter. He wants that value put onto a web2py page. I have written 
> the 
> > script, but am not getting anywhere in trying to call it and display its 
> > result on my web2py page. I just keep breaking stuff (getting errors). 
> > 
> > I'm not a web developer, but I've been reading about MVC design and 
> going 
> > through "Python the Hard Way." I'm learning, but am far from the 
> promised 
> > land. 
> > 
> > Can anyone give me a quick and dirty way to do this? Or am I in WAY over 
> my 
> > head? Cuz that's how I feel right now. 
> > 
> > thanks! 
> > 
> > -- 
> > 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-users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to web2py+un...@googlegroups.com . 
> > For more options, visit https://groups.google.com/groups/opt_out. 
>

-- 
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-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py Demos - Down?

2013-07-25 Thread dederocks
Same for me.

Le jeudi 25 juillet 2013 20:55:31 UTC+2, Ben A a écrit :
>
> Is it just me, or is everyone getting errors when they try to access the 
> demos for web2py found here: http://web2py.com/demo_admin/default/site
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Err 24: too many files open

2013-07-25 Thread dederocks
I found the problem!

And the source was (of course) me.

The connexion class was defined as follows:

class Connexion(object):

rCMD = redis.Redis(host='127.0.0.1')
   
def __init__(self):
if not self.rCMD.exists('ConsistoPort'):
(...)


Which is wrong, as I have to do:

class Connexion(object):

rCMD = None
   
def __init__(self):
self.rCMD = redis.Redis(host='127.0.0.1')
if not self.rCMD.exists('ConsistoPort'):
(...)


I appologize for the noise and at the same time thank for the very 
constructive feedbacks!

Le jeudi 25 juillet 2013 09:07:14 UTC+2, Paolo Valleri a écrit :
>
> I am not a redis expert and I don't know how web2py handles the 
> interaction with redis, either.
> However the scenario could be, either you instantiate one or more new 
> connections for request or 'expired' connections are not closed. 
> I am for the former case, could you post few lines where redis is 
> instantiated?
>
>  Paolo
>
> On Thursday, July 25, 2013 8:48:37 AM UTC+2, dederocks wrote:
>>
>> Thank you Paolo for the benchmark!
>> In my case, I start at 107, and at the end of the process the count is at 
>> 672!! nginx on the other hand is stable around 55.
>> And the culprit is (drums ...): redis! The large majority of the files 
>> opened are the redis port.
>> Extract from lsof:
>> uwsgi   2128 www-data  511u  IPv4  62305  0t0 TCP 
>> localhost:56632->localhost:6379 (ESTABLISHED)
>> uwsgi   2128 www-data  512u  IPv4  62536  0t0 TCP 
>> localhost:56661->localhost:6379 (ESTABLISHED)
>> uwsgi   2128 www-data  513u  IPv4  62361  0t0 TCP 
>> localhost:56639->localhost:6379 (ESTABLISHED)
>> uwsgi   2128 www-data  514u  IPv4  62377  0t0 TCP 
>> localhost:56641->localhost:6379 (ESTABLISHED)
>> uwsgi   2128 www-data  515u  IPv4      62392  0t0 TCP 
>> localhost:56643->localhost:6379 (ESTABLISHED)
>>
>> Does someone know how to fix this?
>>
>> Le jeudi 25 juillet 2013 08:28:08 UTC+2, Paolo Valleri a écrit :
>>>
>>> dederocks, I've just tried to run lsof -p  on a ubuntu 
>>> server running web2py
>>> In my case, it returns 138 opened files among libraries, sockets and so 
>>> on; the most opened file is /dev/zero, opened 55 times.  
>>>
>>> Paolo
>>>
>>> On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote:
>>>>
>>>> Thanks a lot for the link. Unfortunately it didn't help.
>>>> @roberto: the uwsgi process is then indeed eating all the CPU - but I'm 
>>>> not sure it means uwsgi is the culprit, at least at this stage (could be 
>>>> the case earlier though).
>>>> Is there in linux a way to know who opened which file and when? lsof 
>>>> gives only the process, not the time.
>>>>
>>>> Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit :
>>>>>
>>>>> it's a problem on the layers "at the base" of web2py, such as the os, 
>>>>> nginx or uwsgi.
>>>>> http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/
>>>>> let's see if @roberto (the developer behind uwsgi) passes by with some 
>>>>> useful tips too. 
>>>>>
>>>>> On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote:
>>>>>>
>>>>>> I'm running web2py on nginx /uwsgi.
>>>>>> And in a sequence implying frequent serveur calls, I eventually get 
>>>>>> an error 500 from the server, which is actualy an error 24: too many 
>>>>>> files 
>>>>>> open (see ticket in attachement).
>>>>>>
>>>>>> I checked former reports on this error, but none seems to match this 
>>>>>> case: I'm not using rocket, and running the latest web2py stable version.
>>>>>> I checked also on opening files myself, but that is never the case 
>>>>>> (e.g. always done by web2py).
>>>>>> I tried to increase the file opened limit (ulimit -SHn 4048), but to 
>>>>>> no improvement.
>>>>>>
>>>>>> Any suggestion?
>>>>>>
>>>>>> Thanks in advance, Andre
>>>>>>
>>>>>>
>>>>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Err 24: too many files open

2013-07-24 Thread dederocks
Thank you Paolo for the benchmark!
In my case, I start at 107, and at the end of the process the count is at 
672!! nginx on the other hand is stable around 55.
And the culprit is (drums ...): redis! The large majority of the files 
opened are the redis port.
Extract from lsof:
uwsgi   2128 www-data  511u  IPv4  62305  0t0 TCP 
localhost:56632->localhost:6379 (ESTABLISHED)
uwsgi   2128 www-data  512u  IPv4  62536  0t0 TCP 
localhost:56661->localhost:6379 (ESTABLISHED)
uwsgi   2128 www-data  513u  IPv4  62361  0t0 TCP 
localhost:56639->localhost:6379 (ESTABLISHED)
uwsgi   2128 www-data  514u  IPv4  62377  0t0 TCP 
localhost:56641->localhost:6379 (ESTABLISHED)
uwsgi   2128 www-data  515u  IPv4  62392  0t0 TCP 
localhost:56643->localhost:6379 (ESTABLISHED)

Does someone know how to fix this?

Le jeudi 25 juillet 2013 08:28:08 UTC+2, Paolo Valleri a écrit :
>
> dederocks, I've just tried to run lsof -p  on a ubuntu server 
> running web2py
> In my case, it returns 138 opened files among libraries, sockets and so 
> on; the most opened file is /dev/zero, opened 55 times.  
>
> Paolo
>
> On Thursday, July 25, 2013 8:18:32 AM UTC+2, dederocks wrote:
>>
>> Thanks a lot for the link. Unfortunately it didn't help.
>> @roberto: the uwsgi process is then indeed eating all the CPU - but I'm 
>> not sure it means uwsgi is the culprit, at least at this stage (could be 
>> the case earlier though).
>> Is there in linux a way to know who opened which file and when? lsof 
>> gives only the process, not the time.
>>
>> Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit :
>>>
>>> it's a problem on the layers "at the base" of web2py, such as the os, 
>>> nginx or uwsgi.
>>> http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/
>>> let's see if @roberto (the developer behind uwsgi) passes by with some 
>>> useful tips too. 
>>>
>>> On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote:
>>>>
>>>> I'm running web2py on nginx /uwsgi.
>>>> And in a sequence implying frequent serveur calls, I eventually get an 
>>>> error 500 from the server, which is actualy an error 24: too many files 
>>>> open (see ticket in attachement).
>>>>
>>>> I checked former reports on this error, but none seems to match this 
>>>> case: I'm not using rocket, and running the latest web2py stable version.
>>>> I checked also on opening files myself, but that is never the case 
>>>> (e.g. always done by web2py).
>>>> I tried to increase the file opened limit (ulimit -SHn 4048), but to no 
>>>> improvement.
>>>>
>>>> Any suggestion?
>>>>
>>>> Thanks in advance, Andre
>>>>
>>>>
>>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Err 24: too many files open

2013-07-24 Thread dederocks
Thanks a lot for the link. Unfortunately it didn't help.
@roberto: the uwsgi process is then indeed eating all the CPU - but I'm not 
sure it means uwsgi is the culprit, at least at this stage (could be the 
case earlier though).
Is there in linux a way to know who opened which file and when? lsof gives 
only the process, not the time.

Le mercredi 24 juillet 2013 23:56:10 UTC+2, Niphlod a écrit :
>
> it's a problem on the layers "at the base" of web2py, such as the os, 
> nginx or uwsgi.
> http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/
> let's see if @roberto (the developer behind uwsgi) passes by with some 
> useful tips too. 
>
> On Wednesday, July 24, 2013 4:30:51 PM UTC+2, dederocks wrote:
>>
>> I'm running web2py on nginx /uwsgi.
>> And in a sequence implying frequent serveur calls, I eventually get an 
>> error 500 from the server, which is actualy an error 24: too many files 
>> open (see ticket in attachement).
>>
>> I checked former reports on this error, but none seems to match this 
>> case: I'm not using rocket, and running the latest web2py stable version.
>> I checked also on opening files myself, but that is never the case (e.g. 
>> always done by web2py).
>> I tried to increase the file opened limit (ulimit -SHn 4048), but to no 
>> improvement.
>>
>> Any suggestion?
>>
>> Thanks in advance, Andre
>>
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: weird bug with redis

2013-07-22 Thread dederocks
Thanks A LOT Simone, that solved this problem!  Much much appreciated your 
help!!

Le vendredi 19 juillet 2013 02:15:25 UTC+2, Niphlod a écrit :
>
> seems a more general problem within the os than a bug with web2py and 
> redis. although I'm a heavy user of redis, I never encountered that error.
> this 
> http://askubuntu.com/questions/142508/how-to-fix-5-no-address-associated-with-hostname-error-while-updating
> is just a reference on a similar error on a totally different problem 
> (resolving hostnames for apt sources) but indeed is related to the same 
> "issue" : something is going on strangely on your server and it doesn't 
> resolve properly what "localhost" is.
> Shameless trial to fix the problem (read: it may work, but I can't test it 
> cause I can't reproduce the error): try  replacing localhost with 127.0.0.1
>
> On Thursday, July 18, 2013 4:35:48 PM UTC+2, dederocks wrote:
>>
>> Hello,
>>
>> I have encountered a weird bug using Redis. I understand it would be too 
>> complicated to get detailed help (software is running to supervise a 
>> machine), but I'm looking for cues on where to look.
>>
>> Here is the problem:
>> I use redis to share variables between processes. After a while, I get 
>> the following error in web2py: 
>>  Error -5 connecting 
>> localhost:6379. No address associated with hostname.
>> The instruction raising this message is never the same, allthough it's a 
>> redis command, of course: it always comes down to redis connexion missing 
>> that cannot be re-established (line 125 in redis' connection.py).
>>
>> What is weird is that redis remains accessible from the other processes, 
>> e.g. the server still operates without any problem.
>> The only solution I've found so far to solve the problem is restarting 
>> web2py (touch /etc/uwsgi/web2py.xml), and then it works again.
>> Any cue from someone on what could be wrong?
>>
>> Thanks, 
>> Andre
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] weird bug with redis

2013-07-18 Thread dederocks
Hello,

I have encountered a weird bug using Redis. I understand it would be too 
complicated to get detailed help (software is running to supervise a 
machine), but I'm looking for cues on where to look.

Here is the problem:
I use redis to share variables between processes. After a while, I get the 
following error in web2py: 
 Error -5 connecting 
localhost:6379. No address associated with hostname.
The instruction raising this message is never the same, allthough it's a 
redis command, of course: it always comes down to redis connexion missing 
that cannot be re-established (line 125 in redis' connection.py).

What is weird is that redis remains accessible from the other processes, 
e.g. the server still operates without any problem.
The only solution I've found so far to solve the problem is restarting 
web2py (touch /etc/uwsgi/web2py.xml), and then it works again.
Any cue from someone on what could be wrong?

Thanks, 
Andre

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Backup & Restore problems

2013-03-22 Thread dederocks
Sure. As long as what can and cannot be expected from the functions is 
clear, I'm happy with your way!

Le jeudi 21 mars 2013 16:44:17 UTC+1, Niphlod a écrit :
>
> my point exactly  it's a matter on how it's perceived as a 
> one-solution-for-all-exporting-problem vs a rapid way to load fixtures/etc 
> in your environment.
>
> On Thursday, March 21, 2013 4:41:48 PM UTC+1, Anthony wrote:
>>
>> Removing the functionality altogether seems extreme. However, perhaps we 
>> should change the documentation to remove the backup/restore terminology 
>> (i.e., we can describe it as a way to "export" and "import" an entire db, 
>> but not recommend it as a primary backup strategy and instead recommend 
>> native db functionality for that purpose).
>>
>> Anthony
>>
>> On Thursday, March 21, 2013 10:57:05 AM UTC-4, dederocks wrote:
>>>
>>> Yes - unless someone finds a good use for these two functions.
>>> It looks to me that if a record has been removed in a db (e.g. id is not 
>>> continuous: 1, 2, 4, 5 for example), the restore won't work if the table is 
>>> linked to another table. This is I think a sufficiently likely case to 
>>> remove the functions - or am I wrong?
>>>
>>> Le jeudi 21 mars 2013 15:42:51 UTC+1, Niphlod a écrit :
>>>>
>>>> so you'd prefer to have it removed alltogether ?
>>>>
>>>> On Thursday, March 21, 2013 3:37:44 PM UTC+1, dederocks wrote:
>>>>>
>>>>> Thanks Ales,
>>>>> Basically, you're confirming the native backup / restore choice. I'm 
>>>>> concerned though that web2py's csv solution is not reliable, and should 
>>>>> therefore be used with high caution -- not to say a word about how slow 
>>>>> it 
>>>>> is. It feels sad for me that web2py which other than that an incredible 
>>>>> tool keeps this unpractical feature.
>>>>>
>>>>> Regards, 
>>>>> Andre
>>>>>
>>>>> Le jeudi 21 mars 2013 15:09:23 UTC+1, LightDot a écrit :
>>>>>>
>>>>>> I solved a similar case by writing a function to a) use native 
>>>>>> postgres dump and archive the database and b) present the file to the 
>>>>>> user 
>>>>>> for download in the administrative back-end. This function is triggered 
>>>>>> by 
>>>>>> cron in my case, but it could also be executed on demand. For this I 
>>>>>> would 
>>>>>> use the scheduler and throw in some additional checks so the user 
>>>>>> doesn't 
>>>>>> trigger the backup too often.
>>>>>>
>>>>>> Hope this helps a bit.
>>>>>>
>>>>>> Regards,
>>>>>> Ales
>>>>>>
>>>>>> On Thursday, March 21, 2013 2:42:51 PM UTC+1, dederocks wrote:
>>>>>>>
>>>>>>> Indeed, or quite close: 
>>>>>>> https://code.google.com/p/web2py/issues/detail?id=1387.
>>>>>>> And to be accurate, I think the issue has more to do with restore 
>>>>>>> than backup.
>>>>>>>
>>>>>>> To build on your comment, there are indeed two ways to deal with 
>>>>>>> backup / restore:
>>>>>>> 1- managed by the database manager using native backup / restore;
>>>>>>> 2- managed by the user, to send the db to another colleague, or 
>>>>>>> restore an older version through the application.
>>>>>>> That's what I'm dealing with right now, and it fails on me. 
>>>>>>>
>>>>>>> Le jeudi 21 mars 2013 13:49:24 UTC+1, LightDot a écrit :
>>>>>>>>
>>>>>>>> Quite right, restoring from, let's say, native mysql dump to 
>>>>>>>> postgresql would most certainly not work. That's exactly why web2py 
>>>>>>>> uses 
>>>>>>>> csv as the export format.
>>>>>>>>
>>>>>>>> I don't think exporting / importing to csv is really recommended 
>>>>>>>> over using the native export / import functionality of your database 
>>>>>>>> engine 
>>>>>>>> or a specialized backup software (depending on your needs). But it 
>>>>>>>> wo

[web2py] Re: Backup & Restore problems

2013-03-21 Thread dederocks
Yes - unless someone finds a good use for these two functions.
It looks to me that if a record has been removed in a db (e.g. id is not 
continuous: 1, 2, 4, 5 for example), the restore won't work if the table is 
linked to another table. This is I think a sufficiently likely case to 
remove the functions - or am I wrong?

Le jeudi 21 mars 2013 15:42:51 UTC+1, Niphlod a écrit :
>
> so you'd prefer to have it removed alltogether ?
>
> On Thursday, March 21, 2013 3:37:44 PM UTC+1, dederocks wrote:
>>
>> Thanks Ales,
>> Basically, you're confirming the native backup / restore choice. I'm 
>> concerned though that web2py's csv solution is not reliable, and should 
>> therefore be used with high caution -- not to say a word about how slow it 
>> is. It feels sad for me that web2py which other than that an incredible 
>> tool keeps this unpractical feature.
>>
>> Regards, 
>> Andre
>>
>> Le jeudi 21 mars 2013 15:09:23 UTC+1, LightDot a écrit :
>>>
>>> I solved a similar case by writing a function to a) use native postgres 
>>> dump and archive the database and b) present the file to the user for 
>>> download in the administrative back-end. This function is triggered by cron 
>>> in my case, but it could also be executed on demand. For this I would use 
>>> the scheduler and throw in some additional checks so the user doesn't 
>>> trigger the backup too often.
>>>
>>> Hope this helps a bit.
>>>
>>> Regards,
>>> Ales
>>>
>>> On Thursday, March 21, 2013 2:42:51 PM UTC+1, dederocks wrote:
>>>>
>>>> Indeed, or quite close: 
>>>> https://code.google.com/p/web2py/issues/detail?id=1387.
>>>> And to be accurate, I think the issue has more to do with restore than 
>>>> backup.
>>>>
>>>> To build on your comment, there are indeed two ways to deal with backup 
>>>> / restore:
>>>> 1- managed by the database manager using native backup / restore;
>>>> 2- managed by the user, to send the db to another colleague, or restore 
>>>> an older version through the application.
>>>> That's what I'm dealing with right now, and it fails on me. 
>>>>
>>>> Le jeudi 21 mars 2013 13:49:24 UTC+1, LightDot a écrit :
>>>>>
>>>>> Quite right, restoring from, let's say, native mysql dump to 
>>>>> postgresql would most certainly not work. That's exactly why web2py uses 
>>>>> csv as the export format.
>>>>>
>>>>> I don't think exporting / importing to csv is really recommended over 
>>>>> using the native export / import functionality of your database engine or 
>>>>> a 
>>>>> specialized backup software (depending on your needs). But it works and 
>>>>> it 
>>>>> quickly covers the most broad spectrum possible. For anything more 
>>>>> specific 
>>>>> or complex, it's up to the developer to use something else. I don't think 
>>>>> web2py should try to reinvent the wheel here.
>>>>>
>>>>> If export to csv failed in your case, what exactly was the problem? 
>>>>> The referenced thread is from 2011 and seems to be case specific... Are 
>>>>> you 
>>>>> saying you have the same exact error?
>>>>>
>>>>> Regards,
>>>>> Ales
>>>>>
>>>>>
>>>>> On Thursday, March 21, 2013 11:12:57 AM UTC+1, dederocks wrote:
>>>>>>
>>>>>> I'm concerned with the lack of reliability and speed of the 
>>>>>> recommended backup / restore functions: db.export_to_csv_file and 
>>>>>> db.import_from_csv_file.
>>>>>> They failed in my case, and apparently I'm not alone (
>>>>>> https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/reOzXobYNgE
>>>>>> ).
>>>>>> Would it be wise to replace the backup function with something like:
>>>>>> import os
>>>>>> if 'sqlite' in db._uri:
>>>>>> os.system(' '.join(('sqlite3',db.path,'.dump >',targetfile)))
>>>>>> elif 'postgres' in db._uri:
>>>>>> os.system(' '.join(('pg_dump -f',targetfile, dbname)))
>>>>>> elif 'mysql' in db._uri:
>>>>>> os.system(

[web2py] Re: Backup & Restore problems

2013-03-21 Thread dederocks
Thanks Ales,
Basically, you're confirming the native backup / restore choice. I'm 
concerned though that web2py's csv solution is not reliable, and should 
therefore be used with high caution -- not to say a word about how slow it 
is. It feels sad for me that web2py which other than that an incredible 
tool keeps this unpractical feature.

Regards, 
Andre

Le jeudi 21 mars 2013 15:09:23 UTC+1, LightDot a écrit :
>
> I solved a similar case by writing a function to a) use native postgres 
> dump and archive the database and b) present the file to the user for 
> download in the administrative back-end. This function is triggered by cron 
> in my case, but it could also be executed on demand. For this I would use 
> the scheduler and throw in some additional checks so the user doesn't 
> trigger the backup too often.
>
> Hope this helps a bit.
>
> Regards,
> Ales
>
> On Thursday, March 21, 2013 2:42:51 PM UTC+1, dederocks wrote:
>>
>> Indeed, or quite close: 
>> https://code.google.com/p/web2py/issues/detail?id=1387.
>> And to be accurate, I think the issue has more to do with restore than 
>> backup.
>>
>> To build on your comment, there are indeed two ways to deal with backup / 
>> restore:
>> 1- managed by the database manager using native backup / restore;
>> 2- managed by the user, to send the db to another colleague, or restore 
>> an older version through the application.
>> That's what I'm dealing with right now, and it fails on me. 
>>
>> Le jeudi 21 mars 2013 13:49:24 UTC+1, LightDot a écrit :
>>>
>>> Quite right, restoring from, let's say, native mysql dump to postgresql 
>>> would most certainly not work. That's exactly why web2py uses csv as the 
>>> export format.
>>>
>>> I don't think exporting / importing to csv is really recommended over 
>>> using the native export / import functionality of your database engine or a 
>>> specialized backup software (depending on your needs). But it works and it 
>>> quickly covers the most broad spectrum possible. For anything more specific 
>>> or complex, it's up to the developer to use something else. I don't think 
>>> web2py should try to reinvent the wheel here.
>>>
>>> If export to csv failed in your case, what exactly was the problem? The 
>>> referenced thread is from 2011 and seems to be case specific... Are you 
>>> saying you have the same exact error?
>>>
>>> Regards,
>>> Ales
>>>
>>>
>>> On Thursday, March 21, 2013 11:12:57 AM UTC+1, dederocks wrote:
>>>>
>>>> I'm concerned with the lack of reliability and speed of the recommended 
>>>> backup / restore functions: db.export_to_csv_file and 
>>>> db.import_from_csv_file.
>>>> They failed in my case, and apparently I'm not alone (
>>>> https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/reOzXobYNgE
>>>> ).
>>>> Would it be wise to replace the backup function with something like:
>>>> import os
>>>> if 'sqlite' in db._uri:
>>>> os.system(' '.join(('sqlite3',db.path,'.dump >',targetfile)))
>>>> elif 'postgres' in db._uri:
>>>> os.system(' '.join(('pg_dump -f',targetfile, dbname)))
>>>> elif 'mysql' in db._uri:
>>>> os.system(' '.join(('mysqldump -r',targetfile, dbname)))
>>>>
>>>> and similarly the restore function would be:
>>>> import os
>>>> if 'sqlite' in db._uri:
>>>> os.system(' '.join(('sqlite3',db.path,'<',sourcefile)))
>>>> elif 'postgres' in db._uri:
>>>> os.system(' '.join(('pg_restore -d',dbname, sourcefile)))
>>>> elif 'mysql' in db._uri:
>>>> os.system(' '.join(('mysqlimport',dbname, sourcefile)))
>>>>
>>>> Unfortunately I'm not knowlegable enough (yet) about all the various 
>>>> databases supported nor about platform-dependent intricacies, but would 
>>>> this not be a more reliable approach?
>>>> The only major downside is that restoring a db from x (say sqlite) into 
>>>> y (say postgresql) might not be possible, or require some significant edit 
>>>> of the dump file. And to make the restore smoother, you'd have to figure 
>>>> out the source format -- is this possible?
>>>>
>>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: Backup & Restore problems

2013-03-21 Thread dederocks
Indeed, or quite 
close: https://code.google.com/p/web2py/issues/detail?id=1387.
And to be accurate, I think the issue has more to do with restore than 
backup.

To build on your comment, there are indeed two ways to deal with backup / 
restore:
1- managed by the database manager using native backup / restore;
2- managed by the user, to send the db to another colleague, or restore an 
older version through the application.
That's what I'm dealing with right now, and it fails on me. 

Le jeudi 21 mars 2013 13:49:24 UTC+1, LightDot a écrit :
>
> Quite right, restoring from, let's say, native mysql dump to postgresql 
> would most certainly not work. That's exactly why web2py uses csv as the 
> export format.
>
> I don't think exporting / importing to csv is really recommended over 
> using the native export / import functionality of your database engine or a 
> specialized backup software (depending on your needs). But it works and it 
> quickly covers the most broad spectrum possible. For anything more specific 
> or complex, it's up to the developer to use something else. I don't think 
> web2py should try to reinvent the wheel here.
>
> If export to csv failed in your case, what exactly was the problem? The 
> referenced thread is from 2011 and seems to be case specific... Are you 
> saying you have the same exact error?
>
> Regards,
> Ales
>
>
> On Thursday, March 21, 2013 11:12:57 AM UTC+1, dederocks wrote:
>>
>> I'm concerned with the lack of reliability and speed of the recommended 
>> backup / restore functions: db.export_to_csv_file and 
>> db.import_from_csv_file.
>> They failed in my case, and apparently I'm not alone (
>> https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/reOzXobYNgE
>> ).
>> Would it be wise to replace the backup function with something like:
>> import os
>> if 'sqlite' in db._uri:
>> os.system(' '.join(('sqlite3',db.path,'.dump >',targetfile)))
>> elif 'postgres' in db._uri:
>> os.system(' '.join(('pg_dump -f',targetfile, dbname)))
>> elif 'mysql' in db._uri:
>> os.system(' '.join(('mysqldump -r',targetfile, dbname)))
>>
>> and similarly the restore function would be:
>> import os
>> if 'sqlite' in db._uri:
>> os.system(' '.join(('sqlite3',db.path,'<',sourcefile)))
>> elif 'postgres' in db._uri:
>> os.system(' '.join(('pg_restore -d',dbname, sourcefile)))
>> elif 'mysql' in db._uri:
>> os.system(' '.join(('mysqlimport',dbname, sourcefile)))
>>
>> Unfortunately I'm not knowlegable enough (yet) about all the various 
>> databases supported nor about platform-dependent intricacies, but would 
>> this not be a more reliable approach?
>> The only major downside is that restoring a db from x (say sqlite) into y 
>> (say postgresql) might not be possible, or require some significant edit of 
>> the dump file. And to make the restore smoother, you'd have to figure out 
>> the source format -- is this possible?
>>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Backup & Restore problems

2013-03-21 Thread dederocks
I'm concerned with the lack of reliability and speed of the recommended 
backup / restore functions: db.export_to_csv_file and 
db.import_from_csv_file.
They failed in my case, and apparently I'm not alone 
(https://groups.google.com/forum/?fromgroups=#!newtopic/web2py/web2py/reOzXobYNgE).
Would it be wise to replace the backup function with something like:
import os
if 'sqlite' in db._uri:
os.system(' '.join(('sqlite3',db.path,'.dump >',targetfile)))
elif 'postgres' in db._uri:
os.system(' '.join(('pg_dump -f',targetfile, dbname)))
elif 'mysql' in db._uri:
os.system(' '.join(('mysqldump -r',targetfile, dbname)))

and similarly the restore function would be:
import os
if 'sqlite' in db._uri:
os.system(' '.join(('sqlite3',db.path,'<',sourcefile)))
elif 'postgres' in db._uri:
os.system(' '.join(('pg_restore -d',dbname, sourcefile)))
elif 'mysql' in db._uri:
os.system(' '.join(('mysqlimport',dbname, sourcefile)))

Unfortunately I'm not knowlegable enough (yet) about all the various 
databases supported nor about platform-dependent intricacies, but would 
this not be a more reliable approach?
The only major downside is that restoring a db from x (say sqlite) into y 
(say postgresql) might not be possible, or require some significant edit of 
the dump file. And to make the restore smoother, you'd have to figure out 
the source format -- is this possible?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: web2py 2.4.5 is OUT

2013-03-19 Thread dederocks
Is the test result a significant hint that sqlite & mysql are about the 
same, whereas postgresql is about twice as slow?


Le lundi 18 mars 2013 23:53:29 UTC+1, Massimo Di Pierro a écrit :
>
> Passes all tests using travis.ci including python 2.5/2.6/2.7 
> sqlite/mysql/postgres. 
>
> Thanks to Marc who originally pushed for travis.ci integration one year 
> ago and Niphlod for his help in getting this to work, explaining it to me 
> like a three years old (and I needed the explanation), and for fixing all 
> tests!
>
> https://travis-ci.org/web2py/web2py
>
> Massimo
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2013-02-07 Thread dederocks
AWSOME! Thank you so much for the fix and explanation!

Best regards, Andre

Le jeudi 7 février 2013 10:11:19 UTC+1, Roberto De Ioris a écrit :
>
>
> > Hello, 
> > 
> > I have setup nginx & uwsgi on lubuntu with the script and it works great 
> > (best server ever!), except for a part of my application that requires 
> > multi threads. I have changed the /etc/uwsgi/web2py.xml to enable 
> threads, 
> > tried to set each worker with 2 threads, set the thread memory stack to 
> > 512, it doesn't work: I quickly get a 'resource not available (error 
> 11)' 
> > message. 
> > 
> > Anyone has a tip on what I could work on to make this work? Because 
> > otherwise the application works fine with rocket / gevent for example. 
> > 
> > Thanks, 
> > 
> > Andre 
>
>
> If your app is multithreads based you cannot spawn additional processes 
> (they do not share memory). 
>
> Just set processes to 1 and threads to a decent value 
>
>
> -- 
> Roberto De Ioris 
> http://unbit.it 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2013-02-07 Thread dederocks
Hello, 

I have setup nginx & uwsgi on lubuntu with the script and it works great 
(best server ever!), except for a part of my application that requires 
multi threads. I have changed the /etc/uwsgi/web2py.xml to enable threads, 
tried to set each worker with 2 threads, set the thread memory stack to 
512, it doesn't work: I quickly get a 'resource not available (error 11)' 
message.

Anyone has a tip on what I could work on to make this work? Because 
otherwise the application works fine with rocket / gevent for example.

Thanks, 

Andre

Le mercredi 12 décembre 2012 00:06:16 UTC+1, Niphlod a écrit :
>
> I run uwsgi using the emperor mode for some time now based on my 
> config I tried to upgrade the existing one. Result is available at 
> https://www.dropbox.com/s/n7chteos9sh6p2h/setup-web2py-nginx-uwsgi-ubuntu.sh
>
> I'm looking forward to improve things both on uwsgi niceties and general 
> bash customization (the moment I saw fabric  I almost 
> stopped writing bash :-P)
>
> Improvements:
> - no uwsgi from debian packages (overcomplicated configurations). uwsgi is 
> installed from pip (so you can upgrade with a simple pip install --upgrade 
> uwsgi)
> - optional response.static_version friendly static directories 
> configuration (added also cache headers as an option)
> - improved syntax for web2py.xml (no app, no plugin)
> - example of uwsgi cron facility (clean sessions script included)
> - uwsgi emperor mode, managed with Upstart
> - optional upstart pre-script command to fix permissions and compress 
> static files
>
> If interested, I can make a fabfile for that.
>
>  I use Redis as cache but for the "I love embedded" guys 
> uwsgi has a cache framework. I'm accepting votes to make a uwsgi's cache 
> compatible module for web2py, but you will have to test it (no time for 
> that, sorry)
> 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] replace simplejson with ujson?

2013-01-15 Thread dederocks
According to ujson documentation, it is on average twice as fast as 
simplejson. Would it be an option to replace simplejson in web2py with 
ujson?
I read though that Massimo had to extend simplejson to deal with datetime 
values -- I don't know if it's possible to do the same with ujson.

-- 





[web2py] delete query translation

2013-01-14 Thread dederocks
Hello,

How do you translate the following in dal?

delete tableA from tableA where TableA.field1='x'
join TableB on TableB.field2=TableA.field3
WHERE (TableB.field3 = y) ?

if you do db((tableA.field1=='x') & (tableA.field3==TableB.field2) & 
(TableB.field3==y)).delete() it doesn't work -- too many tables selected.
I also tried db(query).delete(join =...), but in this case join is not 
supported. Should it be the way to go?

-- 





Re: [web2py] dashboard using bootstrap

2012-11-30 Thread dederocks
Another one:
http://www.jqplot.com/

Le jeudi 29 novembre 2012 22:52:08 UTC+1, Paolo Caruccio a écrit :
>
> other alternatives:
>
> https://github.com/HumbleSoftware/Flotr2
>
> http://canvasxpress.org/
>
> http://jsxgraph.uni-bayreuth.de/wp/
>
> I like and use, in combination with web2py, Flot 
> http://www.flotcharts.org/
>
>
> Il giorno giovedì 29 novembre 2012 21:19:15 UTC+1, Manuele ha scritto:
>>
>> Il 29/11/12 17:24, Richard V�zina ha scritto: 
>> > http://www.highcharts.com/ 
>> > 
>> > Is pretty nice! 
>> > 
>> > Do you know something similar that is open source? 
>> > 
>> > Richard 
>> At the moment I haven't found nothing enough good... I'll be glad if 
>> someone can notify me :) 
>>
>>  M. 
>>
>

-- 





[web2py] Re: datetime delta with Sqlite - how to?

2012-11-24 Thread dederocks
Hi, 

I've used the following query successfuly:
query = 
(db.mesures.date.epoch()-db.lots.date_fabrication.epoch()) >= 
(critere.valeur_inf*86400)
And then db(query).select(...)

mesures.date and lots.date_fabrication are datetime fields.

Hope this helps!

Le jeudi 22 novembre 2012 21:55:04 UTC+1, dederocks a écrit :
>
> Hi, 
>
> If you have two datetime fields dta and dtb, a db().select(dta-dtb) will 
> return zero using the sqlite db, but a correct value if you use postgresql 
> for example.
> The trick to make it work is to replace dta by julianday(dta) in the 
> select, e.g. db().select(julianday(dta)-julianday(dtb)).
>
> I guess not that easy to fix, especially since this substitution would 
> have to operate only when a datetime delta is computed?
>
> Or is there a way to do it I havent't found?
>
> Andre
>

-- 





[web2py] Re: datetime delta with Sqlite - how to?

2012-11-23 Thread dederocks
Thank you so much -- saved quite a bit of work!
With much appreciation, 
Andre

Le jeudi 22 novembre 2012 23:54:31 UTC+1, Niphlod a écrit :
>
> Mind that the functionality is database dependant, hence you won't get the 
> same results changing the db engine. Moreover you get different "rounding" 
> errors trying to subtract similar dates.
>
> Recent web2py's DAL supports an "epoch()" method that returns "seconds 
> passed since 1-1-1970". If you can live with that, it's more deterministic 
> and safer and works in the same way in all engines (e.g., need to develop 
> on sqlite and in production use postgresql) and its functionality is 
> supported on practically every db.
>
> On Thursday, November 22, 2012 9:55:04 PM UTC+1, dederocks wrote:
>>
>> Hi, 
>>
>> If you have two datetime fields dta and dtb, a db().select(dta-dtb) will 
>> return zero using the sqlite db, but a correct value if you use postgresql 
>> for example.
>> The trick to make it work is to replace dta by julianday(dta) in the 
>> select, e.g. db().select(julianday(dta)-julianday(dtb)).
>>
>> I guess not that easy to fix, especially since this substitution would 
>> have to operate only when a datetime delta is computed?
>>
>> Or is there a way to do it I havent't found?
>>
>> Andre
>>
>

-- 





[web2py] datetime delta with Sqlite - how to?

2012-11-22 Thread dederocks
Hi, 

If you have two datetime fields dta and dtb, a db().select(dta-dtb) will 
return zero using the sqlite db, but a correct value if you use postgresql 
for example.
The trick to make it work is to replace dta by julianday(dta) in the 
select, e.g. db().select(julianday(dta)-julianday(dtb)).

I guess not that easy to fix, especially since this substitution would have 
to operate only when a datetime delta is computed?

Or is there a way to do it I havent't found?

Andre

-- 





Re: [web2py] Re: Implementing tornado chat server with web2py

2012-11-19 Thread dederocks
Regarding the error 426 mentionned, I don't know if you tried to use 
chromium instead of chrome. At least I has the 426 error in chromium, but 
NOT with chrome. Hope this helps.

Le jeudi 19 janvier 2012 17:23:53 UTC+1, Phyo Arkar a écrit :
>
> Websocket is not ready , it is just a draft protocol. i wont recommend any 
> serious use on it.
>
> On Wed, Jan 18, 2012 at 6:57 AM, Abhishek Gupta 
> 
> > wrote:
>
>> I implemented a similar solution, but the user keeps on getting 
>> disconnected from the tornado server. This happens frequently with chrome. 
>> Any guesses, so as why the user is being disconnected so often (in every 
>> 4-5 secs).
>
>
>

-- 





[web2py] Validator on a db subset -- how to?

2012-11-13 Thread dederocks
Say I have the following tables:

db.define_table('person', Field('name', unique=True))
db.define_table('dog', Field('name'), Field('owner', db.person)

Now on the dog table, I want to add a validator to ensure that all the dogs 
that belong to one person have a unique name. In other words, if Bill has the 
dogs Alissa, Muff and Ouahoo, and John has the dogs Muff, Ouahoo and Gisbi it's 
OK, but not if John has the dogs Muff, Ouahoo and Muff. How can I define a 
validator to do that?

-- 





[web2py] Re: json formatting of a select with grouping

2012-11-12 Thread dederocks
Update: this works however if I don't delete the _extra field, but then 
newName is not available!

Le lundi 12 novembre 2012 09:24:12 UTC+1, dederocks a écrit :
>
> NB : however, the standard function doesn' work anymore (e.g. without the 
> '.json' extension). I get a invalid function (default/handle_error). Why?
> Le lundi 12 novembre 2012 09:19:50 UTC+1, dederocks a écrit :
>>
>> This is great, thank you! And I don't know why but this is great too, the 
>> update applies *directly* to the data object (I therefore don't have to 
>> create a new one).
>>
>> Le jeudi 8 novembre 2012 19:27:29 UTC+1, Massimo Di Pierro a écrit :
>>>
>>> You can try this. Yet I found some problem as data.json() does not 
>>> behave well as json(data) while they should be the same.
>>>
>>> from gluon.serializers import json
>>>
>>> db =DAL()
>>> db.define_table('test',Field('name'),Field('firstname'))
>>> db.test.insert(name='Test',firstname='Test')
>>> count = db.test.id.count()
>>> data = db().select(db.test.ALL,
>>>count,
>>>    groupby=db.test.id,
>>>orderby=db.test.name)
>>> for row in data:
>>> row.test.newName = row(count)
>>> del row._extra
>>> print row
>>>
>>> print json(data)
>>>
>>> On Thursday, 8 November 2012 11:24:14 UTC-6, dederocks wrote:
>>>>
>>>> Hello, 
>>>>
>>>> If I define a table with
>>>> define_table('test',Field('name'),Field('firstname'))
>>>>
>>>> Then in the controller, I have:
>>>> count = db.test.id.count()
>>>> data = db().select(db.test.ALL,
>>>>count.with_alias('newName'),
>>>>groupby=db.test.id,
>>>>orderby=db.test.name)
>>>>
>>>> In the view displaying data as json (view.jason) I get:
>>>>
>>>> {"data": [{"test": {"name": "UserName", "firstname": "FirstName"}, 
>>>> "newName": 1, "_extra": {"COUNT(test.id) AS newName": 1}}, ...
>>>>
>>>> Which I thought was not correct, but Massimo said this is the intended 
>>>> behaviour as 'count' does not belong necessarily to a table.
>>>>
>>>> So can someone help me and give me a hint on how I could format the 
>>>> json output like:
>>>>
>>>> {"data": [{"test": {"name": "UserName", "firstname": "FirstName", 
>>>> "newName": 1}, ... ?
>>>>
>>>> Thanks in advance for your feedback!
>>>> Andre
>>>>
>>>

-- 





[web2py] Re: json formatting of a select with grouping

2012-11-12 Thread dederocks
NB : however, the standard function doesn' work anymore (e.g. without the 
'.json' extension). I get a invalid function (default/handle_error). Why?
Le lundi 12 novembre 2012 09:19:50 UTC+1, dederocks a écrit :
>
> This is great, thank you! And I don't know why but this is great too, the 
> update applies *directly* to the data object (I therefore don't have to 
> create a new one).
>
> Le jeudi 8 novembre 2012 19:27:29 UTC+1, Massimo Di Pierro a écrit :
>>
>> You can try this. Yet I found some problem as data.json() does not behave 
>> well as json(data) while they should be the same.
>>
>> from gluon.serializers import json
>>
>> db =DAL()
>> db.define_table('test',Field('name'),Field('firstname'))
>> db.test.insert(name='Test',firstname='Test')
>> count = db.test.id.count()
>> data = db().select(db.test.ALL,
>>count,
>>groupby=db.test.id,
>>orderby=db.test.name)
>> for row in data:
>> row.test.newName = row(count)
>> del row._extra
>> print row
>>
>> print json(data)
>>
>> On Thursday, 8 November 2012 11:24:14 UTC-6, dederocks wrote:
>>>
>>> Hello, 
>>>
>>> If I define a table with
>>> define_table('test',Field('name'),Field('firstname'))
>>>
>>> Then in the controller, I have:
>>> count = db.test.id.count()
>>> data = db().select(db.test.ALL,
>>>count.with_alias('newName'),
>>>groupby=db.test.id,
>>>orderby=db.test.name)
>>>
>>> In the view displaying data as json (view.jason) I get:
>>>
>>> {"data": [{"test": {"name": "UserName", "firstname": "FirstName"}, 
>>> "newName": 1, "_extra": {"COUNT(test.id) AS newName": 1}}, ...
>>>
>>> Which I thought was not correct, but Massimo said this is the intended 
>>> behaviour as 'count' does not belong necessarily to a table.
>>>
>>> So can someone help me and give me a hint on how I could format the json 
>>> output like:
>>>
>>> {"data": [{"test": {"name": "UserName", "firstname": "FirstName", 
>>> "newName": 1}, ... ?
>>>
>>> Thanks in advance for your feedback!
>>> Andre
>>>
>>

-- 





[web2py] Re: json formatting of a select with grouping

2012-11-12 Thread dederocks
This is great, thank you! And I don't know why but this is great too, the 
update applies *directly* to the data object (I therefore don't have to 
create a new one).

Le jeudi 8 novembre 2012 19:27:29 UTC+1, Massimo Di Pierro a écrit :
>
> You can try this. Yet I found some problem as data.json() does not behave 
> well as json(data) while they should be the same.
>
> from gluon.serializers import json
>
> db =DAL()
> db.define_table('test',Field('name'),Field('firstname'))
> db.test.insert(name='Test',firstname='Test')
> count = db.test.id.count()
> data = db().select(db.test.ALL,
>count,
>groupby=db.test.id,
>orderby=db.test.name)
> for row in data:
> row.test.newName = row(count)
> del row._extra
> print row
>
> print json(data)
>
> On Thursday, 8 November 2012 11:24:14 UTC-6, dederocks wrote:
>>
>> Hello, 
>>
>> If I define a table with
>> define_table('test',Field('name'),Field('firstname'))
>>
>> Then in the controller, I have:
>> count = db.test.id.count()
>> data = db().select(db.test.ALL,
>>count.with_alias('newName'),
>>groupby=db.test.id,
>>orderby=db.test.name)
>>
>> In the view displaying data as json (view.jason) I get:
>>
>> {"data": [{"test": {"name": "UserName", "firstname": "FirstName"}, 
>> "newName": 1, "_extra": {"COUNT(test.id) AS newName": 1}}, ...
>>
>> Which I thought was not correct, but Massimo said this is the intended 
>> behaviour as 'count' does not belong necessarily to a table.
>>
>> So can someone help me and give me a hint on how I could format the json 
>> output like:
>>
>> {"data": [{"test": {"name": "UserName", "firstname": "FirstName", 
>> "newName": 1}, ... ?
>>
>> Thanks in advance for your feedback!
>> Andre
>>
>

-- 





[web2py] json formatting of a select with grouping

2012-11-08 Thread dederocks
Hello, 

If I define a table with
define_table('test',Field('name'),Field('firstname'))

Then in the controller, I have:
count = db.test.id.count()
data = db().select(db.test.ALL,
   count.with_alias('newName'),
   groupby=db.test.id,
   orderby=db.test.name)

In the view displaying data as json (view.jason) I get:

{"data": [{"test": {"name": "UserName", "firstname": "FirstName"}, 
"newName": 1, "_extra": {"COUNT(test.id) AS newName": 1}}, ...

Which I thought was not correct, but Massimo said this is the intended 
behaviour as 'count' does not belong necessarily to a table.

So can someone help me and give me a hint on how I could format the json 
output like:

{"data": [{"test": {"name": "UserName", "firstname": "FirstName", 
"newName": 1}, ... ?

Thanks in advance for your feedback!
Andre

-- 





[web2py] sym link for an application - is it possible?

2012-11-06 Thread dederocks
I'd like to have an application folder on dropbox, so I've replaced the 
application folder with a link on the folder in dropbox -- but it doesn't 
work. The problem is not dropbox related I think -- it's more an issue of 
the shortcut link in windows. Any workaround?

-- 





[web2py] Typo in the online book

2012-11-05 Thread dederocks
I think there is a typo at 
http://www.web2py.com/books/default/chapter/29/06#count,-isempty,-delete,-update
 :

Just before the next section,

"except that it calls the validators for the fields before performing the 
update. Notice that it only works if query involves a single table. The 
number of updated records can be found in re*t*.updated and errors will be 
ret.errors."

-- 





[web2py] Re: Trunk version: admin not working

2012-07-16 Thread dederocks
Thanks for the feedback. My mistake -- access rights were missing. Sorry 
for the noise.
André

Le lundi 16 juillet 2012 09:16:46 UTC+2, dederocks a écrit :
>
> Hello, 
>
> The trunk version does not allow access to the admin interface (ticket 
> issued). Is it me only?
>
> Andre
>


[web2py] Trunk version: admin not working

2012-07-16 Thread dederocks
Hello, 

The trunk version does not allow access to the admin interface (ticket 
issued). Is it me only?

Andre


[web2py] Re: new feature in trunk...

2012-02-22 Thread dederocks
It's great -- but doesn't work for folders named with a spacebar, such as 
'My documents'. Is there an easy fix for this?



[web2py] Re : Introducing Grafpad!

2011-07-27 Thread dederocks
Hi Charles, 

Great application!
Some bugs, though -- or I haven't understood how to use Grafpad properly:
- Using FF, I tried to fill a form with color -- but it doesn't work. Right 
click on the form, select properties & choose a color -- nothing happens.
- Also, I can't send you a feedback! Is it because I used it in demo mode?

Thanks again, 

Andre


[web2py] Re: Restriction Fields

2011-03-30 Thread dederocks
Hi!

See:
http://groups.google.com/group/web2py/browse_thread/thread/4eebaf795d43e171/7ba6a2e79e1db2bf?lnk=gst&q=composite+key#7ba6a2e79e1db2bf

On 29 mar, 19:12, luifran  wrote:
> I have not explained very well, I will not prevent the value of a and
> b are equal, I want to avoid the insertion of identical records, for
> example:
> Record 1 -> a: 4 b: 5
> Record 2 -> a: 4 b: 5
>
> This is what I want to avoid
> Sorry for my words, I'm Spanish, not fluent in English.
>
> On 28 mar, 20:40, luifran  wrote:
>
> > Thanks, I'll try that way
>
> > On Mar 28, 8:59 am, Massimo Di Pierro 
> > wrote:
>
> > > db.define_table ('t', Field ('a'), Field ('b',requires=IS_EXPR('value!=
> > > %s'% repr(request.vars.a)))
>
> > > On Mar 28, 10:37 am, luifran  wrote:
>
> > > > I have the following table, for example:
> > > > db.define_table ('t', Field ('a '), Field ('b'))
> > > > I want to impose the following restriction, to avoid insertion of
> > > > duplicate records
> > > > not allow insertion of a pair of identical values (a y b)​​.
> > > > How I can do this?, I know how to restrict a single field, but not
> > > > both at once.
>
>


[web2py] Re: Need help setting up a composite key

2011-02-07 Thread dederocks
Hi!
Check this thread:
http://groups.google.com/group/web2py/browse_thread/thread/caaf68de3fbc0baf/b9812b04ac70ba8b?lnk=gst&q=Multiple+constraint#b9812b04ac70ba8b

In summary, you want to create a computed combined field, and require
that it is unique. A bit odd, but that's what you need to be able to
have validators working at the DAL level. Otherwise, you can of course
add SQL-level combined indexes (but specific to the database
selected), which if not respected will generate an error instead of a
friendly validator message.
BR, Andre

On 7 fév, 08:43, Mark Hayes  wrote:
> I'm new to web2py and can't seem to find out how to create a composite
> key.  Specifically I'm trying to create the following tables:
>
> db.define_table('volunteer',
>     Field('first_name', 'string', length=30, notnull=True),
>     Field('last_name', 'string', length=30, notnull=True),
>     Field('birthday', 'date', required=True),
>     Field('email', 'string', length=30))
> db.define_table('opportunity',
>     Field('name', 'string', length=30, notnull=True))
> db.define_table('interest',
>     Field('volunteer', db.volunteer),
>     Field('opportunity', db.opportunity))
>
> In the 'interest' table I want to ensure that the combination of both
> volunteer + opportunity is unique.  What is the best way to go about
> doing this?  Any help would be greatly appreciated, thanks!


[web2py] Re: order by surname, name

2011-02-03 Thread dederocks
Hi Johann,

Just use "|":
orderby=db.table.name|db.table.surname

On 3 fév, 13:56, Johann Spies  wrote:
> According to the book the syntax to create an  'order by'  query is
> db(query).select(ALL,orderby=field).
>
> What if I want to use more than one field in the 'order by' ?
>
> Regards
> Johann
>
> --
>  May grace and peace be yours in abundance through the full knowledge of God
> and of Jesus our Lord!  His divine power has given us everything we need for
> life and godliness through the full knowledge of the one who called us by
> his own glory and excellence.
>                                                     2 Pet. 1:2b,3a


[web2py] Re: Dynamic Defaults, if that makes any sences...

2011-01-18 Thread dederocks
If I'm not off track, something like:

session.conference_id = form.vars.[fieldx] ?

Or the other way around, but then you need to use SQLFORM.factory, I
guess, and handle yourself the db insertion/update (see example in the
book §7.3, or better this link: 
http://groups.google.com/group/web2py/browse_thread/thread/cb560f5fddec2d07

On 18 jan, 19:50, Jason Brower  wrote:
> I am not so great with forms, but how do I set a particular value when
> they have completed the form...
>
> 
> #MODEL
> db.define_table('page',
>          Field('page_name', 'string'),
>          Field('url_name', 'string'),#Basically it takes the page name and 
> replaces spaces with _
>          Field('conference_id', 'integer'),
>          Field('contents', 'text'),
>          Field('creator', 'integer')
>          )
> #CONTROLLER
> page_form = SQLFORM(db.page)
> 
>
> And I want to set a field that is hidden in this form to
> session.conference_id.
> 
> Best Regards,
> Jason Brower


[web2py] Re: query for an empty field

2011-01-13 Thread dederocks
Indeed! Thanks for filling my brain holes.

On 13 jan, 12:21, Kenneth Lundström 
wrote:
> == None
> == ''
>
> If I understood your question.
>
> Kenneth
>
> > How do you search for records where a field is empty? I can't find the
> > operator for this.
>
>


[web2py] query for an empty field

2011-01-13 Thread dederocks
How do you search for records where a field is empty? I can't find the
operator for this.


[web2py] Re: How to rename a FORM submit button?

2011-01-12 Thread dederocks
Awsome, thank you!

On 13 jan, 01:59, Bruno Rocha  wrote:
> FORM(INPUT(_type='submit',_value='Click here'))
>
> 2011/1/12 dederocks 
>
> > If you have
> > FORM(INPUT(_type='submit'))
> > just to display a button, is it possible to change the button label
> > value?
>
>


[web2py] How to rename a FORM submit button?

2011-01-12 Thread dederocks
If you have
FORM(INPUT(_type='submit'))
just to display a button, is it possible to change the button label
value?


[web2py] Re: list:reference update

2011-01-12 Thread dederocks
Great, thank you!

On 12 jan, 23:03, Massimo Di Pierro 
wrote:
> The update should be
>
> db(db.groupe.id==1).update(groupusers=[1,2])
>
> or one of the following
>
> db.groupe[1].update_record(groupusers=[1,2])
> db.groupe(1).update_record(groupusers=[1,2])
> db.groupe(id=1).update_record(groupusers=[1,2])
> db.groupe(db.groupe.id==1).update_record(groupusers=[1,2])
>
> but NOT
>
> db.groupe(db.groupe.id==1).update(groupusers=[1,2])
>
> On Jan 12, 3:22 pm, dederocks  wrote:
>
> > I'm trying to update a 'list:reference' field programaticaly, but this
> > doesn't work so far.
>
> > Say I have this model:
>
> > db.define_table('person', Field('name'))
> > db.define_table('groupe',Field('groupname'), Field('groupusers',
> > 'list:reference person'))
>
> > assume I have already entered three persons, with ids 1,2,3 and, also
> > defined a group with id=1
>
> > Then
> > db.groupe(db.groupe.id==1).update(groupusers=[1,2])
>
> > doesn't change the record. Does someone see what I'm doing wrong?
>
> > Thanks in advance for any cue on this.
>
> > Andre
>
>


[web2py] Re: Trunk hangs at startup

2011-01-12 Thread dederocks
It must be one of the updates done within the last six hours, I would
say.

On 12 jan, 23:00, Massimo Di Pierro 
wrote:
> Any way you can tell which revision causes the problem?
>
> On Jan 12, 2:50 pm, dederocks  wrote:
>
> > And restarting the computer didn't solve the issue!
>
> > On 12 jan, 21:40, dederocks  wrote:
>
> > > Stopping doesn't work either -- need to kill the app.
>
> > > On 12 jan, 21:35, dederocks  wrote:
>
> > > > Running the latest trunk on Win7, FF, web2py hangs after starting the
> > > > server ('waiting for 127.0.0.1...'), but appears to work otherwise:
> > > > e.g. if I specify the url of an application, it works.
> > > > Admin works as well.
> > > > Hope this helps.
>
>


[web2py] Re: list:reference update

2011-01-12 Thread dederocks
Hi Kenneth,

Thanks a lot for getting back.
Actualy, to my understanding, the 'list:reference' provides a way to
bypass the third table, and most importantly the joins that don't work
on GAE. A list of records is represented as a string with the ids
separated by '¦'. E.g. in my example, the groupusers should have been
'1¦2' (or '¦1¦2¦', I'm not sure).

That said, the update issue remains -- or do you have a hint?

BR, Andre

On 12 jan, 22:35, Kenneth Lundström 
wrote:
> I might be completly wrong but shouldn t it be like this:
>
> db.define_table('person', Field('name'), Field('groupe',
> 'list:reference groupe'))
> db.define_table('groupe',Field('groupname'))
>
> db.groupe(db.person.id<3).update(groupe=1)
>
> If one users can be in many groups you get a many-to-many relationship
> and you need a third table to now to what group a user belongs.
>
> Kenneth
>
> > I'm trying to update a 'list:reference' field programaticaly, but this
> > doesn't work so far.
>
> > Say I have this model:
>
> > db.define_table('person', Field('name'))
> > db.define_table('groupe',Field('groupname'), Field('groupusers',
> > 'list:reference person'))
>
> > assume I have already entered three persons, with ids 1,2,3 and, also
> > defined a group with id=1
>
> > Then
> > db.groupe(db.groupe.id==1).update(groupusers=[1,2])
>
> > doesn't change the record. Does someone see what I'm doing wrong?
>
> > Thanks in advance for any cue on this.
>
> > Andre
>
>


[web2py] list:reference update

2011-01-12 Thread dederocks
I'm trying to update a 'list:reference' field programaticaly, but this
doesn't work so far.

Say I have this model:

db.define_table('person', Field('name'))
db.define_table('groupe',Field('groupname'), Field('groupusers',
'list:reference person'))

assume I have already entered three persons, with ids 1,2,3 and, also
defined a group with id=1

Then
db.groupe(db.groupe.id==1).update(groupusers=[1,2])

doesn't change the record. Does someone see what I'm doing wrong?

Thanks in advance for any cue on this.

Andre


[web2py] Re: Trunk hangs at startup

2011-01-12 Thread dederocks
And restarting the computer didn't solve the issue!

On 12 jan, 21:40, dederocks  wrote:
> Stopping doesn't work either -- need to kill the app.
>
> On 12 jan, 21:35, dederocks  wrote:
>
> > Running the latest trunk on Win7, FF, web2py hangs after starting the
> > server ('waiting for 127.0.0.1...'), but appears to work otherwise:
> > e.g. if I specify the url of an application, it works.
> > Admin works as well.
> > Hope this helps.
>
>


[web2py] Re: Trunk hangs at startup

2011-01-12 Thread dederocks
Stopping doesn't work either -- need to kill the app.

On 12 jan, 21:35, dederocks  wrote:
> Running the latest trunk on Win7, FF, web2py hangs after starting the
> server ('waiting for 127.0.0.1...'), but appears to work otherwise:
> e.g. if I specify the url of an application, it works.
> Admin works as well.
> Hope this helps.


[web2py] Trunk hangs at startup

2011-01-12 Thread dederocks
Running the latest trunk on Win7, FF, web2py hangs after starting the
server ('waiting for 127.0.0.1...'), but appears to work otherwise:
e.g. if I specify the url of an application, it works.
Admin works as well.
Hope this helps.



[web2py] recursive select bug

2011-01-12 Thread dederocks
I've tried to run the following example, a copy-paste from the book.
What am I doing wrong?

my model:

db.define_table('person', Field('name'))

db.define_table('dog', Field('name'), Field('owner',db.person))

in the shell:
web2py Shell Version 1.91.6 (2011-01-10 20:54:45)
In [1] : db.person.insert(name='Alex')
1

In [2] : db.person.insert(name='Bill')
2

In [3] : db.dog.insert(name='medor',owner=1)
1

In [4] : dogs = db(db.dog.id>0).select()

In [5] : for dog in dogs: print dog.name, dog.owner.name
Traceback (most recent call last):
  File "C:\Users\Andre\Documents\web2py\gluon\contrib\shell.py", line
225, in run
exec compiled in statement_module.__dict__
  File "", line 1, in 
AttributeError: 'dict' object has no attribute 'name'


[web2py] Re: unique constraint of multiple columns (at database level)

2011-01-11 Thread dederocks
Thanks!
I was actualy missing the 'unique=True' (IS_NOT_IN_DB(...) doesn't
work), and then I'll need to add a 'try.. except' sequence to trap an
attempt to insert a duplicate.

On 11 jan, 10:32, Manuele Pesenti  wrote:
> Il 11/01/2011 10:05, dederocks ha scritto:> Manuele,
>
> > May I ask you how you did it?
>
> First of all consider to define a function that returns auniqueresult
> starting from your fields in the uniques list. If theese fields are all
> integer (such as id of external references) you can simply append them
> in a string following always the same order or if they are string you
> car create a dictionary with the field names and values and transform it
> in a string that will beunique. Let's call it getUnique().
>
> def getUnique(**kwargs):
>      ...
>      return out
>
> now add this 'myid' field to your table as in the example below:
>
> db.define_table('mytable',
>      Field('field1', ...),
>      Field('field2', ...),
>      ...
>      Field('myid', length=256,unique=True,
>          compute=lambda r: getUnique(
>              **dict([(x, r[x]) for x in (field2, field3, ..., )])
>          )
>
> I hope I've been clear
>
> bye
>      Manuele


[web2py] Re: unique constraint of multiple columns (at database level)

2011-01-11 Thread dederocks
Manuele,

May I ask you how you did it?
This is my model:
db.define_table('Materiau',
Field('mindex','string', compute=lambda r: '%s%s' %
(r.Nom,r.MType)),
Field('MType', label='Type'),
Field('Nom'),
format='%(MType)s %(Nom)s')
db.Materiau.MType.requires=IS_IN_SET(('Tête','Armoire','Chassis'))
db.Materiau.mindex.requires=IS_NOT_IN_DB(db, db.Materiau.mindex)

Well, If I try to insert a duplicate with the appadmin insert form, it
goes through without rejection.
Or do I expect too much from the admin insert form?

On 5 jan, 12:26, Manuele Pesenti  wrote:
> I beg your pardon... it works!
> the problem was that I used 'unique' as the field name that is a not
> valid name :)
>
> so it coud be a solution to manage uniques
>
> bye
>      M.
>
> Il 05/01/2011 12:04, Manuele Pesenti ha scritto:
>
> > Trying quite the same solution I got a different error:
>
> > [omissis]
>
> > I used a string field as theuniquekey and the function called by
> > lambda returns a string.
>
> >     Manuele
>
>


[web2py] Re: list:reference problem?

2011-01-06 Thread dederocks
To follow-up, switching from Sqlite to Postgresql gets this similar
error, which I believe comes from dal (MATERIAU should be without
"()"):

Traceback (most recent call last):
  File "C:\Users\Andre\Documents\web2py\gluon\restricted.py", line
188, in restricted
exec ccode in environment
  File "C:/Users/Andre/Documents/web2py/applications/soltrans/
controllers/default.py", line 89, in 
  File "C:\Users\Andre\Documents\web2py\gluon\globals.py", line 95, in

self._caller = lambda f: f()
  File "C:\Users\Andre\Documents\web2py\gluon\tools.py", line 2332, in
f
return action(*a, **b)
  File "C:/Users/Andre/Documents/web2py/applications/soltrans/
controllers/default.py", line 75, in ntransport
id = db.Materiau.insert(**db.Materiau._filter_fields(form.vars))
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 3885, in
insert
return self._db._adapter.insert(self,self._listify(fields))
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 704, in
insert
raise e
ProgrammingError: ERREUR:  erreur de syntaxe sur ou près de « ) »
LINE 1: INSERT INTO Materiau() VALUES ();


On 6 jan, 16:56, dederocks  wrote:
> I have a field with the 'list:reference xxx' type. Using it gets the
> following error (I think):
>
> Traceback (most recent call last):
>   File "C:\Users\Andre\Documents\web2py\gluon\restricted.py", line
> 188, in restricted
>     exec ccode in environment
>   File "C:/Users/Andre/Documents/web2py/applications/soltrans/
> controllers/default.py", line 89, in 
>   File "C:\Users\Andre\Documents\web2py\gluon\globals.py", line 95, in
> 
>     self._caller = lambda f: f()
>   File "C:\Users\Andre\Documents\web2py\gluon\tools.py", line 2332, in
> f
>     return action(*a, **b)
>   File "C:/Users/Andre/Documents/web2py/applications/soltrans/
> controllers/default.py", line 75, in ntransport
>     id = db.Materiau.insert(**db.Materiau._filter_fields(form.vars))
>   File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 3885, in
> insert
>     return self._db._adapter.insert(self,self._listify(fields))
>   File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 704, in
> insert
>     raise e
> OperationalError: near ")": syntax error
>
> And in the form generated by SQLFORM, it is possible to select
> multiple entries: is this expected?
>
> For information, here is the DB model:
>
> db.define_table('Lieu',Field('Nom', label="Lieu de stockage",
> requires=IS_NOT_EMPTY()), format='%(Nom)s')
>
> db.define_table('Materiau',Field('Type','list:string'),Field('Nom'))
> db.Materiau.Type.requires=IS_IN_SET(('Tête','Armoire','Chassis'))
>
> db.define_table('Transport',
>     Field('Date','datetime', default=request.now, readable=False,
> writable=False),
>     Field('Transporteur', db.auth_user, default=auth.user_id,
> readable=False, writable=False),
>     Field('Objet',db.Materiau),
>     Field('DateChargement','datetime', default=request.now,
> label='Date de prise en charge'),
>     Field('Source','list:reference Lieu', label='Lieu de prise en
> charge'),
>     Field('Destination','list:reference Lieu', label='Lieu de
> livraison'),
>     Field('DateLivraison','datetime', label='Date de livraison'),)
>
> Best regards,
>
> Andre


[web2py] list:reference problem?

2011-01-06 Thread dederocks
I have a field with the 'list:reference xxx' type. Using it gets the
following error (I think):

Traceback (most recent call last):
  File "C:\Users\Andre\Documents\web2py\gluon\restricted.py", line
188, in restricted
exec ccode in environment
  File "C:/Users/Andre/Documents/web2py/applications/soltrans/
controllers/default.py", line 89, in 
  File "C:\Users\Andre\Documents\web2py\gluon\globals.py", line 95, in

self._caller = lambda f: f()
  File "C:\Users\Andre\Documents\web2py\gluon\tools.py", line 2332, in
f
return action(*a, **b)
  File "C:/Users/Andre/Documents/web2py/applications/soltrans/
controllers/default.py", line 75, in ntransport
id = db.Materiau.insert(**db.Materiau._filter_fields(form.vars))
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 3885, in
insert
return self._db._adapter.insert(self,self._listify(fields))
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 704, in
insert
raise e
OperationalError: near ")": syntax error

And in the form generated by SQLFORM, it is possible to select
multiple entries: is this expected?

For information, here is the DB model:

db.define_table('Lieu',Field('Nom', label="Lieu de stockage",
requires=IS_NOT_EMPTY()), format='%(Nom)s')

db.define_table('Materiau',Field('Type','list:string'),Field('Nom'))
db.Materiau.Type.requires=IS_IN_SET(('Tête','Armoire','Chassis'))

db.define_table('Transport',
Field('Date','datetime', default=request.now, readable=False,
writable=False),
Field('Transporteur', db.auth_user, default=auth.user_id,
readable=False, writable=False),
Field('Objet',db.Materiau),
Field('DateChargement','datetime', default=request.now,
label='Date de prise en charge'),
Field('Source','list:reference Lieu', label='Lieu de prise en
charge'),
Field('Destination','list:reference Lieu', label='Lieu de
livraison'),
Field('DateLivraison','datetime', label='Date de livraison'),)

Best regards,

Andre


[web2py] Re: couchdb sample: AttributeError: 'Server' object has no attribute 'commit'

2011-01-06 Thread dederocks
Works now -- thank you!

On 6 jan, 14:21, Massimo Di Pierro  wrote:
> ?
>
> this line should not be in trunk:
> r = self.represent_exceptions(self,obj,fieldtype)
> it is
>
> r = self.represent_exceptions(obj,fieldtype)
>
> Massimo
>
> On Jan 6, 1:23 am, David Marko  wrote:
>
> > I have the same problem here.
>
> > Whats more with latest trunk I cant 
> > openhttp://127.0.0.1:8000/welcome/default/index. It raises:
>
> > Traceback (most recent call last):
> >   File "c:\java\web2py\gluon\restricted.py", line 188, in restricted
> >     exec ccode in environment
> >   File "c:/java/web2py/applications/welcome/models/db.py" 
> > , line 42, 
> > in 
> >     auth.define_tables()                           # creates all needed 
> > tables
> >   File "c:\java\web2py\gluon\tools.py", line 1173, in define_tables
> >     format='%(first_name)s %(last_name)s (%(id)s)')
> >   File "c:\java\web2py\gluon\dal.py", line 3431, in define_table
> >     polymodel=polymodel)
> >   File "c:\java\web2py\gluon\dal.py", line 468, in create_table
> >     not_null = self.NOT_NULL(field.default,field.type)
> >   File "c:\java\web2py\gluon\dal.py", line 665, in NOT_NULL
> >     return 'NOT NULL DEFAULT %s' % self.represent(default,field_type)
> >   File "c:\java\web2py\gluon\dal.py", line 1087, in represent
> >     r = self.represent_exceptions(self,obj,fieldtype)
> > TypeError: represent_exceptions() takes exactly 3 arguments (4 given)
>
>


[web2py] Bug with last trunk update

2011-01-06 Thread dederocks
Hello,

Since the last trunk update(s? -- less than 24 hours), I get the
following problem:

Traceback (most recent call last):
  File "C:\Users\Andre\Documents\web2py\gluon\restricted.py", line
188, in restricted
exec ccode in environment
  File "C:/Users/Andre/Documents/web2py/applications/soltrans/models/
db.py", line 41, in 
auth.define_tables(username=True)  # creates all
needed tables
  File "C:\Users\Andre\Documents\web2py\gluon\tools.py", line 1151, in
define_tables
format='%(username)s')
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 3431, in
define_table
polymodel=polymodel)
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 468, in
create_table
not_null = self.NOT_NULL(field.default,field.type)
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 665, in
NOT_NULL
return 'NOT NULL DEFAULT %s' % self.represent(default,field_type)
  File "C:\Users\Andre\Documents\web2py\gluon\dal.py", line 1087, in
represent
r = self.represent_exceptions(self,obj,fieldtype)
TypeError: represent_exceptions() takes exactly 3 arguments (4 given)

Python 2.7 win 7.

BR, Andre


[web2py] Re: Change Favicon css

2011-01-05 Thread dederocks
Thanks! BTW, the favicon (favicon.ico) shows up well in Chrome & IE,
but not with FF!

On 5 jan, 11:53, rochacbruno  wrote:
> This is not in base.css this is defined in views/layout.html
>
> Enviado via iPhone
>
> Em 05/01/2011, às 08:36, dederocks  escreveu:
>
> > Hello,
>
> > Sorry for this probably very beginner question -- how & where can you
> > change the layout for the favicon (e.g. favicon.png in the
> > application's static folder) that shows up on the top left of the
> > example application for example? My knowledge in css is limited, but
> > in any case I can't find in base.css where apple-touch-icon specifics
> > for example are defined.
> > Thanks in advance for a cue on this.
> > BR, Andre
>
>


[web2py] Change Favicon css

2011-01-05 Thread dederocks
Hello,

Sorry for this probably very beginner question -- how & where can you
change the layout for the favicon (e.g. favicon.png in the
application's static folder) that shows up on the top left of the
example application for example? My knowledge in css is limited, but
in any case I can't find in base.css where apple-touch-icon specifics
for example are defined.
Thanks in advance for a cue on this.
BR, Andre


[web2py] Re: Built-in editor quirk

2011-01-04 Thread dederocks
Thanks for the cue -- indeed, no problem with Chrome for example. I
use FF 3.6.13 on Win7.

On 4 jan, 12:51, mdipierro  wrote:
> Which browser? The browser is the issue.
>
> On Jan 4, 1:49 am, dederocks  wrote:
>
> > Hello,
> > There's been a weird bug in the built-in editor for some time now:
> > when you highlight a line, the highlight actually shows up two lines
> > above the selection. Any way to fix this?
>
> > Python 2.7, Windows 7, trunk version.
>
> > Thanks & BR, Andre
>
>


[web2py] Built-in editor quirk

2011-01-03 Thread dederocks
Hello,
There's been a weird bug in the built-in editor for some time now:
when you highlight a line, the highlight actually shows up two lines
above the selection. Any way to fix this?

Python 2.7, Windows 7, trunk version.

Thanks & BR, Andre


[web2py] Bug report

2010-12-13 Thread dederocks
Hello,

When shutting down Web2py (trunk version on windows 7, python 2.7), I
get the following error:

starting browser...
Unhandled exception in thread started by >
Traceback (most recent call last):
  File "C:\Users\Andre\Documents\web2py\gluon\main.py", line 751, in
start
self.server.start()
  File "C:\Users\Andre\Documents\web2py\gluon\rocket.py", line 426, in
start
return self.stop()
  File "C:\Users\Andre\Documents\web2py\gluon\rocket.py", line 438, in
stop
self._threadpool.stop()
  File "C:\Users\Andre\Documents\web2py\gluon\rocket.py", line 673, in
stop
self.bring_out_your_dead()
  File "C:\Users\Andre\Documents\web2py\gluon\rocket.py", line 678, in
bring_out
_your_dead
dead_threads = [t for t in self.threads if not t.isAlive()]
RuntimeError: Set changed size during iteration

BR,
Andre


[web2py] Re: change in trunk needs testing

2010-11-26 Thread dederocks
Fine, here you go (sorry, don't know how to attach files on google
groups):

-
(dp1
S'output'
p2
S''
sS'layer'
p3
S'C:\\Users\\Andre\\Documents\\web2py\\applications\\admin/views\
\default/index.html'
p4
sS'code'
p5
S'response.write(\'\\nhttp://www.w3.org/
1999/xhtml" xml:lang="en" lang="en">\\n\\n\\n\\t\\n\', escape=False)
\nresponse.write(response.title or URL())\nresponse.write(\'\
\n\', escape=False)\nresponse.files.append(URL(\'static\',
\'css/styles.css\'))\nresponse.write(\'\\n\', escape=False)
\nresponse.files.insert(0,URL(\'static\',\'js/jquery.js\'))
\nresponse.files.insert(1,URL(\'static\',\'css/calendar.css\'))
\nresponse.files.insert(2,URL(\'static\',\'js/calendar.js\'))\nfor
_item in response.meta or []:\nresponse.write(\'\\n \',
escape=False)\npass\nfor _k,_file in enumerate(response.files or
[]):\nif _file in response.files[:_k]:\ncontinue\n
_file0=_file.lower().split(\'?\')[0]\nif _file0.endswith(\'.css\'):
\nresponse.write(\'\\n \', escape=False)\nelif
_file0.endswith(\'.js\'):\nresponse.write(\'\\n \', escape=False)
\npass\npass\nresponse.write(\'\\n  \\n