Re: [web2py] web2py on Google Drive

2013-08-08 Thread Johann Spies

On 08/08/2013 01:10, Evan Caldwell wrote:
I use Google Drive on all my machines to keep things synced up. I 
installed web2py on my windows laptop in a folder in my Google Drive 
(I use the windows client). Then I opened up web2py on my windows 
machine at work from the same synced folder. I can open up the admin 
page an all but when I open a page that tries to access the database I 
get errors. I'm sure there is a good reason but I'm kind of a noob and 
learning web development via web2py so any help is much appreciated. --

Which database do you use?
What do the errors tell you?

Regards
Johann

--
Johann SpiesTelefoon: 021-808 4699
Databestuurder /  Data manager  Faks: 021-883 3691

Sentrum vir Navorsing oor Evaluasie, Wetenskap en Tegnologie
Centre for Research on Evaluation, Science and Technology
Universiteit Stellenbosch.

 "Rest in the LORD, and wait patiently for him: fret not
  thyself because of him who prospereth in his way,
  because of the man who bringeth wicked devices to pass."
Psalms 37:7

E-pos vrywaringsklousule

Hierdie e-pos mag vertroulike inligting bevat en mag regtens geprivilegeerd 
wees en is slegs bedoel vir die persoon aan wie dit geadresseer is. Indien u 
nie die bedoelde ontvanger is nie, word u hiermee in kennis gestel dat u 
hierdie dokument geensins mag gebruik, versprei of kopieer nie. Stel ook 
asseblief die sender onmiddellik per telefoon in kennis en vee die e-pos uit. 
Die Universiteit aanvaar nie aanspreeklikheid vir enige skade, verlies of 
uitgawe wat voortspruit uit hierdie e-pos en/of die oopmaak van enige lês 
aangeheg by hierdie e-pos nie.

E-mail disclaimer

This e-mail may contain confidential information and may be legally privileged 
and is intended only for the person to whom it is addressed. If you are not the 
intended recipient, you are notified that you may not use, distribute or copy 
this document in any manner whatsoever. Kindly also notify the sender 
immediately by telephone, and delete the e-mail. The University does not accept 
liability for any damage, loss or expense arising from this e-mail and/or 
accessing any files attached to this e-mail.

--

--- 
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: Deploying on GAE through the Admin interface

2013-08-08 Thread Massimo Di Pierro
Excellent suggestion! Done.

On Wednesday, 7 August 2013 19:04:59 UTC-5, Christian Foster Howes wrote:
>
> is it hard to warn users of that or disable the button in the admin 
> interface?  i probably wouldn't have caught that detail. :(
>
> On Wednesday, August 7, 2013 4:26:50 PM UTC-7, Massimo Di Pierro wrote:
>>
>> No no no. You need the source version to be able to deploy on GAE.
>>
>> On Wednesday, 7 August 2013 13:54:21 UTC-5, Morten Jeppesen wrote:
>>>
>>> Hi all
>>>
>>> I am trying to deploy on GAE through the admin interface (using the 
>>> latest web2py build on Mac OS X).
>>>
>>> However I get this error message:
>>>
>>> Traceback (most recent call last):
>>>   File "/usr/local/bin/appcfg.py", line 171, in 
>>> run_file(__file__, globals())
>>>   File "/usr/local/bin/appcfg.py", line 167, in run_file
>>> execfile(script_path, globals_)
>>>   File 
>>> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py",
>>>  line 77, in 
>>> from google.appengine.tools import bulkloader
>>>   File 
>>> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py",
>>>  line 139, in 
>>> from google.appengine.ext.bulkload import bulkloader_config
>>>   File 
>>> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/bulkloader_config.py",
>>>  line 47, in 
>>> from google.appengine.ext.bulkload import simplexml_connector
>>>   File 
>>> "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/simplexml_connector.py",
>>>  line 40, in 
>>> from xml.etree import cElementTree as ElementTree
>>> ImportError: cannot import name cElementTree
>>>
>>>
>>> When executing 'from xml.etree import cElementTree as ElementTree' in 
>>> Python (launched in the terminal window) everything works fine...
>>>
>>>
>>> Any help would be very much appreciated.
>>>
>>>
>>> Thanks,
>>>
>>> Morten
>>>
>>>
>>>
>>>

-- 

--- 
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: Curious admin upload behavior: file name changed when uploading to static/css: - becomes _

2013-08-08 Thread Massimo Di Pierro
Because only some characters are allowed in file names. Perhaps the rules 
should be somewhat relaxed for static files?

On Wednesday, 7 August 2013 21:45:55 UTC-5, Rob_McC wrote:
>
>
> I occasionally upload a file through admin panel,
>
> i.e.
>  http://example.com/admin/default/design/welcome
>
>
>
> I noticed when uploading to:
>
> static/css
>
> that *- *or transformed to *_*
> *(dashes are changed to underscore)
> *
> Example:
>
> I upload to static/css
>
> css/my-file11.css
>
> but once uploaded it is changed to:  (note underscore)
> css/my_file11.css
>
> Not sure why this happens.
>
> Rob
> web2py version
> 2.5.1-stable+timestamp.2013.06.06.15.39.19
>

-- 

--- 
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: AppAdmin: CSV import bug

2013-08-08 Thread Massimo Di Pierro
Hard to say without an example.

On Thursday, 8 August 2013 00:07:38 UTC-5, DJ wrote:
>
>
> Not able to upload data using CSV import tool, get the following error 
>  (perhaps, web2py csv import tool needs to read it in using 'rU' option?) -
>
> Running Version 2.5.1, Python 2.7, MacOSX. Tested it using a csv file 
> exported out using appadmin's Export/Import tool.
>
> Unable to parse CSV file:
>
> new-line character seen in unquoted field - do you need to open the file in 
> universal-newline mode?
>
>

-- 

--- 
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] list controller overrides list type?

2013-08-08 Thread Alex
I have a type check
isinstance(myvar, list)
in a controller. This worked fine until I added a function to the 
controller:
def list():
...

the built-in list type is overridden and is now a function (controller 
function). The isinstance check does not work anymore. Is this behavior on 
purpose? I guess the best way to avoid such problems is to have no 'list' 
controller function?

Alex

-- 

--- 
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: list controller overrides list type?

2013-08-08 Thread Anthony
Yes, that's how Python works -- if you create an object (including a 
function or class) with the same name as a 
built-in, 
you shadow the built-in (within that context). However, you will get a 
syntax error if you attempt to do the same with any of the Python 
keywords
.

Anthony

On Thursday, August 8, 2013 7:18:55 AM UTC-4, Alex wrote:
>
> I have a type check
> isinstance(myvar, list)
> in a controller. This worked fine until I added a function to the 
> controller:
> def list():
> ...
>
> the built-in list type is overridden and is now a function (controller 
> function). The isinstance check does not work anymore. Is this behavior on 
> purpose? I guess the best way to avoid such problems is to have no 'list' 
> controller function?
>
> Alex
>
>

-- 

--- 
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] online book : jQuery.attr to jQuery.prop

2013-08-08 Thread Antonis Konstantinos Tzorvas
v5 - p. 504

- if(jQuery('#taxpayer_married').attr('checked'))

attr is not being used anymore and this has to change in:
+ if(jQuery('#taxpayer_married').prop('checked'))

in other way it worked with attr adding this line inside the if scope (4fun)
jQuery(this).attr('checked', !jQuery(this).attr('checked'))

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Niphlod
it would give the same result, its the exact same "mental-mistake"
if you negate the filter you get exactly what you would get negating the 
operator
i.e. WHERE NOT column = 'T'  matches exactly WHERE COLUMN <> 'T'


a column holding a NULL value is "non-existant" for any (and I mean, really 
any) where condition you may want to apply, except the specific ones:
- IS NULL
- IS NOT NULL 

On Thursday, August 8, 2013 3:31:17 AM UTC+2, Joe Barnhart wrote:
>
> Not to be flip, but couldn't you just reverse the test and use 
> ~(mytable.mybool==False)?  That would be false for False and true for True 
> and None (NULL)
>
> But I agree it is an interesting find, and I will watch out for this in my 
> own code.  Thanks for posting!
>
> -- Joe
>
> On Wednesday, August 7, 2013 2:00:42 PM UTC-7, Richard wrote:
>>
>> Hello,
>>
>> Found this not working :
>>
>> db((db.mytable.id == 1) & (db.mytable.mybool != True).select() 
>>
>> That translate as :
>> SELECT * FROM mytable WHERE mytable.id = 1 AND mytable.mybool <> 'T'
>>
>> NO RECORD, BUT THERE IS A RECORD
>>
>> If i change the select like this :
>> SELECT * FROM mytable WHERE mytable.id = 1 AND mytable.mybool IS NOT TRUE
>>
>> I get my record.
>>
>> The issue seems to occure only when the "mybool" is NULL other then that 
>> (TRUE or FALSE) I got my record...
>>
>> Thanks
>>
>> Richard
>>
>>
>>

-- 

--- 
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: list controller overrides list type?

2013-08-08 Thread Alex
that makes sense. thanks!
I have many list controller functions but probably never used the list 
type, so this was the first time I ran into this problem.

Alex

Am Donnerstag, 8. August 2013 13:47:15 UTC+2 schrieb Anthony:
>
> Yes, that's how Python works -- if you create an object (including a 
> function or class) with the same name as a 
> built-in, 
> you shadow the built-in (within that context). However, you will get a 
> syntax error if you attempt to do the same with any of the Python 
> keywords
> .
>
> Anthony
>
> On Thursday, August 8, 2013 7:18:55 AM UTC-4, Alex wrote:
>>
>> I have a type check
>> isinstance(myvar, list)
>> in a controller. This worked fine until I added a function to the 
>> controller:
>> def list():
>> ...
>>
>> the built-in list type is overridden and is now a function (controller 
>> function). The isinstance check does not work anymore. Is this behavior on 
>> purpose? I guess the best way to avoid such problems is to have no 'list' 
>> controller function?
>>
>> Alex
>>
>>

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Richard Vézina
Thanks Niphold. I am aware of that, but forget about it sometimes :(

I need bool to be NULL as I have more room for system evolution... Some
bool field I set them to not null but some I keep them nullable that can
bring me more insight on what going on with the record...

Anyway thanks again... I will check my code for that, cause this mistake is
easy to do, since we forgot alot about SQL with web2py (that is good).

:)

Richard




On Thu, Aug 8, 2013 at 8:57 AM, Niphlod  wrote:

> it would give the same result, its the exact same "mental-mistake"
> if you negate the filter you get exactly what you would get negating the
> operator
> i.e. WHERE NOT column = 'T'  matches exactly WHERE COLUMN <> 'T'
>
>
> a column holding a NULL value is "non-existant" for any (and I mean,
> really any) where condition you may want to apply, except the specific ones:
> - IS NULL
> - IS NOT NULL
>
> On Thursday, August 8, 2013 3:31:17 AM UTC+2, Joe Barnhart wrote:
>>
>> Not to be flip, but couldn't you just reverse the test and use
>> ~(mytable.mybool==False)?  That would be false for False and true for True
>> and None (NULL)
>>
>> But I agree it is an interesting find, and I will watch out for this in
>> my own code.  Thanks for posting!
>>
>> -- Joe
>>
>> On Wednesday, August 7, 2013 2:00:42 PM UTC-7, Richard wrote:
>>>
>>> Hello,
>>>
>>> Found this not working :
>>>
>>> db((db.mytable.id == 1) & (db.mytable.mybool != True).select()
>>>
>>> That translate as :
>>> SELECT * FROM mytable WHERE mytable.id = 1 AND mytable.mybool <> 'T'
>>>
>>> NO RECORD, BUT THERE IS A RECORD
>>>
>>> If i change the select like this :
>>> SELECT * FROM mytable WHERE mytable.id = 1 AND mytable.mybool IS NOT
>>> TRUE
>>>
>>> I get my record.
>>>
>>> The issue seems to occure only when the "mybool" is NULL other then that
>>> (TRUE or FALSE) I got my record...
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I'm facing a bug when I redirect to another controller, that redirects the user
to the login prompt, after having been authenticated.

The code is too large to post here but was working before I refactored some
modules (mostly by using cache on DB requests), and I can't reproduced it but in
a particular controller (all the other redirects work as expected).

The problem is that this *only happens on the web server*. When I run it locally
it works as expected.

The server is running Debian Wheezy + Apache.

I'm quite sure that the problem is in my code (since everything else is working
fine), but I can not reproduce it locally and debug on the web server is not an
option.

The controllers affected:

#--
@auth.requires_login()
def create():
ent_type_id = int( request.args( 0 ) )
doc_type_id = int( request.args( 1 ) )
entId = int( request.args( 2 ) or 0 )
q = (db.ent_doc_type.ent_type_id == ent_type_id)
q &= (db.ent_doc_type.doc_type_id == doc_type_id)
edt = db( q ).select().first()
bizDoc = BizDoc() # defined in a module (dictionary like)
bizDoc.doc.ent_doc_type_id = edt.id

session.bizDoc = bizDoc

url = URL( c='docs', f='creating' )
term.printDebug( 'url: %s' % repr( url ) )
redirect( url )

#--
@auth.requires_login()
def creating():
term.printLog( 'request.args: %s\n' % ( repr( request.args ) ) )
term.printLog( 'request.vars: %s\n' % ( repr( request.vars ) ) )
(...)

If I comment BizDoc references out, the redirect works fine. BizDoc is a class
that extends Storage.

The BIG (and difficult) question is: where should I look to track a bug like
this, without reverting all changes and applying them one by one?

Thanks,
- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÃ?RIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlIDnsMACgkQ90uzwjA1SJVpOgCfY1EKF7nRZ7jfE7ysullsTNQh
VYAAnjZI3a3kktu3zDW9zxkgt4qNBssP
=IDbA
-END PGP SIGNATURE-

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

Clarifying the question: what kind of bug in my code may be causing the session
to expire?

Thanks,
- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlIDqV8ACgkQ90uzwjA1SJUReACgi4wfQJ59HTOeXQxSJ6bS9Hb3
uXsAoNbMfnaNaMObHUDdysZZ8csrKprL
=cvKJ
-END PGP SIGNATURE-

-- 

--- 
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] websocket_messaging.py example

2013-08-08 Thread Richard Vézina
Maybe it could help you :
http://stackoverflow.com/questions/1253683/what-browsers-support-html5-websocket-api

IE8 doesn't seems to be supported though.

Richard


On Wed, Aug 7, 2013 at 6:35 PM, keiser1080  wrote:

> Hi,
>
> I need tu use websocket with ie 8.
> A time ago i have read the tutorial in
> http://greg.thehellings.com/2011/04/web2py-websockets-and-socket-io-part-i-basic-display/
> But the site is down and i can find on google cache.
>
> 1.Can somebody post a simple example ?
> 2.is websocket_messaging.py compatible with http://socket.io/
>
> My project is to send to authetified user some notification.
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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] LOAD inside a form

2013-08-08 Thread Tito Garrido
Hi Folks,

I am using a LOAD function to put a ajax form inside of a form. This is to
add videos to a content without need to reload the page...

It works perfectly on firefox but on chrome, IE or Safari none of the forms
works... It seems to ignore the ajax, reloads the pages and no validation
is trigged. I have ser formname on both forms but it doesn't work.

I will try to create a sample app to illustrate the problem, but in
advance, does anybody know what am I doing wrong?

Thanks!

Tito

-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

-- 

--- 
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: Deploying on GAE through the Admin interface

2013-08-08 Thread Morten Jeppesen
Ran it from source and it works fine. Thank you.

On Thursday, August 8, 2013 10:24:17 AM UTC+2, Massimo Di Pierro wrote:
>
> Excellent suggestion! Done.
>
> On Wednesday, 7 August 2013 19:04:59 UTC-5, Christian Foster Howes wrote:
>>
>> is it hard to warn users of that or disable the button in the admin 
>> interface?  i probably wouldn't have caught that detail. :(
>>
>> On Wednesday, August 7, 2013 4:26:50 PM UTC-7, Massimo Di Pierro wrote:
>>>
>>> No no no. You need the source version to be able to deploy on GAE.
>>>
>>> On Wednesday, 7 August 2013 13:54:21 UTC-5, Morten Jeppesen wrote:

 Hi all

 I am trying to deploy on GAE through the admin interface (using the 
 latest web2py build on Mac OS X).

 However I get this error message:

 Traceback (most recent call last):
   File "/usr/local/bin/appcfg.py", line 171, in 
 run_file(__file__, globals())
   File "/usr/local/bin/appcfg.py", line 167, in run_file
 execfile(script_path, globals_)
   File 
 "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/appcfg.py",
  line 77, in 
 from google.appengine.tools import bulkloader
   File 
 "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/bulkloader.py",
  line 139, in 
 from google.appengine.ext.bulkload import bulkloader_config
   File 
 "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/bulkloader_config.py",
  line 47, in 
 from google.appengine.ext.bulkload import simplexml_connector
   File 
 "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/bulkload/simplexml_connector.py",
  line 40, in 
 from xml.etree import cElementTree as ElementTree
 ImportError: cannot import name cElementTree


 When executing 'from xml.etree import cElementTree as ElementTree' in 
 Python (launched in the terminal window) everything works fine...


 Any help would be very much appreciated.


 Thanks,

 Morten





-- 

--- 
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] JSON Error in web2py | WolframAlpha Python Binder

2013-08-08 Thread PRACHI VAKHARIA


 

**

*
*

*JSON Error in web2py | WolframAlpha Python Binder*

 

The Python binder from *WolframAlpha* developer gives JSON Error in web2py. 

Error:

 * cannot import name JSONDecodeError*

 

The binder files (wap.py and simplejson folder) were put in the Modules folder 
inside  *applications/appName/modules/*  as described in the book.

The wap.py file is being read, and so are some of the files from the simplejson 
folder. But the application always gives a JSON related error from that WAP 
binder.

The goal to access WolframAlpha API from within web2py and display the result 
in JSON format.

 

Python binder from Wolfram can be found here:

*http://products.wolframalpha.com/api/libraries.html* 


 

Thank you, very much. 

*[PV]*

*
*

*
*

*
*

 

**

*
*

*.*

-- 

--- 
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: online book : jQuery.attr to jQuery.prop

2013-08-08 Thread Massimo Di Pierro
fixed in trunk. Thanks.

On Thursday, 8 August 2013 06:48:43 UTC-5, Antonis Konstantinos Tzorvas 
wrote:
>
> v5 - p. 504
>
> - if(jQuery('#taxpayer_married').attr('checked'))
>
> attr is not being used anymore and this has to change in:
> + if(jQuery('#taxpayer_married').prop('checked'))
>
> in other way it worked with attr adding this line inside the if scope 
> (4fun)
> jQuery(this).attr('checked', !jQuery(this).attr('checked'))
>

-- 

--- 
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: LOAD inside a form

2013-08-08 Thread Massimo Di Pierro
You cannot put a form inside a form. If the inner form contains input tags, 
for example, the browser does not understand whether it belongs to the most 
inner or the outer form.

On Thursday, 8 August 2013 10:29:23 UTC-5, Tito Garrido wrote:
>
> Hi Folks,
>
> I am using a LOAD function to put a ajax form inside of a form. This is to 
> add videos to a content without need to reload the page...
>
> It works perfectly on firefox but on chrome, IE or Safari none of the 
> forms works... It seems to ignore the ajax, reloads the pages and no 
> validation is trigged. I have ser formname on both forms but it doesn't 
> work.
>
> I will try to create a sample app to illustrate the problem, but in 
> advance, does anybody know what am I doing wrong?
>
> Thanks!
>
> Tito
>
> -- 
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___ 
>

-- 

--- 
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: JSON Error in web2py | WolframAlpha Python Binder

2013-08-08 Thread Massimo Di Pierro
Can you show us some code? Do you have a complete traceback?


On Thursday, 8 August 2013 04:46:49 UTC-5, PRACHI VAKHARIA wrote:
>
>
>
>  
>
> **
>
> *
> *
>
> *JSON Error in web2py | WolframAlpha Python Binder*
>
>  
>
> The Python binder from *WolframAlpha* developer gives JSON Error in web2py. 
>
> Error:
>
>  * cannot import name JSONDecodeError*
>
>  
>
> The binder files (wap.py and simplejson folder) were put in the Modules 
> folder inside  *applications/appName/modules/*  as described in the book.
>
> The wap.py file is being read, and so are some of the files from the 
> simplejson folder. But the application always gives a JSON related error from 
> that WAP binder.
>
> The goal to access WolframAlpha API from within web2py and display the result 
> in JSON format.
>
>  
>
> Python binder from Wolfram can be found here:
>
> *http://products.wolframalpha.com/api/libraries.html* 
> 
>
>  
>
> Thank you, very much. 
>
> *[PV]*
>
> *
> *
>
> *
> *
>
> *
> *
>
>  
>
> **
>
> *
> *
>
> *.*
>
>

-- 

--- 
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: Upload image and make a thumbnail question.

2013-08-08 Thread Michael Gheith
Perfect Massimo, thanks so much for all your help!

The file should look like the following:
uploads*.*thumb*.*08974530*-*d8a6*-*4c6c*-*a9d2*-*ad59e319b953*
.base64encodedname.*jpg  #no brackets


Best!
Michael Joseph Gheith

On Monday, August 5, 2013 5:34:14 PM UTC-5, Massimo Di Pierro wrote:
>
> I now see the problem. The issue is that the filename does not match the 
> pattern. It is
>
> uploads*.*thumb*.*08974530*-*d8a6*-*4c6c*-*a9d2*-*ad59e319b953*.*jpg
>
>
> but should be
>
>
> uploads*.*thumb*.*08974530*-*d8a6*-*4c6c*-*a9d2*-*ad59e319b953*
> ..*jpg
>
> This was not enforded before. Please open a ticket about this and I will 
> make the * part optional.*
>
> On Sunday, 4 August 2013 18:13:02 UTC-5, Michael Gheith wrote:
>>
>> Hello web2py community!
>>
>> I used to be able to use the following web2py slice successfully in the 
>> past (about a year ago):
>>
>> http://www.web2pyslices.com/slice/show/1387/upload-image-and-make-a-thumbnail
>>
>> Now it's not working with the latest build of web2py.  Is anyone able to 
>> successfully get this slice working with the latest web2py build?
>>
>> The code is successfully creating the thumbnail and storing it in the 
>> uploads folder.  I can physically see it on the file system.  But I get a 
>> ticket whenever I try to access the thumbnail through the DB admin or 
>> through the URL bar:
>>  Can't retrieve 
>> uploads.thumb.16e0d9fd-bc66-4b36-9c75-03aaea1d8603.PNG
>>
>> I don't think there is anything wrong with what I am doing.  I think the 
>> problem resides in the slice and web2py breaking backward compatibility... 
>>  Please provide guidance, thanks!
>>
>

-- 

--- 
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] 3rd party mail API methodology

2013-08-08 Thread Wes Hall

How do I implement the alternate method site-wide?

Is it as simple as matching the Mail() signature?

What are the minimum parameters that would need to be in place for it to 
work site-wide? (Thinking of Auth, specifically)

Is this a bad idea?

As far as specifics go, I'm looking at the Elastic Email API and using 
Web2Py 2.5.1.

-- 

--- 
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: Nice change to admin interface for editing files, what about static files?

2013-08-08 Thread Tito Garrido
Is there a way to collapse this left menu or just remove it? It is now
worse to see the code, we lost a lot of edit area for a menu, I personally
didn't like it. Changes on the interface should be optional, it changes the
way that you use the admin...


On Tue, Aug 6, 2013 at 9:08 AM, Rob_McC  wrote:

>
> I just discovered, it wasn't obvious to me, that the headings will *
> COLLAPSE* the file list.
>
> I also like to
> Cmd- Click
> on a file to open in a NEW tab in my Browser.
>
>
>
> Collapse Feature Example:
> While editing a file, like db.py,
> the menu is:
>
> models
> db.py
> menu.py
>
> controllers
> appadmin.py
> default.py
> views
> __init__.py
> appadmin.html
> default/index.ht
> etc..
>
> Then, click on controllers, the controller files collapse
> models
> db.py
> menu.py
>
> controllers
>
> views
> __init__.py
> appadmin.html
> default/index.ht
> etc.
>
> A very nice improvement to UI. I spend a lot of time playing around with
> web2py, and the ability to edit files quickly in admin is helpful,
> lately, I use Sublime Text 2 as my primary editor, but still play with the
> editing feature inside of web2py.
> http://www.sublimetext.com/
> but, it took me a long time to understand how powerful it is, and that
> installing plugins is essential to productivity,
> it's great for Python, with the correct plugins, and changes the way I
> code.
> https://tutsplus.com/course/improve-workflow-in-sublime-text-2/
>
> Sublime will open up the web2py.app package on my mac, and I see all the
> files there.
>
> R
>
>
>
>  --
>
> ---
> 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.
>
>
>



-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

-- 

--- 
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] Bootstrap Carousel and bootstrap

2013-08-08 Thread Hugo Costa
Sorry about the delay.

The first one works fine, but only works for the first and the second.

The code I used is:

*index.html*
*
*

  



  
  
{{for index, post in enumerate(news):}}

{{if index==0:}}
   
   {{=post.title}}
   {{=post.post}}
   {{=post.created_on}}
   
{{pass}}

{{else:}}
   
{{=post.title}}
   {{=post.post}}
   {{=post.created_on}}
   
{{pass}}
{{pass}}
  
  ‹
  ›



What could it be? 

Quarta-feira, 7 de Agosto de 2013 20:56:17 UTC+1, Roberto Perdomo escreveu:
>
> you forgot the ":" on the else and pass on the if. index var not exist, 
> was my example, you need get the index of the iteration, may be with 
> news.index(post) or using enumerate. Try this two example:
>
> 
>   
>  class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
> {{for index, post in enumerate(news):}}
> {{if index==0:}}
> src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner1" />
>{{=post.title}}
>{{=post.post}}
>{{=post.created_on}}
>
> {{pass}}
> {{else:}}
> src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner2" 
> />
> {{pass}}
> {{pass}}
>   
>href="#carousel-example-generic" data-slide="prev">‹
>href="#carousel-example-generic" data-slide="next">›
> 
> 
>
> or:
>
> 
>   
>  class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
> {{for post in news:}}
> {{if news.index(post)==0:}}
> src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner1" />
>{{=post.title}}
>{{=post.post}}
>{{=post.created_on}}
>
> {{pass}}
> {{else:}}
> src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner2" 
> />
> {{pass}}
> {{pass}}
>   
>href="#carousel-example-generic" data-slide="prev">‹
>href="#carousel-example-generic" data-slide="next">›
> 
> 
>
> Is an example, this was not tested
>
>
> 2013/8/7 Hugo Costa >
>
>> Hey Roberto!
>>
>> So, I've used your code and this turned out:
>>
>> *index.html*
>> *
>> *
>> 
>>
>>   
>> > class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for post in news:}}
>> {{if index==0:}}
>>>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner1" 
>> />
>>{{=post.title}}
>>{{=post.post}}
>>{{=post.created_on}}
>>
>> {{else}}
>>>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner2" 
>> />
>> {{pass}}
>> {{pass}}
>>   
>>   > href="#carousel-example-generic" data-slide="prev">‹
>>   > href="#carousel-example-generic" data-slide="next">›
>> 
>> 
>>
>>
>> I don't understand why, but I'm getting this error:
>>
>>  invalid syntax (index.html, line 70)
>>
>> What could it be?
>>
>> Quarta-feira, 7 de Agosto de 2013 18:37:54 UTC+1, Roberto Perdomo 
>> escreveu:
>>>
>>> Hi Hugo, I dont know bootstrap carousel, but in the view you are iterating 
>>> many times the main div "carousel-example-generic".
>>>
>>> In your case you need iterate only the dinamic content of the carousel, 
>>> and the carousel content are divs.
>>>
>>> See this example with my comments:
>>>
>>> 
>>>   
>>>  
>>> >> class="active">
>>> 
>>> 
>>>   
>>>   
>>>   
>>> 
>>> 
>>> 
>>> 
>>> >> />
>>> 
>>> 
>>>   
>>>   
>>>   >> data-slide="prev">‹
>>>   >> data-slide="next">›
>>> 
>>>
>>> hope I've helped with this example.
>>>
>>>
>>> 2013/8/7 Hugo Costa 
>>>
 Hello!

 I'm doing a website where I have a carousel in which should be the 3 
 latest news, going to search for Title, Content and Date to the database 
 but isn't working like I wanted.

 The code:

 *default.py*

 def index():
 """
 example action using the internationalization operator T and flash
 rendered by views/default/index.html or views/generic.html

  if you need a simple wiki simple replace the two lines below with:
 return auth.wiki()
 """
 if auth.user:
 response.flash = T('Welcome %s %s' % (auth.user.first_name, 
 auth.user.last_name))
 else:
 response.flash = T('Welcome Visitor')
 news = db(db.posts).select(orderby=~d**b.posts.id, 
 limitby=(0, 3))
 return dict(news=news

[web2py] Cool "formstyle" trick w/Python lambda

2013-08-08 Thread Joe Barnhart
So I'm a control-freak.  I mean that in a good way.  I discovered the 
beauty of "placeholders" in forms and just thought "man, I really want 
that!"  But where to hold the placeholder data?  And how do I get it to the 
SQLFORM during form creation?

At first I thought about adding YAV (yet another variable) to the Field 
class.  But it's getting pretty crowded in there already, and mucking with 
it means changes to the base, and the devs might object to a 
special-purpose hack inserted into Field just to satisfy my whims.  So I 
thought I'd just create my own formstyle function and use that.  But wait! 
 The formstyle function has a defined signature now, and there is no place 
to insert anything like a dictionary of placeholders indeded by field name. 
 Or is there...

I created my own formstyle function, but added a keyword parameter to the 
end for the placeholders dict.  The signature looke like this:


def my_fieldstyle(form, fields, placeholders=None):
...blah...


Now, the code in SQLFORM still has no idea that these placeholders exist. 
 But I can "wrap" this function with either a "partial function" or a 
simple lambda to provide my own dictionary just before the customized 
formstyle function is handed off to SQLFORM for it's main job.  It looks 
like this:


my_placeholder_dict = {'field1': 'place1', 'field2', 'place2'...}
...
styler = lambda form, fields: my_fieldstyle(form, fields, 
placeholders=my_placeholder_dict)
...
form = SQLFORM(... formstyle=styler ...)
 

That's all there is to it!  Now I can pass abundant information into the 
SQLFORM created, info that the base form creation has no idea exists.  My 
own custom formstyle class can interpret the extra information and add all 
kinds of special features.  Just a few ideas:

1.  Provide "placehloders" for phone and date fields to show proper format

2.  Provide dictionary of "field sets" with "legends" and create a 
structured form organized the way I want

3.  ... and many many more!

Best of all, it only needs stupid Python tricks and doesn't much with the 
underlying structure of web2py at all!  No nasty stares from the devs! 
 (Just kidding...)

-- Joe

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Joe Barnhart
Hmmm...  That's not quite what I suggested.

I suggested WHERE NOT COLUMN = 'F'  which I think would result in the OP 
wants, True and NULL would be grouped together and False would be separate. 
 Or are you saying that web2py db adapters will take the construction 
~db.table.column=False and turn that into your construction below?

Warm regards,

Joe

On Thursday, August 8, 2013 5:57:44 AM UTC-7, Niphlod wrote:
>
> it would give the same result, its the exact same "mental-mistake"
> if you negate the filter you get exactly what you would get negating the 
> operator
> i.e. WHERE NOT column = 'T'  matches exactly WHERE COLUMN <> 'T'
>
>
> a column holding a NULL value is "non-existant" for any (and I mean, 
> really any) where condition you may want to apply, except the specific ones:
> - IS NULL
> - IS NOT NULL 
>
> On Thursday, August 8, 2013 3:31:17 AM UTC+2, Joe Barnhart wrote:
>>
>> Not to be flip, but couldn't you just reverse the test and use 
>> ~(mytable.mybool==False)?  That would be false for False and true for True 
>> and None (NULL)
>>
>> But I agree it is an interesting find, and I will watch out for this in 
>> my own code.  Thanks for posting!
>>
>> -- Joe
>>
>> On Wednesday, August 7, 2013 2:00:42 PM UTC-7, Richard wrote:
>>>
>>> Hello,
>>>
>>> Found this not working :
>>>
>>> db((db.mytable.id == 1) & (db.mytable.mybool != True).select() 
>>>
>>> That translate as :
>>> SELECT * FROM mytable WHERE mytable.id = 1 AND mytable.mybool <> 'T'
>>>
>>> NO RECORD, BUT THERE IS A RECORD
>>>
>>> If i change the select like this :
>>> SELECT * FROM mytable WHERE mytable.id = 1 AND mytable.mybool IS NOT 
>>> TRUE
>>>
>>> I get my record.
>>>
>>> The issue seems to occure only when the "mybool" is NULL other then that 
>>> (TRUE or FALSE) I got my record...
>>>
>>> Thanks
>>>
>>> Richard
>>>
>>>
>>>

-- 

--- 
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] Cool "formstyle" trick w/Python lambda

2013-08-08 Thread Richard Vézina
Nice Joe! Thanks for the recipe...

Until now I was creating custom widget for that, but this seems simpler,
because I was getting in trouble sometimes with custom widget when I was
requiring to alter a widget or set a differents widget, since I was getting
placeholder from a dabase dictionnary that I create for every fields in
every table. So, if I had to set a widget in the code I have to customize a
new placeholder attribute or pass placeholder as kargs...

Thanks

Richard


On Thu, Aug 8, 2013 at 2:11 PM, Joe Barnhart  wrote:

> So I'm a control-freak.  I mean that in a good way.  I discovered the
> beauty of "placeholders" in forms and just thought "man, I really want
> that!"  But where to hold the placeholder data?  And how do I get it to the
> SQLFORM during form creation?
>
> At first I thought about adding YAV (yet another variable) to the Field
> class.  But it's getting pretty crowded in there already, and mucking with
> it means changes to the base, and the devs might object to a
> special-purpose hack inserted into Field just to satisfy my whims.  So I
> thought I'd just create my own formstyle function and use that.  But wait!
>  The formstyle function has a defined signature now, and there is no place
> to insert anything like a dictionary of placeholders indeded by field name.
>  Or is there...
>
> I created my own formstyle function, but added a keyword parameter to the
> end for the placeholders dict.  The signature looke like this:
>
>
> def my_fieldstyle(form, fields, placeholders=None):
> ...blah...
>
>
> Now, the code in SQLFORM still has no idea that these placeholders exist.
>  But I can "wrap" this function with either a "partial function" or a
> simple lambda to provide my own dictionary just before the customized
> formstyle function is handed off to SQLFORM for it's main job.  It looks
> like this:
>
>
> my_placeholder_dict = {'field1': 'place1', 'field2', 'place2'...}
> ...
> styler = lambda form, fields: my_fieldstyle(form, fields,
> placeholders=my_placeholder_dict)
> ...
> form = SQLFORM(... formstyle=styler ...)
>
>
> That's all there is to it!  Now I can pass abundant information into the
> SQLFORM created, info that the base form creation has no idea exists.  My
> own custom formstyle class can interpret the extra information and add all
> kinds of special features.  Just a few ideas:
>
> 1.  Provide "placehloders" for phone and date fields to show proper format
>
> 2.  Provide dictionary of "field sets" with "legends" and create a
> structured form organized the way I want
>
> 3.  ... and many many more!
>
> Best of all, it only needs stupid Python tricks and doesn't much with the
> underlying structure of web2py at all!  No nasty stares from the devs!
>  (Just kidding...)
>
> -- Joe
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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] Bootstrap Carousel and bootstrap

2013-08-08 Thread Roberto Perdomo
Good news!

You really have three post?
Can you print the three posts in a .html without carousel?
You have checked the source of your index.html (in the browser) and search
the three div inside "carousel-inner"?


2013/8/8 Hugo Costa 

> Sorry about the delay.
>
> The first one works fine, but only works for the first and the second.
>
> The code I used is:
>
> *index.html*
> *
> *
> 
>   
>  class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
> {{for index, post in enumerate(news):}}
>
> {{if index==0:}}
>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner1"
> />
>{{=post.title}}
>{{=post.post}}
>{{=post.created_on}}
>
> {{pass}}
>
> {{else:}}
>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner2"
> />
> {{=post.title}}
>{{=post.post}}
>{{=post.created_on}}
>
> {{pass}}
> {{pass}}
>   
>href="#carousel-example-generic" data-slide="prev">‹
>href="#carousel-example-generic" data-slide="next">›
> 
> 
>
> What could it be?
>
> Quarta-feira, 7 de Agosto de 2013 20:56:17 UTC+1, Roberto Perdomo escreveu:
>>
>> you forgot the ":" on the else and pass on the if. index var not exist,
>> was my example, you need get the index of the iteration, may be with
>> news.index(post) or using enumerate. Try this two example:
>>
>> 
>>   
>> > class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for index, post in enumerate(news):}}
>> {{if index==0:}}
>>> src="{{=URL('static','images/**carousel/%s'
>> %(post.image))}}" alt="banner1" />
>>{{=post.title}}
>>{{=post.**post}}
>>{{=post.**created_on}}
>>
>> {{pass}}
>> {{else:}}
>>> src="{{=URL('static','images/**carousel/%s'
>> %(post.image))}}" alt="banner2" />
>> {{pass}}
>> {{pass}}
>>   
>>   > href="#carousel-example-**generic" data-slide="prev">‹
>>   > href="#carousel-example-**generic" data-slide="next">›
>> 
>> 
>>
>> or:
>>
>> 
>>   
>> > class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for post in news:}}
>> {{if news.index(post)==0:}}
>>> src="{{=URL('static','images/**carousel/%s'
>> %(post.image))}}" alt="banner1" />
>>{{=post.title}}
>>{{=post.**post}}
>>{{=post.**created_on}}
>>
>> {{pass}}
>> {{else:}}
>>> src="{{=URL('static','images/**carousel/%s'
>> %(post.image))}}" alt="banner2" />
>> {{pass}}
>> {{pass}}
>>   
>>   > href="#carousel-example-**generic" data-slide="prev">‹
>>   > href="#carousel-example-**generic" data-slide="next">›
>> 
>> 
>>
>> Is an example, this was not tested
>>
>>
>> 2013/8/7 Hugo Costa 
>>
>> Hey Roberto!
>>>
>>> So, I've used your code and this turned out:
>>>
>>> *index.html*
>>> *
>>> *
>>> 
>>>
>>>   
>>> >> data-slide-to="0" class="active">
>>> >> data-slide-to="1">
>>> >> data-slide-to="2">
>>>   
>>>   
>>> {{for post in news:}}
>>> {{if index==0:}}
>>>
>>>{{=post.title}}
>>>{{=post.**post}}
>>>{{=post.**created_on}}
>>>
>>> {{else}}
>>>>> src="{{=URL('static','images/**carousel/%s'
>>> %(post.image))}}" alt="banner2" />
>>> {{pass}}
>>> {{pass}}
>>>   
>>>   >> href="#carousel-example-**generic" data-slide="prev">‹
>>>   >> href="#carousel-example-**generic" data-slide="next">›
>>> 
>>> 
>>>
>>>
>>> I don't understand why, but I'm getting this error:
>>>
>>>  invalid syntax (index.html, line 70)
>>>
>>> What could it be?
>>>
>>> Quarta-feira, 7 de Agosto de 2013 18:37:54 UTC+1, Roberto Perdomo
>>> escreveu:

 Hi Hugo, I dont know bootstrap carousel, but in the view you are iterating
 many times the main div "carousel-example-generic".

 In your case you need iterate only the dinamic content of the carousel,
 and the carousel content are divs.

 See this example with my comments:

 
   
  
 >>> class="active">
 
 
   
   
   
 
 
 
 
 >>> alt="banner2" />
 
 
   
   
   >>> data-slide="prev">‹
   >>> data-slide="next">›
 

 hope I've helped with this example.


 2013/8/7 Hugo Costa 

> Hello!
>
> I'm doing a website where I have a carousel in which should be the 3
> 

Re: [web2py] Cool "formstyle" trick w/Python lambda

2013-08-08 Thread Vinicius Assef
Excellent approach. :-)

On Thu, Aug 8, 2013 at 3:11 PM, Joe  Barnhart  wrote:
> So I'm a control-freak.  I mean that in a good way.  I discovered the beauty
> of "placeholders" in forms and just thought "man, I really want that!"  But
> where to hold the placeholder data?  And how do I get it to the SQLFORM
> during form creation?
>
> At first I thought about adding YAV (yet another variable) to the Field
> class.  But it's getting pretty crowded in there already, and mucking with
> it means changes to the base, and the devs might object to a special-purpose
> hack inserted into Field just to satisfy my whims.  So I thought I'd just
> create my own formstyle function and use that.  But wait!  The formstyle
> function has a defined signature now, and there is no place to insert
> anything like a dictionary of placeholders indeded by field name.  Or is
> there...
>
> I created my own formstyle function, but added a keyword parameter to the
> end for the placeholders dict.  The signature looke like this:
>
>
> def my_fieldstyle(form, fields, placeholders=None):
> ...blah...
>
>
> Now, the code in SQLFORM still has no idea that these placeholders exist.
> But I can "wrap" this function with either a "partial function" or a simple
> lambda to provide my own dictionary just before the customized formstyle
> function is handed off to SQLFORM for it's main job.  It looks like this:
>
>
> my_placeholder_dict = {'field1': 'place1', 'field2', 'place2'...}
> ...
> styler = lambda form, fields: my_fieldstyle(form, fields,
> placeholders=my_placeholder_dict)
> ...
> form = SQLFORM(... formstyle=styler ...)
>
>
> That's all there is to it!  Now I can pass abundant information into the
> SQLFORM created, info that the base form creation has no idea exists.  My
> own custom formstyle class can interpret the extra information and add all
> kinds of special features.  Just a few ideas:
>
> 1.  Provide "placehloders" for phone and date fields to show proper format
>
> 2.  Provide dictionary of "field sets" with "legends" and create a
> structured form organized the way I want
>
> 3.  ... and many many more!
>
> Best of all, it only needs stupid Python tricks and doesn't much with the
> underlying structure of web2py at all!  No nasty stares from the devs!
> (Just kidding...)
>
> -- Joe
>
> --
>
> ---
> 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.
>
>

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Niphlod
Until now I assumed the problem of @Richard is that if a row has column == 
None, if he queries the table with column != True he expected the NULL row 
to show (because in python None is different from True).

~db.table.column=False will result in a WHERE NOT column = 'F'. You don't 
get any row holding column == None with that query.

What you said in your post

That would be false for False and true for True and None (NULL)
>

is what happens in python but not in any db backend, reason why it may seem 
cumbersome to users accustomed to "compare" in python vs in databases.

Little recap for everybody looking at this later
db.define_table('thenulltest', Field('thenullablefield', 'boolean'))

>>> db.commit()
>>> db.thenulltest.insert()
1L
>>> db.thenulltest.insert(thenullablefield=True)
2L
>>> db.thenulltest.insert(thenullablefield=False)
3L
>>> for row in db(db.thenulltest).select():
... print row
... 



>>> for row in db(db.thenulltest.thenullablefield==True).select(): print row
... 

>>> for row in db(db.thenulltest.thenullablefield!=True).select(): print row
... 

##only False is extracted, None is skipped
>>> for row in db(~(db.thenulltest.thenullablefield!=True)).select(): printrow
... 

##only True is extracted, None is skipped
>>> for row in db(~(db.thenulltest.thenullablefield==True)).select(): printrow
... 

##only False is extracted, None is skipped
>>> for row in db(~(db.thenulltest.thenullablefield==None)).select(): printrow
... 


##not None means both True OR False
>>> for row in db(db.thenulltest.thenullablefield==None).select(): print row
... 

##finally, the only query that returns the "None" Field






-- 

--- 
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: 3rd party mail API methodology

2013-08-08 Thread Niphlod
if you want to replace the standard Mail object, you need to match the 
signature of the function. Anyway, you can use Amazon's SES (assuming is 
the one you'd like to match) without adopting the API but using their SMTP 
server.

On Thursday, August 8, 2013 8:06:54 PM UTC+2, Wes Hall wrote:
>
>
> How do I implement the alternate method site-wide?
>
> Is it as simple as matching the Mail() signature?
>
> What are the minimum parameters that would need to be in place for it to 
> work site-wide? (Thinking of Auth, specifically)
>
> Is this a bad idea?
>
> As far as specifics go, I'm looking at the Elastic Email API and using 
> Web2Py 2.5.1.
>

-- 

--- 
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] Bootstrap Carousel and bootstrap

2013-08-08 Thread Hugo Costa
Yeah, I have. 3 is the magic number :)

I did not understand this question.

The third is missing 





   
   Azeite Vinaldo
   Guache sobre Tela, 75x30 cm.
   2013-08-07 18:03:38.774240
 
   
Bezegaio Frito
   Acrilico sobre Tela, 45x40 cm
   2013-08-07 17:52:27.399172
   


  

The code in the source in browser.

Quinta-feira, 8 de Agosto de 2013 19:43:36 UTC+1, Roberto Perdomo escreveu:
>
> Good news!
>
> You really have three post?
> Can you print the three posts in a .html without carousel?
> You have checked the source of your index.html (in the browser) and search 
> the three div inside "carousel-inner"?
>
>
> 2013/8/8 Hugo Costa >
>
>> Sorry about the delay.
>>
>> The first one works fine, but only works for the first and the second.
>>
>> The code I used is:
>>
>> *index.html*
>> *
>> *
>> 
>>   
>> > class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for index, post in enumerate(news):}}
>>
>> {{if index==0:}}
>>>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner1" 
>> />
>>{{=post.title}}
>>{{=post.post}}
>>{{=post.created_on}}
>>
>> {{pass}}
>>
>> {{else:}}
>>>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" alt="banner2" 
>> />
>> {{=post.title}}
>>{{=post.post}}
>>{{=post.created_on}}
>>
>> {{pass}}
>> {{pass}}
>>   
>>   > href="#carousel-example-generic" data-slide="prev">‹
>>   > href="#carousel-example-generic" data-slide="next">›
>> 
>> 
>>
>> What could it be? 
>>
>> Quarta-feira, 7 de Agosto de 2013 20:56:17 UTC+1, Roberto Perdomo 
>> escreveu:
>>>
>>> you forgot the ":" on the else and pass on the if. index var not exist, 
>>> was my example, you need get the index of the iteration, may be with 
>>> news.index(post) or using enumerate. Try this two example:
>>>
>>> 
>>>   
>>> >> data-slide-to="0" class="active">
>>> >> data-slide-to="1">
>>> >> data-slide-to="2">
>>>   
>>>   
>>> {{for index, post in enumerate(news):}}
>>> {{if index==0:}}
>>>
>>>{{=post.title}}
>>>{{=post.**post}}
>>>{{=post.**created_on}}
>>>
>>> {{pass}}
>>> {{else:}}
>>>>> src="{{=URL('static','images/**carousel/%s' 
>>> %(post.image))}}" alt="banner2" />
>>> {{pass}}
>>> {{pass}}
>>>   
>>>   >> href="#carousel-example-**generic" data-slide="prev">‹
>>>   >> href="#carousel-example-**generic" data-slide="next">›
>>> 
>>> 
>>>
>>> or:
>>>
>>> 
>>>   
>>> >> data-slide-to="0" class="active">
>>> >> data-slide-to="1">
>>> >> data-slide-to="2">
>>>   
>>>   
>>> {{for post in news:}}
>>> {{if news.index(post)==0:}}
>>>
>>>{{=post.title}}
>>>{{=post.**post}}
>>>{{=post.**created_on}}
>>>
>>> {{pass}}
>>> {{else:}}
>>>>> src="{{=URL('static','images/**carousel/%s' 
>>> %(post.image))}}" alt="banner2" />
>>> {{pass}}
>>> {{pass}}
>>>   
>>>   >> href="#carousel-example-**generic" data-slide="prev">‹
>>>   >> href="#carousel-example-**generic" data-slide="next">›
>>> 
>>> 
>>>
>>> Is an example, this was not tested
>>>
>>>
>>> 2013/8/7 Hugo Costa 
>>>
>>> Hey Roberto!

 So, I've used your code and this turned out:

 *index.html*
 *
 *
 

   
 >>> data-slide-to="0" class="active">
 >>> data-slide-to="1">
 >>> data-slide-to="2">
   
   
 {{for post in news:}}
 {{if index==0:}}

{{=post.title}}
{{=post.**post}}
{{=post.**created_on}}

 {{else}}
>>> src="{{=URL('static','images/**carousel/%s' 
 %(post.image))}}" alt="banner2" />
 {{pass}}
 {{pass}}
   
   >>> href="#carousel-example-**generic" data-slide="prev">‹
   >>> href="#carousel-example-**generic" data-slide="next">›
 
 


 I don't understand why, but I'm getting this error:

  invalid syntax (index.html, line 70)

 What could it be?

 Quarta-feira, 7 de Agosto de 2013 18:37:54 UTC+1, Roberto Perdomo 
 escreveu:
>
> Hi Hugo, I dont know bootstrap carousel, but in the view you are 
> iterating 
> many times the main div "carousel-example-generic".
>
> In your case you need iterate only the 

Re: [web2py] Re: Nice change to admin interface for editing files, what about static files?

2013-08-08 Thread Massimo Di Pierro
Something clearly is not working well for you.
The latest menu (in trunk) is a drawer and it does not take any space.

Which version are you using? Which browser? can you post a screenshot?



On Thursday, 8 August 2013 13:14:23 UTC-5, Tito Garrido wrote:
>
> Is there a way to collapse this left menu or just remove it? It is now 
> worse to see the code, we lost a lot of edit area for a menu, I personally 
> didn't like it. Changes on the interface should be optional, it changes the 
> way that you use the admin...
>
>
> On Tue, Aug 6, 2013 at 9:08 AM, Rob_McC  >wrote:
>
>>
>> I just discovered, it wasn't obvious to me, that the headings will *
>> COLLAPSE* the file list.
>>
>> I also like to 
>> Cmd- Click 
>> on a file to open in a NEW tab in my Browser.
>>
>>
>>
>> Collapse Feature Example:
>> While editing a file, like db.py,
>> the menu is:
>>
>> models
>> db.py
>> menu.py
>>
>> controllers
>> appadmin.py
>> default.py
>> views
>> __init__.py
>> appadmin.html
>> default/index.ht
>> etc..
>>
>> Then, click on controllers, the controller files collapse
>> models
>> db.py
>> menu.py
>>
>> controllers
>>
>> views
>> __init__.py
>> appadmin.html
>> default/index.ht
>> etc.
>>
>> A very nice improvement to UI. I spend a lot of time playing around with 
>> web2py, and the ability to edit files quickly in admin is helpful,
>> lately, I use Sublime Text 2 as my primary editor, but still play with 
>> the editing feature inside of web2py.
>> http://www.sublimetext.com/
>> but, it took me a long time to understand how powerful it is, and that 
>> installing plugins is essential to productivity,
>> it's great for Python, with the correct plugins, and changes the way I 
>> code.
>> https://tutsplus.com/course/improve-workflow-in-sublime-text-2/
>>
>> Sublime will open up the web2py.app package on my mac, and I see all the 
>> files there.
>>
>> R 
>>
>>
>>
>>  -- 
>>  
>> --- 
>> 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.
>>  
>>  
>>
>
>
>
> -- 
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___ 
>

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Ricardo Pedroso
On Thu, Aug 8, 2013 at 2:36 PM, Carlos Correia  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi,
>
> I'm facing a bug when I redirect to another controller, that redirects the
> user
> to the login prompt, after having been authenticated.
>

It's hard to tell what the problem is but for me it seems that web2py is
failing to load the
session data.
If you dont mind to tweak your gluon/globals.py you could add a raise
statement
to reraise some exceptions that are been swallowed when web2py tries to
load the session data.
But again, this is just a guess...

You can try also to delete your browser session cookie.

Sometimes when weird thinks happens, restarting webserver, and as a last
resource restarting the server,
can help.

Ricardo

-- 

--- 
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] using contains operator with reference types

2013-08-08 Thread dave
I have two tables defined as follows

db.define_table('animals', 
Field('type'),
format='%(type)s')

db.define_table('zoo', 
Field('name'), 
Field('tier', 'reference animals'),
format='%(name)s' 
) 

field type is a column with values like, test 1, test 2, test 3
now if I want to select all the records of table zoo with 'test 2' I can do 
something like this 

rows = db(db.zoo.tier == "2").select()

but why can't I do something like 
db(db.zoo.tier.contains("2")).select() or
pass a list  ["2", "3"] to the contains operator to get all the records of 
"test 2" and "test 3"? can you suggest another way of implementing this?

-- 

--- 
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] Bootstrap Carousel and bootstrap

2013-08-08 Thread Roberto Perdomo
The {{pass}} of the if is not needed :-S


2013/8/8 Hugo Costa 

> Yeah, I have. 3 is the magic number :)
>
> I did not understand this question.
>
> The third is missing
>
> 
>
>
>
> src="/diogo/static/images/carousel/carousel3.jpg" alt="banner1">
>Azeite Vinaldo
>Guache sobre Tela, 75x30 cm.
>2013-08-07 18:03:38.774240
>
> src="/diogo/static/images/carousel/carousel1.jpg" alt="banner2">
> Bezegaio Frito
>Acrilico sobre Tela, 45x40 cm
>2013-08-07 17:52:27.399172
>
>
>
>   
>
> The code in the source in browser.
>
> Quinta-feira, 8 de Agosto de 2013 19:43:36 UTC+1, Roberto Perdomo escreveu:
>>
>> Good news!
>>
>> You really have three post?
>> Can you print the three posts in a .html without carousel?
>> You have checked the source of your index.html (in the browser) and
>> search the three div inside "carousel-inner"?
>>
>>
>> 2013/8/8 Hugo Costa 
>>
>> Sorry about the delay.
>>>
>>> The first one works fine, but only works for the first and the second.
>>>
>>> The code I used is:
>>>
>>> *index.html*
>>> *
>>> *
>>> 
>>>   
>>> >> data-slide-to="0" class="active">
>>> >> data-slide-to="1">
>>> >> data-slide-to="2">
>>>   
>>>   
>>> {{for index, post in enumerate(news):}}
>>>
>>> {{if index==0:}}
>>>
>>>{{=post.title}}
>>>{{=post.**post}}
>>>{{=post.**created_on}}
>>>
>>> {{pass}}
>>>
>>> {{else:}}
>>>>> src="{{=URL('static','images/**carousel/%s'
>>> %(post.image))}}" alt="banner2" />
>>> {{=post.title}}
>>>{{=post.**post}}
>>>{{=post.**created_on}}
>>>
>>> {{pass}}
>>> {{pass}}
>>>   
>>>   >> href="#carousel-example-**generic" data-slide="prev">‹
>>>   >> href="#carousel-example-**generic" data-slide="next">›
>>> 
>>> 
>>>
>>> What could it be?
>>>
>>> Quarta-feira, 7 de Agosto de 2013 20:56:17 UTC+1, Roberto Perdomo
>>> escreveu:

 you forgot the ":" on the else and pass on the if. index var not exist,
 was my example, you need get the index of the iteration, may be with
 news.index(post) or using enumerate. Try this two example:

 
   
 >>> data-slide-to="0" class="active">
 >>> data-slide-to="1">
 >>> data-slide-to="2">
   
   
 {{for index, post in enumerate(news):}}
 {{if index==0:}}

{{=post.title}}
{{=post.**po**st}}
{{=post.**cre**ated_on}}

 {{pass}}
 {{else:}}
>>> src="{{=URL('static','images/**c**arousel/%s'
 %(post.image))}}" alt="banner2" />
 {{pass}}
 {{pass}}
   
   >>> href="#carousel-example-**generi**c" data-slide="prev">‹
   >>> href="#carousel-example-**generi**c" data-slide="next">›
 
 

 or:

 
   
 >>> data-slide-to="0" class="active">
 >>> data-slide-to="1">
 >>> data-slide-to="2">
   
   
 {{for post in news:}}
 {{if news.index(post)==0:}}

{{=post.title}}
{{=post.**po**st}}
{{=post.**cre**ated_on}}

 {{pass}}
 {{else:}}
>>> src="{{=URL('static','images/**c**arousel/%s'
 %(post.image))}}" alt="banner2" />
 {{pass}}
 {{pass}}
   
   >>> href="#carousel-example-**generi**c" data-slide="prev">‹
   >>> href="#carousel-example-**generi**c" data-slide="next">›
 
 

 Is an example, this was not tested


 2013/8/7 Hugo Costa 

 Hey Roberto!
>
> So, I've used your code and this turned out:
>
> *index.html*
> *
> *
> 
>
>   
>  data-slide-to="0" class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
> {{for post in news:}}
> {{if index==0:}}
>
>{{=post.title}}
>{{=post.**po**st}}
>{{=post.**cre**ated_on}}
>
> {{else}}
> src="{{=URL('static','images/carousel/%s'
> %(post.image))}}" alt="banner2" />
> {{pass}}
> {{pass}}
>   
>    href="#carousel-example-**generi**c" data-slide="prev">‹
>    href="#carousel-example-**generi**c" data-slide="next">›
> 
> 
>
>
> I don't understand why, but I'm getting this error:
>
>  inval

Re: [web2py] Cool "formstyle" trick w/Python lambda

2013-08-08 Thread António Ramos
Nice, post it in web2pyslices!!!


2013/8/8 Vinicius Assef 

> Excellent approach. :-)
>
> On Thu, Aug 8, 2013 at 3:11 PM, Joe  Barnhart 
> wrote:
> > So I'm a control-freak.  I mean that in a good way.  I discovered the
> beauty
> > of "placeholders" in forms and just thought "man, I really want that!"
>  But
> > where to hold the placeholder data?  And how do I get it to the SQLFORM
> > during form creation?
> >
> > At first I thought about adding YAV (yet another variable) to the Field
> > class.  But it's getting pretty crowded in there already, and mucking
> with
> > it means changes to the base, and the devs might object to a
> special-purpose
> > hack inserted into Field just to satisfy my whims.  So I thought I'd just
> > create my own formstyle function and use that.  But wait!  The formstyle
> > function has a defined signature now, and there is no place to insert
> > anything like a dictionary of placeholders indeded by field name.  Or is
> > there...
> >
> > I created my own formstyle function, but added a keyword parameter to the
> > end for the placeholders dict.  The signature looke like this:
> >
> >
> > def my_fieldstyle(form, fields, placeholders=None):
> > ...blah...
> >
> >
> > Now, the code in SQLFORM still has no idea that these placeholders exist.
> > But I can "wrap" this function with either a "partial function" or a
> simple
> > lambda to provide my own dictionary just before the customized formstyle
> > function is handed off to SQLFORM for it's main job.  It looks like this:
> >
> >
> > my_placeholder_dict = {'field1': 'place1', 'field2', 'place2'...}
> > ...
> > styler = lambda form, fields: my_fieldstyle(form, fields,
> > placeholders=my_placeholder_dict)
> > ...
> > form = SQLFORM(... formstyle=styler ...)
> >
> >
> > That's all there is to it!  Now I can pass abundant information into the
> > SQLFORM created, info that the base form creation has no idea exists.  My
> > own custom formstyle class can interpret the extra information and add
> all
> > kinds of special features.  Just a few ideas:
> >
> > 1.  Provide "placehloders" for phone and date fields to show proper
> format
> >
> > 2.  Provide dictionary of "field sets" with "legends" and create a
> > structured form organized the way I want
> >
> > 3.  ... and many many more!
> >
> > Best of all, it only needs stupid Python tricks and doesn't much with the
> > underlying structure of web2py at all!  No nasty stares from the devs!
> > (Just kidding...)
> >
> > -- Joe
> >
> > --
> >
> > ---
> > 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.
> >
> >
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Jonathan Lundell
On 8 Aug 2013, at 12:12 PM, Niphlod  wrote:
> Until now I assumed the problem of @Richard is that if a row has column == 
> None, if he queries the table with column != True he expected the NULL row to 
> show (because in python None is different from True).
> 
> ~db.table.column=False will result in a WHERE NOT column = 'F'. You don't get 
> any row holding column == None with that query.
> 
> What you said in your post
> 
> That would be false for False and true for True and None (NULL)
> 
> is what happens in python but not in any db backend, reason why it may seem 
> cumbersome to users accustomed to "compare" in python vs in databases.

Thanks for this. I've been puzzling over it myself the last couple of days. 
It'd be helpful if your explanation, or at least a summary of it, appeared in 
The Book.

Would .belongs() work as expected (over True/False/None)? 

-- 

--- 
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] Bootstrap Carousel and bootstrap

2013-08-08 Thread Hugo Costa
You sir, made my day.

Thanks a lot Roberto! :)

Quinta-feira, 8 de Agosto de 2013 20:33:45 UTC+1, Roberto Perdomo escreveu:
>
> The {{pass}} of the if is not needed :-S
>
>
> 2013/8/8 Hugo Costa >
>
>> Yeah, I have. 3 is the magic number :)
>>
>> I did not understand this question.
>>
>> The third is missing 
>>
>> 
>> 
>>
>> 
>>> src="/diogo/static/images/carousel/carousel3.jpg" alt="banner1">
>>Azeite Vinaldo
>>Guache sobre Tela, 75x30 cm.
>>2013-08-07 18:03:38.774240
>>  
>>> src="/diogo/static/images/carousel/carousel1.jpg" alt="banner2">
>> Bezegaio Frito
>>Acrilico sobre Tela, 45x40 
>> cm
>>2013-08-07 17:52:27.399172
>>
>> 
>> 
>>   
>>
>> The code in the source in browser.
>>
>> Quinta-feira, 8 de Agosto de 2013 19:43:36 UTC+1, Roberto Perdomo 
>> escreveu:
>>>
>>> Good news!
>>>
>>> You really have three post?
>>> Can you print the three posts in a .html without carousel?
>>> You have checked the source of your index.html (in the browser) and 
>>> search the three div inside "carousel-inner"?
>>>
>>>
>>> 2013/8/8 Hugo Costa 
>>>
>>> Sorry about the delay.

 The first one works fine, but only works for the first and the second.

 The code I used is:

 *index.html*
 *
 *
 
   
 >>> data-slide-to="0" class="active">
 >>> data-slide-to="1">
 >>> data-slide-to="2">
   
   
  {{for index, post in enumerate(news):}}

 {{if index==0:}}

{{=post.title}}
{{=post.**post}}
{{=post.**created_on}}

 {{pass}}

 {{else:}}
>>> src="{{=URL('static','images/**carousel/%s' 
 %(post.image))}}" alt="banner2" />
 {{=post.title}}
{{=post.**post}}
{{=post.**created_on}}

 {{pass}}
 {{pass}}
   
   >>> href="#carousel-example-**generic" data-slide="prev">‹
   >>> href="#carousel-example-**generic" data-slide="next">›
 
 

 What could it be? 

 Quarta-feira, 7 de Agosto de 2013 20:56:17 UTC+1, Roberto Perdomo 
 escreveu:
>
> you forgot the ":" on the else and pass on the if. index var not 
> exist, was my example, you need get the index of the iteration, may be 
> with 
> news.index(post) or using enumerate. Try this two example:
>
> 
>   
>  data-slide-to="0" class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
> {{for index, post in enumerate(news):}}
> {{if index==0:}}
>
>{{=post.title}}
>{{=post.**po**st}}
>{{=post.**cre**ated_on}}
>
> {{pass}}
> {{else:}}
> src="{{=URL('static','images/**c**arousel/%s' 
> %(post.image))}}" alt="banner2" />
> {{pass}}
> {{pass}}
>   
>    href="#carousel-example-**generi**c" data-slide="prev">‹
>    href="#carousel-example-**generi**c" data-slide="next">›
> 
> 
>
> or:
>
> 
>   
>  data-slide-to="0" class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
> {{for post in news:}}
> {{if news.index(post)==0:}}
>
>{{=post.title}}
>{{=post.**po**st}}
>{{=post.**cre**ated_on}}
>
> {{pass}}
> {{else:}}
> src="{{=URL('static','images/**c**arousel/%s' 
> %(post.image))}}" alt="banner2" />
> {{pass}}
> {{pass}}
>   
>    href="#carousel-example-**generi**c" data-slide="prev">‹
>    href="#carousel-example-**generi**c" data-slide="next">›
> 
> 
>
> Is an example, this was not tested
>
>
> 2013/8/7 Hugo Costa 
>
> Hey Roberto!
>>
>> So, I've used your code and this turned out:
>>
>> *index.html*
>> *
>> *
>> 
>>
>>   
>> > data-slide-to="0" class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for post in news:}}
>> {{if index==0:}}
>>>  src="{{=URL('static','images/carousel/%s' %(post.image))}}" 
>> alt="banner1" />
>>{{=post.title}}
>>{{=post.**po**st}}
>>{{=p

Re: [web2py] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Richard Vézina
I have been quite puzzled with .belongs() in the pass... I don't remember
exactly was the cause of my problem at that time, I think it was if I was
passing a list to .belongs() and it was empty. I think I had asking about
that and get a answer from Niphold to... Let me searche that...

Richard


On Thu, Aug 8, 2013 at 3:44 PM, Jonathan Lundell  wrote:

> On 8 Aug 2013, at 12:12 PM, Niphlod  wrote:
>
> Until now I assumed the problem of @Richard is that if a row has column ==
> None, if he queries the table with column != True he expected the NULL row
> to show (because in python None is different from True).
>
> ~db.table.column=False will result in a WHERE NOT column = 'F'. You don't
> get any row holding column == None with that query.
>
> What you said in your post
>
> That would be false for False and true for True and None (NULL)
>>
>
> is what happens in python but not in any db backend, reason why it may
> seem cumbersome to users accustomed to "compare" in python vs in databases.
>
>
> Thanks for this. I've been puzzling over it myself the last couple of
> days. It'd be helpful if your explanation, or at least a summary of it,
> appeared in The Book.
>
> Would .belongs() work as expected (over True/False/None)?
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Richard Vézina
Here :

https://groups.google.com/d/msg/web2py/hQGyg6fL1Ls/zhxcWg7BsjYJ

Was a type issue...

Richard


On Thu, Aug 8, 2013 at 3:47 PM, Richard Vézina
wrote:

> I have been quite puzzled with .belongs() in the pass... I don't remember
> exactly was the cause of my problem at that time, I think it was if I was
> passing a list to .belongs() and it was empty. I think I had asking about
> that and get a answer from Niphold to... Let me searche that...
>
> Richard
>
>
> On Thu, Aug 8, 2013 at 3:44 PM, Jonathan Lundell wrote:
>
>> On 8 Aug 2013, at 12:12 PM, Niphlod  wrote:
>>
>> Until now I assumed the problem of @Richard is that if a row has column
>> == None, if he queries the table with column != True he expected the NULL
>> row to show (because in python None is different from True).
>>
>> ~db.table.column=False will result in a WHERE NOT column = 'F'. You don't
>> get any row holding column == None with that query.
>>
>> What you said in your post
>>
>>  That would be false for False and true for True and None (NULL)
>>>
>>
>> is what happens in python but not in any db backend, reason why it may
>> seem cumbersome to users accustomed to "compare" in python vs in databases.
>>
>>
>> Thanks for this. I've been puzzling over it myself the last couple of
>> days. It'd be helpful if your explanation, or at least a summary of it,
>> appeared in The Book.
>>
>> Would .belongs() work as expected (over True/False/None)?
>>
>> --
>>
>> ---
>> 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.
>>
>>
>>
>
>

-- 

--- 
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: using contains operator with reference types

2013-08-08 Thread Massimo Di Pierro
This

rows = db(db.zoo.tier == 2).select()

is equivalent to

rows = db(db.zoo.tier.belongs([2])).select()

you can do

rows = db(db.zoo.tier.belongs([2, 3])).select()


On Thursday, 8 August 2013 14:28:47 UTC-5, dave wrote:
>
> I have two tables defined as follows
>
> db.define_table('animals', 
> Field('type'),
> format='%(type)s')
>
> db.define_table('zoo', 
> Field('name'), 
> Field('tier', 'reference animals'),
> format='%(name)s' 
> ) 
>
> field type is a column with values like, test 1, test 2, test 3
> now if I want to select all the records of table zoo with 'test 2' I can 
> do something like this 
>
> rows = db(db.zoo.tier == "2").select()
>
> but why can't I do something like 
> db(db.zoo.tier.contains("2")).select() or
> pass a list  ["2", "3"] to the contains operator to get all the records of 
> "test 2" and "test 3"? can you suggest another way of implementing this?
>

-- 

--- 
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] Bootstrap Carousel and bootstrap

2013-08-08 Thread Roberto Perdomo
dont worry, it's a pleasure for me. ;-)

Kind Regards.


2013/8/8 Hugo Costa 

> You sir, made my day.
>
> Thanks a lot Roberto! :)
>
> Quinta-feira, 8 de Agosto de 2013 20:33:45 UTC+1, Roberto Perdomo escreveu:
>>
>> The {{pass}} of the if is not needed :-S
>>
>>
>> 2013/8/8 Hugo Costa 
>>
>> Yeah, I have. 3 is the magic number :)
>>>
>>> I did not understand this question.
>>>
>>> The third is missing
>>>
>>> 
>>>
>>>
>>>
>>>>> src="/diogo/static/images/**carousel/carousel3.jpg"
>>> alt="banner1">
>>>Azeite Vinaldo
>>>Guache sobre Tela, 75x30
>>> cm.
>>>2013-08-07 18:03:38.774240
>>>
>>>>> src="/diogo/static/images/**carousel/carousel1.jpg"
>>> alt="banner2">
>>> Bezegaio Frito
>>>Acrilico sobre Tela, 45x40
>>> cm
>>>2013-08-07 17:52:27.399172
>>>
>>>
>>>
>>>   
>>>
>>> The code in the source in browser.
>>>
>>> Quinta-feira, 8 de Agosto de 2013 19:43:36 UTC+1, Roberto Perdomo
>>> escreveu:

 Good news!

 You really have three post?
 Can you print the three posts in a .html without carousel?
 You have checked the source of your index.html (in the browser) and
 search the three div inside "carousel-inner"?


 2013/8/8 Hugo Costa 

 Sorry about the delay.
>
> The first one works fine, but only works for the first and the second.
>
> The code I used is:
>
> *index.html*
> *
> *
> 
>   
>  data-slide-to="0" class="active">
>  data-slide-to="1">
>  data-slide-to="2">
>   
>   
>  {{for index, post in enumerate(news):}}
>
> {{if index==0:}}
>
>{{=post.title}}
>{{=post.**po**st}}
>{{=post.**cre**ated_on}}
>
> {{pass}}
>
> {{else:}}
> src="{{=URL('static','images/carousel/%s'
> %(post.image))}}" alt="banner2" />
> {{=post.title}}
>{{=post.**po**st}}
>{{=post.**cre**ated_on}}
>
> {{pass}}
> {{pass}}
>   
>    href="#carousel-example-**generi**c" data-slide="prev">‹
>    href="#carousel-example-**generi**c" data-slide="next">›
> 
> 
>
> What could it be?
>
> Quarta-feira, 7 de Agosto de 2013 20:56:17 UTC+1, Roberto Perdomo
> escreveu:
>>
>> you forgot the ":" on the else and pass on the if. index var not
>> exist, was my example, you need get the index of the iteration, may be 
>> with
>> news.index(post) or using enumerate. Try this two example:
>>
>> 
>>   
>> > data-slide-to="0" class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for index, post in enumerate(news):}}
>> {{if index==0:}}
>>> src="{{=URL('static','images/**carousel/%s' %(post.image))}}"
>> alt="banner1" />
>>{{=post.title}}
>>{{=post.**post}}
>>{{=post.**cre
>> ated_on}}
>>
>> {{pass}}
>> {{else:}}
>>
>> {{pass}}
>> {{pass}}
>>   
>>   > href="#carousel-example-**generic" data-slide="prev">‹
>>   > href="#carousel-example-**generic" data-slide="next">›
>> 
>> 
>>
>> or:
>>
>> 
>>   
>> > data-slide-to="0" class="active">
>> > data-slide-to="1">
>> > data-slide-to="2">
>>   
>>   
>> {{for post in news:}}
>> {{if news.index(post)==0:}}
>>> src="{{=URL('static','images/**carousel/%s' %(post.image))}}"
>> alt="banner1" />
>>{{=post.title}}
>>{{=post.**post}}
>>{{=post.**cre
>> ated_on}}
>>
>> {{pass}}
>> {{else:}}
>>
>> {{pass}}
>> {{pass}}
>>   
>>   > href="#carousel-example-**generic" data-slide="prev">‹
>>   > href="#carousel-example-**generic" data-slide="next">›
>> 
>> 
>>
>> Is an example, this was not tested
>>
>>
>> 2013/8/7 Hugo Costa 
>>
>> Hey Roberto!
>>>
>>> So, I've used your code and this turned out:
>>>
>>> *index.html*
>>> *
>>> *
>>> 
>>>
>>>   
>>> >> data-slide-to="0" class="active">
>>> >> data-slide-to="1">
>>> >> data-slide-to="2">
>>>   
>>>

[web2py] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread Richard
Hello,

http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/

:)

Richard

-- 

--- 
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: Cool "formstyle" trick w/Python lambda

2013-08-08 Thread Anthony
Nice. I think we should add an argument to Field() that takes a dictionary 
of args to pass to the field's widget (or maybe just add **kwargs to 
Field() and pass kwargs to the widget). For now, though, if that's all you 
want to do, you can do something like this:

def widget(**kwargs):
return lambda field, value, kwargs=kwargs: SQLFORM.widgets[field.type].
widget(field, value, **kwargs)

db.define_table('mytable',
Field('myfield', widget=widget(_placeholder='my placeholder', _readonly=
True)))

That should work for most fields -- would need some additional logic to 
accommodate fields that involve special widgets (e.g., fields with an 
IS_IN_DB validator that automatically get an options widget).

Anthony

On Thursday, August 8, 2013 2:11:44 PM UTC-4, Joe Barnhart wrote:
>
> So I'm a control-freak.  I mean that in a good way.  I discovered the 
> beauty of "placeholders" in forms and just thought "man, I really want 
> that!"  But where to hold the placeholder data?  And how do I get it to the 
> SQLFORM during form creation?
>
> At first I thought about adding YAV (yet another variable) to the Field 
> class.  But it's getting pretty crowded in there already, and mucking with 
> it means changes to the base, and the devs might object to a 
> special-purpose hack inserted into Field just to satisfy my whims.  So I 
> thought I'd just create my own formstyle function and use that.  But wait! 
>  The formstyle function has a defined signature now, and there is no place 
> to insert anything like a dictionary of placeholders indexed by field name. 
>  Or is there?
>
> I created my own formstyle function, but added a keyword parameter to the 
> end for the placeholders dict.  The signature looke like this:
>
>
> def my_fieldstyle(form, fields, placeholders=None):
> ...blah...
>
>
> Now, the code in SQLFORM still has no idea that these placeholders exist. 
>  But I can "wrap" this function with either a "partial function" or a 
> simple lambda to provide my own dictionary just before the customized 
> formstyle function is handed off to SQLFORM for it's main job.  It looks 
> like this:
>
>
> my_placeholder_dict = {'field1': 'place1', 'field2', 'place2'...}
> ...
> styler = lambda form, fields: my_fieldstyle(form, fields, 
> placeholders=my_placeholder_dict)
> ...
> form = SQLFORM(... formstyle=styler ...)
>  
>
> That's all there is to it!  Now I can pass abundant information into the 
> SQLFORM creation, info that the base form creation has no idea exists.  My 
> own custom formstyle class can interpret the extra information and add all 
> kinds of special features.  Just a few ideas:
>
> 1.  Provide "placehloders" for phone and date fields to show proper format
>
> 2.  Provide dictionary of "field sets" with "legends" and create a 
> structured form organized the way I want
>
> 3.  ... and many many more!
>
> Best of all, it only needs stupid Python tricks and doesn't muck with the 
> underlying structure of web2py at all!  No nasty stares from the devs! 
>  (Just kidding...)
>
> -- Joe
>

-- 

--- 
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] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread Richard Vézina
http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29

30 days free from july 29

But it not even as stable as a beta... Be aware.

Richard


On Thu, Aug 8, 2013 at 3:56 PM, Richard  wrote:

> Hello,
>
> http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/
>
> :)
>
> Richard
>
> --
>
> ---
> 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.
>
>
>

-- 

--- 
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] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread Robert O'Connor
EAP is fine.  I use it all the time.
On Aug 8, 2013 4:04 PM, "Richard Vézina" 
wrote:

>
> http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29
>
> 30 days free from july 29
>
> But it not even as stable as a beta... Be aware.
>
> Richard
>
>
> On Thu, Aug 8, 2013 at 3:56 PM, Richard wrote:
>
>> Hello,
>>
>> http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/
>>
>> :)
>>
>> Richard
>>
>> --
>>
>> ---
>> 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.
>>
>>
>>
>
>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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: Some typos (routes.py)

2013-08-08 Thread Martin Weissenboeck
Let's say I have a tuple like

(r'.*:https?://q.q.mysite.org.* (?P.*)', ...)
It will match both qqq.mysite.org and q.q.mysite.org

(r'.*:https?://q\.q\.mysite\.org.* (?P.*)', ...)
matches only q.q.mysite.org  (which is intended)

('.*:https?://q\\.q\\.mysite\\.org.* (?P.*)', ...)
Yes, I know, without "r" it's necessary to double the "\"

Therefore I think the second line would be the best solution.

Ok, I'll open an issue.


2013/8/8 Jonathan Lundell 

> On 7 Aug 2013, at 3:19 PM, Niphlod  wrote:
>
> ok for the book, but routes.py is ok.
> if you notice, there's the r in front of the string that r means
> "string literal", as in "literally this string", so \n, \t, etc don't get
> interpreted and quoting isn't necessary (because it gets interpreted as a
> byte string and not a string)
> Actually, while working with regexes, it's quite handy to have r at
> handas you noticed the syntax gets increasingly crispy if you choose to
> not use string literals.
> This is explained in detail on http://docs.python.org/2/library/re.html
>
>
> Still need to escape dots, though.
>
> And the extra parens in routes.example.py look wrong.
>
>
> On Thursday, August 8, 2013 12:09:50 AM UTC+2, LightDot wrote:
>>
>> Best thing to do would be to open an issue on Google code and either
>> attach a patch or make a pull request on Github.
>>
>> Forum posts can get overlooked and/or forgotten...
>>
>> Regards,
>> Ales
>>
>> On Wednesday, August 7, 2013 3:17:01 PM UTC+2, mweissen wrote:
>>>
>>> About routes.py
>>>
>>> I have tried to use routes.py. After some hours I have found errors in
>>> the book and in routes.example.py:
>>>
>>> --**--**
>>> --
>>>
>>> In the book, chapter "URL rewrite":
>>>
>>> The general syntax for routes is more complex than the simple examples
>>> we have seen so far. Here is a more general and representative example:
>>>
>>> routes_in = (
>>>  ('140.191.\d+.\d+:https?://**www.web2py.com:post /(?P.*).php',
>>>   '/test/default/index?vars=\g<**any>'),
>>> )
>>>
>>> It maps http or https POST requests (note lower case "post") to host
>>> www.web2py.com from a remote IP matching the regular expression
>>>
>>> '140.191.\d+.\d+'
>>>
>>> The first part is a regular expression. I think, it should read:
>>>
>>>
>>> The general syntax for routes is more complex than the simple examples
>>> we have seen so far. Here is a more general and representative example:
>>> routes_in = ( ('140\.191\.\d+\.\d+:https?://**www\.web2py\.com:post
>>> /(?P.*).php', '/test/default/index?vars=\g<**any>'), )
>>>
>>> It maps http or https POST requests (note lower case "post") to host
>>> www.web2py.com from a remote IP matching the regular expression
>>> '140\.191\.\d+\.\d+'
>>>
>>
>
>
>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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: using contains operator with reference types

2013-08-08 Thread dave
ok that works but I have one other question, how would I use the belongs 
operator If I want to refer a field by a name for example
instead of rows = db(db.zoo.tier.belongs([2, 3])).select()  I want to do 
this
   rows = db(db.zoo.tier.belongs(["test 2", "test 
3"])).select()  ?

On Thursday, August 8, 2013 12:51:12 PM UTC-7, Massimo Di Pierro wrote:
>
> This
>
> rows = db(db.zoo.tier == 2).select()
>
> is equivalent to
>
> rows = db(db.zoo.tier.belongs([2])).select()
>
> you can do
>
> rows = db(db.zoo.tier.belongs([2, 3])).select()
>
>
> On Thursday, 8 August 2013 14:28:47 UTC-5, dave wrote:
>>
>> I have two tables defined as follows
>>
>> db.define_table('animals', 
>> Field('type'),
>> format='%(type)s')
>>
>> db.define_table('zoo', 
>> Field('name'), 
>> Field('tier', 'reference animals'),
>> format='%(name)s' 
>> ) 
>>
>> field type is a column with values like, test 1, test 2, test 3
>> now if I want to select all the records of table zoo with 'test 2' I can 
>> do something like this 
>>
>> rows = db(db.zoo.tier == "2").select()
>>
>> but why can't I do something like 
>> db(db.zoo.tier.contains("2")).select() or
>> pass a list  ["2", "3"] to the contains operator to get all the records 
>> of "test 2" and "test 3"? can you suggest another way of implementing this?
>>
>

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Em 08-08-2013 20:23, Ricardo Pedroso escreveu:
> On Thu, Aug 8, 2013 at 2:36 PM, Carlos Correia  > wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Hi,
> 
> I'm facing a bug when I redirect to another controller, that redirects 
> the user
> to the login prompt, after having been authenticated.
> 
> 
> It's hard to tell what the problem is but for me it seems that web2py is 
> failing
> to load the
> session data.
> If you dont mind to tweak your gluon/globals.py you could add a raise 
> statement
> to reraise some exceptions that are been swallowed when web2py tries to load 
> the
> session data.

And where/how should I do that?

> But again, this is just a guess...
> 
> You can try also to delete your browser session cookie.
> 
> Sometimes when weird thinks happens, restarting webserver, and as a last
> resource restarting the server,
> can help.
> 

Done all of those... no results.

- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlID/gwACgkQ90uzwjA1SJXl7QCdHe/Fi8us4kOGDjxAZ73CViSy
UnQAnilTwcGCR4xDpHioID5XECZiazCG
=Itom
-END PGP SIGNATURE-

-- 

--- 
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] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread dave
how do you debug though, I tried setting breakpoints but it would not break 
when debugging it?

On Thursday, August 8, 2013 1:08:31 PM UTC-7, Robert O'Connor wrote:
>
> EAP is fine.  I use it all the time.
> On Aug 8, 2013 4:04 PM, "Richard Vézina" > 
> wrote:
>
>>
>> http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29
>>
>> 30 days free from july 29
>>
>> But it not even as stable as a beta... Be aware.
>>
>> Richard
>>
>>
>> On Thu, Aug 8, 2013 at 3:56 PM, Richard 
>> > wrote:
>>
>>> Hello,
>>>
>>> http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/
>>>
>>> :)
>>>
>>> Richard
>>>
>>> -- 
>>>  
>>> --- 
>>> 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.
>>>  
>>>  
>>>
>>
>>  -- 
>>  
>> --- 
>> 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.
>>  
>>  
>>
>

-- 

--- 
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] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread Richard Vézina
I just install it and it seems stable enough...

I am not sure how to create project of type web2py... They say just open an
app direcotry, but it not working... I use to have already a pycharm
project for this app and can't figure how or if it possible to change the
project type..

I can't see web2py lib just external lib, so I guess pycharm not offert
support for web2py if you don't set the project type properly.



Richard


On Thu, Aug 8, 2013 at 4:08 PM, Robert O'Connor wrote:

> EAP is fine.  I use it all the time.
> On Aug 8, 2013 4:04 PM, "Richard Vézina" 
> wrote:
>
>>
>> http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29
>>
>> 30 days free from july 29
>>
>> But it not even as stable as a beta... Be aware.
>>
>> Richard
>>
>>
>> On Thu, Aug 8, 2013 at 3:56 PM, Richard wrote:
>>
>>> Hello,
>>>
>>> http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/
>>>
>>> :)
>>>
>>> Richard
>>>
>>> --
>>>
>>> ---
>>> 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.
>>>
>>>
>>>
>>
>>  --
>>
>> ---
>> 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.
>>
>>
>>
>  --
>
> ---
> 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.
>
>
>

-- 

--- 
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] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread Richard Vézina
Ok, I figure it out. Create a new project, select existing app and say ok,
then pycharm will prompt and say there is already file in app and ask if we
want to load instead of creating a new app say ok!

But seems that pycharm still not recognize gluon stuff...

Richard


On Thu, Aug 8, 2013 at 4:32 PM, Richard Vézina
wrote:

> I just install it and it seems stable enough...
>
> I am not sure how to create project of type web2py... They say just open
> an app direcotry, but it not working... I use to have already a pycharm
> project for this app and can't figure how or if it possible to change the
> project type..
>
> I can't see web2py lib just external lib, so I guess pycharm not offert
> support for web2py if you don't set the project type properly.
>
>
>
> Richard
>
>
> On Thu, Aug 8, 2013 at 4:08 PM, Robert O'Connor 
> wrote:
>
>> EAP is fine.  I use it all the time.
>> On Aug 8, 2013 4:04 PM, "Richard Vézina" 
>> wrote:
>>
>>>
>>> http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29
>>>
>>> 30 days free from july 29
>>>
>>> But it not even as stable as a beta... Be aware.
>>>
>>> Richard
>>>
>>>
>>> On Thu, Aug 8, 2013 at 3:56 PM, Richard wrote:
>>>
 Hello,

 http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/

 :)

 Richard

 --

 ---
 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.



>>>
>>>  --
>>>
>>> ---
>>> 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.
>>>
>>>
>>>
>>  --
>>
>> ---
>> 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.
>>
>>
>>
>
>

-- 

--- 
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] PyCharm 3.0 EAP web2py support!!

2013-08-08 Thread dave
can you debug? I can set breakpoints but it does not break or allow me to 
inspect variables. did you encounter this problem too?

On Thursday, August 8, 2013 1:41:12 PM UTC-7, Richard wrote:
>
> Ok, I figure it out. Create a new project, select existing app and say ok, 
> then pycharm will prompt and say there is already file in app and ask if we 
> want to load instead of creating a new app say ok!
>
> But seems that pycharm still not recognize gluon stuff...
>
> Richard
>
>
> On Thu, Aug 8, 2013 at 4:32 PM, Richard Vézina 
> 
> > wrote:
>
>> I just install it and it seems stable enough...
>>
>> I am not sure how to create project of type web2py... They say just open 
>> an app direcotry, but it not working... I use to have already a pycharm 
>> project for this app and can't figure how or if it possible to change the 
>> project type..
>>
>> I can't see web2py lib just external lib, so I guess pycharm not offert 
>> support for web2py if you don't set the project type properly.
>>
>>
>>
>> Richard
>>
>>
>> On Thu, Aug 8, 2013 at 4:08 PM, Robert O'Connor 
>> 
>> > wrote:
>>
>>> EAP is fine.  I use it all the time.
>>> On Aug 8, 2013 4:04 PM, "Richard Vézina" 
>>> > 
>>> wrote:
>>>

 http://confluence.jetbrains.com/display/PYH/JetBrains+PyCharm+Preview+%28EAP%29

 30 days free from july 29

 But it not even as stable as a beta... Be aware.

 Richard


 On Thu, Aug 8, 2013 at 3:56 PM, Richard 
 > wrote:

> Hello,
>
> http://blog.jetbrains.com/pycharm/2013/06/meet-pycharm-3-0-eap/
>
> :)
>
> Richard
>
> -- 
>  
> --- 
> 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.
>  
>  
>

  -- 
  
 --- 
 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.
  
  

>>>  -- 
>>>  
>>> --- 
>>> 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.
>>>  
>>>  
>>>
>>
>>
>

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Niphlod
another piece of examples
 
>>> for row in db(db.thenulltest.thenullablefield.belongs([True])).select(): 
print row
... 

>>> for row in db(db.thenulltest.thenullablefield.belongs([True,False])).
select(): print row
... 


>>> for row in db(db.thenulltest.thenullablefield.belongs([True,False,None
])).select(): print row
... 


>>> for row in db(db.thenulltest.thenullablefield.belongs([None])).select(): 
print row
... 
>>> 



-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Niphlod


> Thanks for this. I've been puzzling over it myself the last couple of 
> days. It'd be helpful if your explanation, or at least a summary of it, 
> appeared in The Book.
>
> Would .belongs() work as expected (over True/False/None)? 
>

Yep. Think to belongs() (that translates to an IN clause) as a handy 
decorator over OR-ifying your list of values  the problem is that the 
"ORification" just does
column = value OR column = othervalue OR 

Now, the real demistyfication gets to the bottom.t-sql standards 
dictate that any comparison (=, <>, etc) against a NULL value evaluates to 
False (don't blame backends engineers: Codd invented the relational model, 
bottomline: Codd is a superhero).

Although it doesn't raise an error, querying
WHERE column = NULL
doesn't return any result (unless you force a 
really-its-going-to-be-superdeprecated-dont-do-that-youre-going-to-hell 
mode in some backends)

So, 
WHERE column IN (NULL, othervalue)
doesn't return NULL columns either...

Working as a DBA often side-by-side with coders, I often quote the 
following (don't really know who is the original author, multiple sources 
report it). It kinda represent at best the really different mindsets ^_^
Q(dba): what is NULL?
A(coder): a NULL value
A(dba): Nope, it isn't a value

This is the rally short story. 
The long one is basically on the lines of "its there since the beginning, 
lets don't get messy", but its explained really well in the wikipedia 
article https://en.wikipedia.org/wiki/Null_%28SQL%29 . If you reach the end 
alive, you may laugh once or twice in the process but hey, you're 
definitely not alone.

-- 

--- 
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: using contains operator with reference types

2013-08-08 Thread Niphlod
you join them first and then you belong() on the type column.

db(
(db.zoo.tier == db.animals.id) &
(db.animals.type.belongs(['test1', 'test2']))
).select(db.zoo.ALL)


On Thursday, August 8, 2013 10:19:47 PM UTC+2, dave wrote:
>
> ok that works but I have one other question, how would I use the belongs 
> operator If I want to refer a field by a name for example
> instead of rows = db(db.zoo.tier.belongs([2, 3])).select()  I want to do 
> this
>rows = db(db.zoo.tier.belongs(["test 2", "test 
> 3"])).select()  ?
>
> On Thursday, August 8, 2013 12:51:12 PM UTC-7, Massimo Di Pierro wrote:
>>
>> This
>>
>> rows = db(db.zoo.tier == 2).select()
>>
>> is equivalent to
>>
>> rows = db(db.zoo.tier.belongs([2])).select()
>>
>> you can do
>>
>> rows = db(db.zoo.tier.belongs([2, 3])).select()
>>
>>
>> On Thursday, 8 August 2013 14:28:47 UTC-5, dave wrote:
>>>
>>> I have two tables defined as follows
>>>
>>> db.define_table('animals', 
>>> Field('type'),
>>> format='%(type)s')
>>>
>>> db.define_table('zoo', 
>>> Field('name'), 
>>> Field('tier', 'reference animals'),
>>> format='%(name)s' 
>>> ) 
>>>
>>> field type is a column with values like, test 1, test 2, test 3
>>> now if I want to select all the records of table zoo with 'test 2' I can 
>>> do something like this 
>>>
>>> rows = db(db.zoo.tier == "2").select()
>>>
>>> but why can't I do something like 
>>> db(db.zoo.tier.contains("2")).select() or
>>> pass a list  ["2", "3"] to the contains operator to get all the records 
>>> of "test 2" and "test 3"? can you suggest another way of implementing this?
>>>
>>

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Michele Comitini
Is BizDoc pickable?


2013/8/8 Carlos Correia 

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Em 08-08-2013 20:23, Ricardo Pedroso escreveu:
> > On Thu, Aug 8, 2013 at 2:36 PM, Carlos Correia <
> car...@memoriapersistente.pt
> > > wrote:
> >
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Hi,
> >
> > I'm facing a bug when I redirect to another controller, that
> redirects the user
> > to the login prompt, after having been authenticated.
> >
> >
> > It's hard to tell what the problem is but for me it seems that web2py is
> failing
> > to load the
> > session data.
> > If you dont mind to tweak your gluon/globals.py you could add a raise
> statement
> > to reraise some exceptions that are been swallowed when web2py tries to
> load the
> > session data.
>
> And where/how should I do that?
>
> > But again, this is just a guess...
> >
> > You can try also to delete your browser session cookie.
> >
> > Sometimes when weird thinks happens, restarting webserver, and as a last
> > resource restarting the server,
> > can help.
> >
>
> Done all of those... no results.
>
> - --
> Com os melhores cumprimentos,
>
> Carlos Correia
> =
> MEMÓRIA PERSISTENTE
> Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
> e-mail: ge...@memoriapersistente.pt - URL:
> http://www.memoriapersistente.pt
> Jabber: m...@jabber.org
> GnuPG: wwwkeys.eu.pgp.net
> URL Suporte: https://t5.m16e.com/gps
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.12 (GNU/Linux)
> Comment: Using GnuPG with undefined - http://www.enigmail.net/
>
> iEYEARECAAYFAlID/gwACgkQ90uzwjA1SJXl7QCdHe/Fi8us4kOGDjxAZ73CViSy
> UnQAnilTwcGCR4xDpHioID5XECZiazCG
> =Itom
> -END PGP SIGNATURE-
>
> --
>
> ---
> 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.
>

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Ricardo Pedroso
On Thu, Aug 8, 2013 at 9:22 PM, Carlos Correia  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Em 08-08-2013 20:23, Ricardo Pedroso escreveu:
> > On Thu, Aug 8, 2013 at 2:36 PM, Carlos Correia <
> car...@memoriapersistente.pt
> > > wrote:
> >
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Hi,
> >
> > I'm facing a bug when I redirect to another controller, that
> redirects the user
> > to the login prompt, after having been authenticated.
> >
> >
> > It's hard to tell what the problem is but for me it seems that web2py is
> failing
> > to load the
> > session data.
> > If you dont mind to tweak your gluon/globals.py you could add a raise
> statement
> > to reraise some exceptions that are been swallowed when web2py tries to
> load the
> > session data.
>
> And where/how should I do that?
>

Depends on what kind of sessions you use, supposing you are using file
sessions:
in gluon/globals.py around line 674 you have this:


try:
response.session_file = \
open(response.session_filename, 'rb+')
try:
portalocker.lock(response.session_file,
 portalocker.LOCK_EX)
response.session_locked = True
self.update(cPickle.load(response.session_file))
response.session_file.seek(0)
oc = response.session_filename.split('/')[-1]\
.split('-')[0]
if check_client and client != oc:
raise Exception("cookie attack")
except:
response.session_id = None
finally:
pass
#This causes admin login to break. Must find out
why.
#self._close(response)
except:
response.session_file = None
if not response.session_id:


After those two except's append a line with raise
eg:

except:
raise

This will reraise any exception that may happen.


Ricardo

-- 

--- 
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] bizzard issue with postgres web2py select IMPORTANT

2013-08-08 Thread Jonathan Lundell
On 8 Aug 2013, at 1:47 PM, Niphlod  wrote:
> Although it doesn't raise an error, querying
> WHERE column = NULL
> doesn't return any result (unless you force a 
> really-its-going-to-be-superdeprecated-dont-do-that-youre-going-to-hell mode 
> in some backends)

OK, that was confusing me, until I realized that web2py translates 'var == 
None' to var IS NULL, not var = NULL.

Oy.

Reminds me of NaN.


> 
> So, 
> WHERE column IN (NULL, othervalue)
> doesn't return NULL columns either...


-- 

--- 
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: Pass python list back to controller

2013-08-08 Thread Kyle Flanagan
This worked well. Thanks.

On Thursday, July 18, 2013 11:18:23 AM UTC-5, Ykä Marjanen wrote:
>
> Hi,
>
> If I understood correctly, you could use 'session' to save the list, so 
> you don't have to pass it back and forth to the controller.
>
> E.g. session.serials = [] and then session.serials.append(x)
>
> Ykä
>
> On Thursday, July 18, 2013 6:55:52 PM UTC+3, Kyle Flanagan wrote:
>>
>> What's the best way to pass a Python list back to the controller, i.e. 
>> keep the list object persistent between calls? The list could get quite 
>> large so I'm not sure if request.args or request.vars is appropriate for it 
>> (well the items in the list)? The code below is a mockup of what I'm trying 
>> to achieve. The list in question is 'serials.' 
>>
>> @auth.requires_login()
>> def send():
>> """
>> Method for 'sending'an IBC tote to a location.
>> """
>> try:
>> if serials:
>> pass
>> except:
>> serials = list()
>> 
>> if request.vars["location_id"]:
>> if request.vars["serial_number"]:
>> # update the location
>> serials.append(request.vars["serial_number"])
>>
>> # start accepting input to update IBC's to this location
>> status = "Location: " + db.MyLocation[request.vars['location_id'
>> ]].name
>> form = SQLFORM.factory(Field('Object_serial_number', requires=
>> IS_IN_DB(db, 'Object.serial_number', '%(serial_number)s', orderby=db.
>> Object.serial_number)))
>> if form.process().accepted:
>> response.flash = form.vars.Object_serial_number
>> redirect(URL('send', vars=dict(location_id=request.vars[
>> "location_id"], serial_number=form.vars.Object_serial_number)))
>> else:
>> # we need to pick a location
>> form = SQLFORM.factory(Field('send_location', requires=IS_IN_DB(
>> db, 'MyLocation.id', '%(name)s', orderby=db.MyLocation.name)))
>> if form.process().accepted:
>> response.flash = form.vars.send_location
>> redirect(URL('send', vars=dict(location_id=form.vars.
>> send_location)))
>> status = "No location"
>> 
>> return dict(grid=form, status=status, serials=serials, count=len(
>> serials))
>>
>> Basically, the user goes to the 'send' controller, picks a location, then 
>> enters serial numbers. I'd like to keep a list going so that the user can 
>> remove a serial number from the list if they added one in error and then 
>> submit them for updating all at once.
>>
>

-- 

--- 
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: using contains operator with reference types

2013-08-08 Thread dave
is there another way to do it, because this replaces my db.zoo.tier field 
with the id

On Thursday, August 8, 2013 1:55:48 PM UTC-7, Niphlod wrote:
>
> you join them first and then you belong() on the type column.
>
> db(
> (db.zoo.tier == db.animals.id) &
> (db.animals.type.belongs(['test1', 'test2']))
> ).select(db.zoo.ALL)
>
>
> On Thursday, August 8, 2013 10:19:47 PM UTC+2, dave wrote:
>>
>> ok that works but I have one other question, how would I use the belongs 
>> operator If I want to refer a field by a name for example
>> instead of rows = db(db.zoo.tier.belongs([2, 3])).select()  I want to do 
>> this
>>rows = db(db.zoo.tier.belongs(["test 2", "test 
>> 3"])).select()  ?
>>
>> On Thursday, August 8, 2013 12:51:12 PM UTC-7, Massimo Di Pierro wrote:
>>>
>>> This
>>>
>>> rows = db(db.zoo.tier == 2).select()
>>>
>>> is equivalent to
>>>
>>> rows = db(db.zoo.tier.belongs([2])).select()
>>>
>>> you can do
>>>
>>> rows = db(db.zoo.tier.belongs([2, 3])).select()
>>>
>>>
>>> On Thursday, 8 August 2013 14:28:47 UTC-5, dave wrote:

 I have two tables defined as follows

 db.define_table('animals', 
 Field('type'),
 format='%(type)s')

 db.define_table('zoo', 
 Field('name'), 
 Field('tier', 'reference animals'),
 format='%(name)s' 
 ) 

 field type is a column with values like, test 1, test 2, test 3
 now if I want to select all the records of table zoo with 'test 2' I 
 can do something like this 

 rows = db(db.zoo.tier == "2").select()

 but why can't I do something like 
 db(db.zoo.tier.contains("2")).select() or
 pass a list  ["2", "3"] to the contains operator to get all the records 
 of "test 2" and "test 3"? can you suggest another way of implementing this?

>>>

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Em 08-08-2013 22:05, Ricardo Pedroso escreveu:
> 
> On Thu, Aug 8, 2013 at 9:22 PM, Carlos Correia  > wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Em 08-08-2013 20:23, Ricardo Pedroso escreveu:
> > On Thu, Aug 8, 2013 at 2:36 PM, Carlos Correia
> mailto:car...@memoriapersistente.pt>
> >  >> wrote:
> >
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > Hi,
> >
> > I'm facing a bug when I redirect to another controller, that 
> redirects
> the user
> > to the login prompt, after having been authenticated.
> >
> >
> > It's hard to tell what the problem is but for me it seems that web2py is
> failing
> > to load the
> > session data.
> > If you dont mind to tweak your gluon/globals.py you could add a raise
> statement
> > to reraise some exceptions that are been swallowed when web2py tries to
> load the
> > session data.
> 
> And where/how should I do that?
> 
> 
> Depends on what kind of sessions you use, supposing you are using file 
> sessions:
> in gluon/globals.py around line 674 you have this:
> 
> 
> try:
> response.session_file = \
> open(response.session_filename, 'rb+')
> try:
> portalocker.lock(response.session_file,
>  portalocker.LOCK_EX)
> response.session_locked = True
> self.update(cPickle.load(response.session_file))
> response.session_file.seek(0)
> oc = response.session_filename.split('/')[-1]\
> .split('-')[0]
> if check_client and client != oc:
> raise Exception("cookie attack")
> except:
> response.session_id = None
> finally:
> pass
> #This causes admin login to break. Must find out why.
> #self._close(response)
> except:
> response.session_file = None
> if not response.session_id:
> 
> 
> After those two except's append a line with raise
> eg:
> 
> except:
> raise
> 
> This will reraise any exception that may happen.
> 
> 

Thank you VERY much :)

I've already found it, though only in the server.

Is there a way to force this exception to be raised when I run it locally?


[Thu Aug 08 22:27:05 2013] [error]   File
"applications/belmiro/modules/belmiro/db/models/doc_evol_fin_trigger.py", line
3, in 
[Thu Aug 08 22:27:05 2013] [error] from belmiro.db.models.ent_doc_type
import EntDocTypeModel
[Thu Aug 08 22:27:05 2013] [error]   File
"/home/beeweb/sites/take5/web2py/current/gluon/custom_import.py", line 292, in
__call__
[Thu Aug 08 22:27:05 2013] [error] globals, locals, fromlist, level)
[Thu Aug 08 22:27:05 2013] [error]   File
"/home/beeweb/sites/take5/web2py/current/gluon/custom_import.py", line 80, in
__call__
[Thu Aug 08 22:27:05 2013] [error] level)
[Thu Aug 08 22:27:05 2013] [error]   File
"applications/belmiro/modules/belmiro/db/models/ent_doc_type.py", line 12, in

[Thu Aug 08 22:27:05 2013] [error] T = current.T
[Thu Aug 08 22:27:05 2013] [error] AttributeError: 'thread._local' object has no
attribute 'T'
[Thu Aug 08 22:27:05 2013] [error] *** in applications/belmiro/models/db.py:32:

- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlIEHWoACgkQ90uzwjA1SJXfEwCdGddRO5BydCELRe3za2Nd8X1/
9kEAnivePFNg8IV/eUI3gV3N/OZ3tnBI
=x5eG
-END PGP SIGNATURE-

-- 

--- 
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] Help needed in obscure bug (only on server)

2013-08-08 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Em 08-08-2013 21:56, Michele Comitini escreveu:
> Is BizDoc pickable?
> 

Yes. Otherwise Web2py would raise an exception (I think).

> 
> 2013/8/8 Carlos Correia  >
> 
> Em 08-08-2013 20 :23, Ricardo Pedroso escreveu:
>> On Thu, Aug 8, 2013 at 2:36 PM, Carlos Correia
> mailto:car...@memoriapersistente.pt>
>>  >> wrote:
> 
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
> 
>> Hi,
> 
>> I'm facing a bug when I redirect to another controller, that redirects
> the user
>> to the login prompt, after having been authenticated.
> 
> 
>> It's hard to tell what the problem is but for me it seems that web2py is
> failing
>> to load the
>> session data.
>> If you dont mind to tweak your gluon/globals.py you could add a raise
> statement
>> to reraise some exceptions that are been swallowed when web2py tries to
> load the
>> session data.
> 
> And where/how should I do that?
> 
>> But again, this is just a guess...
> 
>> You can try also to delete your browser session cookie.
> 
>> Sometimes when weird thinks happens, restarting webserver, and as a last
>> resource restarting the server,
>> can help.
> 
> 
> Done all of those... no results.
> 
> 
> --
> 
> ---
> 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.
> 
> 
> -- 
>  
> ---
> 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.

- -- 
Com os melhores cumprimentos,

Carlos Correia
=
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlIEHawACgkQ90uzwjA1SJXyLACdG85NqIFwJKMFh1XvKTv2LnfJ
PhoAoL6VB/QXUoNcVGHROHMerQTu2fB5
=rsH/
-END PGP SIGNATURE-

-- 

--- 
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] autofocus html5 attribute support?

2013-08-08 Thread davedigerati
using a custom sqlform, in my view I can use the placeholder attribute but 
not the autofocus- is this being ignored by web2py?

{{form.custom.widget.tm_home["_autofocus"]}}
{{form.custom.widget.tm_home["_placeholder"] = "Home Team Name"}}

I also tried autofocus without the _ with similar result: not rendering in 
the html - no errors either which is weird because it seems like every 
other thing I type generators an error of some kind ;)

http://www.w3schools.com/tags/att_input_autofocus.asp

-- 

--- 
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: autofocus html5 attribute support?

2013-08-08 Thread Anthony
form.custom.widget.tm_home["_autofocus"]

This is just standard Python, so the above simply attempts to retrieve the 
value with key "_autofocus" -- it doesn't add the key if it doesn't exist. 
Instead, you can do:

form.custom.widget.tm_home["_autofocus"] = True

which will yield:



which should work.

Anthony

On Thursday, August 8, 2013 9:37:13 PM UTC-4, davedigerati wrote:
>
> using a custom sqlform, in my view I can use the placeholder attribute but 
> not the autofocus- is this being ignored by web2py?
>
> {{form.custom.widget.tm_home["_autofocus"]}}
> {{form.custom.widget.tm_home["_placeholder"] = "Home Team Name"}}
>
> I also tried autofocus without the _ with similar result: not rendering in 
> the html - no errors either which is weird because it seems like every 
> other thing I type generators an error of some kind ;)
>
> http://www.w3schools.com/tags/att_input_autofocus.asp
>

-- 

--- 
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: deployment to google app engine did not include my static files

2013-08-08 Thread davedigerati
Christian - I'm a total n00b so unable to help as much as I would like, but 
upon deployment of my app via the GoogleAppEngineLauncher on OS X 10.8.4, 
it fails with 

Error parsing yaml file:

threadsafe cannot be enabled with CGI handler: gaehandler.py

 in "/Users/usernamehere/Dropbox/web2py/app.yaml", line 95, column 15

If deploy fails you might need to 'rollback' manually.

The "Make Symlinks..." menu option can help with command-line work.

*** appcfg.py has finished with exit code 1 ***


and my app.yaml referenced is

application: sportssquaresonline
version: 1
api_version: 1

# use this line for Python 2.5
#
#runtime: python

# use these lines for Python 2.7
# upload app with: appcfg.py update web2py (where 'web2py' is web2py's root 
directory)
#
runtime: python27
threadsafe: true# true for WSGI & concurrent requests (Python 2.7 only)

default_expiration: "24h"   # for static files

let me know if you would like me to test anything...
Dave

On Sunday, August 4, 2013 7:59:54 PM UTC-4, Christian Foster Howes wrote:
>
> if you get a chance, can you describe how threadsafe==True was failing on 
> GAE?  i'm hoping to focus on making that work here in the next couple of 
> weeks
>
> thanks,
>
> christian
>
> On Sunday, August 4, 2013 12:16:02 PM UTC-7, davedigerati wrote:
>>
>> and I only updated the app name in app.yaml and runtime to 2.7 and 
>> threadsafe to False since true was bombing and I need this dang thing 
>> running an hour ago...
>>
>> On Sunday, August 4, 2013 3:12:16 PM UTC-4, davedigerati wrote:
>>>
>>> as you can see from here: http://sportssquaresonline.appspot.com/
>>> it did upload most of the static files, specifically 30, but the ones I 
>>> added, both images and a css file, it did not.
>>> any idea why???
>>>
>>> deployed both through the web2py admin feature and the GAE Launcher
>>>
>>>

-- 

--- 
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: autofocus html5 attribute support?

2013-08-08 Thread davedigerati
and as usual Anthony, it does;)
Thanks

On Thursday, August 8, 2013 10:04:17 PM UTC-4, Anthony wrote:
>
> form.custom.widget.tm_home["_autofocus"]
>
> This is just standard Python, so the above simply attempts to retrieve the 
> value with key "_autofocus" -- it doesn't add the key if it doesn't exist. 
> Instead, you can do:
>
> form.custom.widget.tm_home["_autofocus"] = True
>
> which will yield:
>
> 
>
> which should work.
>
> Anthony
>
> On Thursday, August 8, 2013 9:37:13 PM UTC-4, davedigerati wrote:
>>
>> using a custom sqlform, in my view I can use the placeholder attribute 
>> but not the autofocus- is this being ignored by web2py?
>>
>> {{form.custom.widget.tm_home["_autofocus"]}}
>> {{form.custom.widget.tm_home["_placeholder"] = "Home Team Name"}}
>>
>> I also tried autofocus without the _ with similar result: not rendering 
>> in the html - no errors either which is weird because it seems like every 
>> other thing I type generators an error of some kind ;)
>>
>> http://www.w3schools.com/tags/att_input_autofocus.asp
>>
>

-- 

--- 
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] How to switch between pg8000 and psycopg2?

2013-08-08 Thread Joe Barnhart
This is probably so simple everyone already knows it... but...

Now that I have psycopg2 installed, my web2py instance always chooses it 
when opening a postgres database.  How can I tell it to use the pg8000 
driver?  I'd still like to compare the two, and feed back hints to the 
pg8000 project if I discover anything interesting.  Ultimately I think the 
community will be well-served by a pure Python driver because PyPy will 
work one day and we'll all want pure Python for everything at that time.

-- Joe

-- 

--- 
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: accounting appliance

2013-08-08 Thread Mika Sjöman
Hi

Did you do anything about this? I really need an accounting appliance but 
it seems I have to write one myself if not convering some other project.

cheers

On Thursday, June 3, 2010 9:48:11 AM UTC+8, Jim Karsten wrote:
>
> I am considering developing a web2py small business Accounting 
> application but I thought I check to see if anyone has created 
> something already. I'm looking for General Ledger, Receivables and 
> Payables, and possibly payroll. 
>
> Anyone know of such an appliance or of someone developing one?

-- 

--- 
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: How to switch between pg8000 and psycopg2?

2013-08-08 Thread Joe Barnhart
OK. I looked at the source and found I can add a parameter to the URL:

'postgres:pg8000://web2py:web2py@localhost/mydatabase'

But the bad news is --- pg8000 doesn't support Python 2.7!  (Or so the docs 
say.)  It stopped development awhile ago, apparently.  Oh well.

-- Joe

On Thursday, August 8, 2013 9:15:24 PM UTC-7, Joe Barnhart wrote:
>
> This is probably so simple everyone already knows it... but...
>
> Now that I have psycopg2 installed, my web2py instance always chooses it 
> when opening a postgres database.  How can I tell it to use the pg8000 
> driver?  I'd still like to compare the two, and feed back hints to the 
> pg8000 project if I discover anything interesting.  Ultimately I think the 
> community will be well-served by a pure Python driver because PyPy will 
> work one day and we'll all want pure Python for everything at that time.
>
> -- Joe
>
>

-- 

--- 
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.