[web2py] Re: Many to many

2013-10-31 Thread Gael Princivalle
Thanks a lot Anthony. Now it works.

Il giorno giovedì 31 ottobre 2013 00:12:43 UTC+1, Anthony ha scritto:
>
>
> {{for company_image in company_images.select():}}
>>
>
> You've already done a select, so don't call .select() again.
>   
>
>> {{for company_image in company_images:}}
>> {{=A(IMG(_src=URL('download', 
>> args=company_image.image_file_s)), _href=URL('download', 
>> args=company_image.image_file))}}>
>> 
>> {{=(company_image.title_it)}}
>>
>
> When you do a join, you can't just reference the field name -- you have to 
> reference the table name and the field name. So, for example, 
> company_image.image_file_s should be company_image.images.image_file_s.
>
> Anthony
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Internal Error - Ticket unknown - only over HTTPS?!

2013-10-31 Thread Michele Comitini
1. try to activate logging using logging.conf (see the included example).

2. look in your app errors directory, and see if you find any error file,
then go to web2py root dir and launch the shell:

python web2py.py -S app2 -M

>>> import pickle
>>> with
open('applications/app/errors/127.0.0.1.2013-10-10.14-51-47.f38eefb4-fb8c-466b-a1c4-a806275d369e')
as f:
...   tckt = pickle.load(f)

>>> print tckt

you will see a lot of information contained in the pickled dictionary: it
could drive you in the right direction or not ;-)




2013/10/30 AbrahamLinksys 

> Hi all,
>
> I'm running a little older version of web2py in production (1.99.7).
>
> I have two apps configured to different subdomains --
> app1.domain.edu -> app1
> app2.domain.edu -> app2
>
> This works fine. Great in fact -- I'm using routers to make the apps
> default based on the domain, so appnames aren't needed.
>
> Recently we decided to add authenticated services to the applications, so
> I got some certificates and set up web2py over SSL.
>
> So over https, app1 works fine but app2 generates the unknown ticket
> issue.
>
> This doesn't appear to be any sort of permissions or storage issue (lots
> of room/inodes on disk, errors dir writable by app2 when requested over
> HTTP -- doesn't normally generate an error over HTTP, I could 777 the
> errors dir but I can't see how that would be an issue).
>
> Also, on the test server (where I run rocket) both sites run fine over
> HTTPS, albeit with cert warnings because of my self-signed test certs.
> There I have an two web2py daemons -- one for HTTP and one for HTTPS
> running on two different ports, using apache with mod_proxy to dispatch
> requests based on the hostname.
>
>
> Does anyone have any ideas? I'm thinking it's might be related to the
> "routers" feature ... or maybe somehow app1's directories or models are
> getting loaded when requesting app2? I'm not even really sure how to
> diagnose the issue as I don't see any logs to read (though I haven't ever
> used web2py's logging, perhaps that would help?)
>
>
> Also -- and I doubt this is an issue but I'll just throw it out there -- I
> used the same private key to generate CSRs for both SSL certificates for
> the two FQDNs -- is it possible that WSGI doesn't like this? As far as I
> know this is accepted when generating SSL certs. And I don't get any
> certificate issues when using the two domains.. and when just serving HTML
> from the filesystem w/apache everything is fine.
>
>
> If I don't make progress I will probably try to upgrade to the newest
> version of web2py and see if the issue persists... however any help is
> appreciated!
>
>
> Here are some relevant snippets from config files:
>
> /var/www/web2py/routes.py
>
> routers = dict(
>   BASE  = dict(
> domains = {
>   'app1.domain.edu': 'app1',
>   'www.app1.domain.edu': 'app1',
>   'app2.domain.edu': 'app2',
>   'www.app2.domain.edu': 'app2',
>   'www.app2.domain.edu:443': 'app2/default' # I added this after
> getting the error, it doesn't seem to affect it. It's not currently in my
> routes file, still getting error.
> }
>   ),
> )
>
>
> apache conf:
>
> NameVirtualHost *:80
>
> 
>   AllowOverride None
>   Order Allow,Deny
>   Deny from all
>   
> Allow from all
>   
> 
>
> WSGISocketPrefix /var/run/wsgi/
> 
>   ServerName app1.domain.edu
>   ServerAlias app2.domain.edu
>
>   WSGIDaemonProcess web2py user=webadmin group=webadmin threads=15 \
>display-name=%{GROUP}
>   WSGIProcessGroup web2py
>   WSGIApplicationGroup %{RESOURCE}
>
>   # This routes all requests that aren't user-dir or awstats requests to
> web2py
>   WSGIScriptAliasMatch ^(/([^~].*|awstats.*)?)$
> /var/www/web2py/wsgihandler.py$1
>
>   # ... mod_user stuff that I won't bother copying is here (for tilde
> sites) ... #
>
>   Alias /css/ /var/www/web2py/applications/app1/static/
>
>   AliasMatch ^/([^/]+)/static/(.*) \
>/var/www/web2py/applications/$1/static/$2
>   
> Order Allow,Deny
> Allow from all
>   
> 
>
>
>
> LoadModule ssl_module modules/mod_ssl.so
>
> Listen 443
> NameVirtualHost *:443
> 
>   ServerName app1.domain.edu
>
>   SSLEngine on
>   SSLCertificateFile /etc/pki/tls/certs/app1.domain.edu.crt
>   SSLCertificateKeyFile /etc/ssl/private/server.private.key
>
>   
> Deny from all
>   
>
>   WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>   Alias /css/ /var/www/web2py/applications/app1/static/
>   AliasMatch ^/([^/]+)/static/(.*) \
>/var/www/web2py/applications/$1/static/$2
>   
> Order Allow,Deny
> Allow from all
>   
> 
>
> 
>   ServerName app2.domain.edu
>
>   SSLEngine on
>   SSLCertificateFile /etc/pki/tls/certs/app2.domain.edu.crt
>   SSLCertificateKeyFile /etc/ssl/private/server.private.key
>
>   
> Deny from all
>   
>
>   WSGIScriptAlias / /var/www/web2py/wsgihandler.py
>
>   Alias /css/ /var/www/web2py/applications/app2/static/
>   AliasMatch ^/([^/]+)/static/(.*) \
>/var/ww

Re: [web2py] change web2py application directory

2013-10-31 Thread Loïc
For Windows users who are interested...

Now I have 2 separate folders : 

|_web2py (containing web2py source files with default applications)
   |_...   
   |_applications
  |_admin
  |_welcome
   
|_web2py_apps (folder containing all my apps)
   |_app1
   |_app2
   |_...

When I upgrade web2py , I replace the whole "web2py" folder
Then I launch a little batch file stored in "web2py_apps" to recreate all 
directory junctions.
Code here : 

*create_junctions.bat*
for /f "delims=" %%a In ('dir /ad/b  "./" ') Do mklink /J ..\web2py\
applications\%%a .\%%a
pause



Le mercredi 30 octobre 2013 18:18:17 UTC+1, Loïc ESPERN a écrit :
>
> Good idea
> I will make a try when upgrading my web2py repo...
>
> Thank you
> Le 30 oct. 2013 16:01, "Richard Vézina" > 
> a écrit :
>
>> Loïc, just a thought... How will you manage the upgrade of web2py 
>> version? If you have only a single repo, you will make symlink in new 
>> version of web2py applications folder, but then you may face issue with the 
>> new version that force you to stick with previous version... If you have 
>> commit change over your trunk you will have to revert...
>>
>> I generally just copy my entire repo, that become a clone...
>>
>> Richard
>>
>>
>> On Wed, Oct 30, 2013 at 10:56 AM, Richard Vézina 
>> 
>> > wrote:
>>
>>> Great!
>>>
>>> :)
>>>
>>> Richard
>>>
>>>
>>> On Wed, Oct 30, 2013 at 10:11 AM, Loïc 
>>> > wrote:
>>>
 I have found the problem. Thank you Richard!

 For Windows users who want to move the applications subfolders out of 
 web2py directory, the correct syntax is : 
 mklink /J TheLinkName ThePath

 mklink /J created a directory junction
 Previously, I used mklink /D (which creates a symlink for a folder) but 
 this doesn't work.




 Le mercredi 30 octobre 2013 14:53:31 UTC+1, Richard a écrit :
>
> http://en.wikipedia.org/wiki/**Hard_link
>
>
> On Wed, Oct 30, 2013 at 9:52 AM, Richard Vézina  > wrote:
>
>> Hmmm... I pretty sure in linux a symlink would work, but in win it is 
>> different... If I remember there is a difference in hardlink and 
>> softlink 
>> that need to be consider...
>>
>> Richard
>>
>>
>> On Wed, Oct 30, 2013 at 4:06 AM, Loïc  wrote:
>>
>>> Some weeks ago, I tried to create a symlink inside /applications 
>>> folder, but I got an error in modules.
>>> I was using mklink command on Win7, and my app works fine when 
>>> located inside /applications folder without symlink...
>>>
>>> Below is the ticket I got. Maybe you have an idea?
>>>
>>> Ticket ID
>>>
>>> 127.0.0.1.2013-09-25.13-53-37.**347db33f-279e-4ae1-b231-**
>>> 66904661519e
>>>  No module named 
>>> espern.modules.models_tools
>>> Version
>>> web2py™ Version 2.6.3-stable+timestamp.2013.**09.15.17.01.20
>>> Python Python 2.7.3: C:\Python27\python.exe (prefix: C:\Python27)
>>> Traceback
>>>
>>>
>>> Traceback (most recent call last):
>>>   File "C:\Users\loic\web2py\gluon\**restricted.py", line 217, in 
>>> restricted
>>> exec ccode in environment
>>>   File 
>>> "C:/Users/loic/web2py/**applications/espern/models/db_**calendar.py", 
>>> line 2, in 
>>> from models_tools import start_datetime, end_datetime
>>>   File "C:\Users\loic\web2py\gluon\**custom_import.py", line 86, in 
>>> custom_importer
>>> return base_importer(pname, globals, locals, fromlist, level)
>>>   File "C:\Users\loic\web2py\gluon\**custom_import.py", line 125, 
>>> in __call__
>>> result = NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>> ImportError: No module named espern.modules.models_tools
>>>
>>> Le mardi 29 octobre 2013 21:55:06 UTC+1, Richard a écrit :

 Symbolic link?

 Richard


 On Tue, Oct 29, 2013 at 2:04 PM, wiel  wrote:

>
> I have a local repository and a web2py installation up. how can I 
> change web2py's application directory so that it points to the 
> repository? 
> or how can I let web2py use the repository?
>  
> -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - 
> http://github.com/web2py/**web2p**y(Source
>  code)
> - 
> https://code.google.com/p/**web2**py/issues/list(Report
>  Issues)
> --- 
> You received this message because you are subscribed to the Google 
> Groups "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, 
> send an email to web2py+un...@**googlegroups.com.
>
> For more options, visit https://groups.google.com/**

Re: [web2py] change web2py application directory

2013-10-31 Thread Kiran Subbaraman

Loic,
I find this to be useful, primarily because I want to add just my web2py 
applications to source control, and not necessarily the web2py 
installation. Also, am developing this stuff on windows, and actually 
deploy it on ubuntu. I feel this separation of my apps from the web2py 
platform is useful in this sense too.

Some details like:
* Where to run the script from
* Also an additional step would be to script the wget of the web2py 
install, and follow that up with this script automatically. This is 
something that could be contributed later on...


Possible for you to add this to web2py slices, as a recipe? 
(http://www.web2pyslices.com/home).

Thank you.


Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On 10/31/2013 2:42 PM, Loïc wrote:

For Windows users who are interested...

Now I have 2 separate folders :

|_web2py (containing web2py source files with default applications)
   |_...
   |_applications
  |_admin
  |_welcome

|_web2py_apps (folder containing all my apps)
   |_app1
   |_app2
   |_...

When I upgrade web2py , I replace the whole "web2py" folder
Then I launch a little batch file stored in "web2py_apps" to recreate 
all directory junctions.

Code here :

*create_junctions.bat*
|
for/f "delims="%%a In('dir /ad/b  "./" ')Domklink /J 
..\web2py\applications\%%a .\%%a

pause
|



Le mercredi 30 octobre 2013 18:18:17 UTC+1, Loïc ESPERN a écrit :

Good idea
I will make a try when upgrading my web2py repo...

Thank you

Le 30 oct. 2013 16:01, "Richard Vézina" > a écrit :

Loïc, just a thought... How will you manage the upgrade of
web2py version? If you have only a single repo, you will make
symlink in new version of web2py applications folder, but then
you may face issue with the new version that force you to
stick with previous version... If you have commit change over
your trunk you will have to revert...

I generally just copy my entire repo, that become a clone...

Richard


On Wed, Oct 30, 2013 at 10:56 AM, Richard Vézina
> wrote:

Great!

:)

Richard


On Wed, Oct 30, 2013 at 10:11 AM, Loïc > wrote:

I have found the problem. Thank you Richard!

For Windows users who want to move the applications
subfolders out of web2py directory, the correct syntax
is :
|
mklink /J TheLinkNameThePath
|

mklink /J created a directory junction
Previously, I used mklink /D (which creates a symlink
for a folder) but this doesn't work.




Le mercredi 30 octobre 2013 14:53:31 UTC+1, Richard a
écrit :

http://en.wikipedia.org/wiki/Hard_link



On Wed, Oct 30, 2013 at 9:52 AM, Richard Vézina
 wrote:

Hmmm... I pretty sure in linux a symlink would
work, but in win it is different... If I
remember there is a difference in hardlink and
softlink that need to be consider...

Richard


On Wed, Oct 30, 2013 at 4:06 AM, Loïc
 wrote:

Some weeks ago, I tried to create a
symlink inside /applications folder, but I
got an error in modules.
I was using mklink command on Win7, and my
app works fine when located inside
/applications folder without symlink...

Below is the ticket I got. Maybe you have
an idea?

Ticket ID


127.0.0.1.2013-09-25.13-53-37.347db33f-279e-4ae1-b231-66904661519e
 No module
named espern.modules.models_tools
Version
web2py™ Version
2.6.3-stable+timestamp.2013.09.15.17.01.20
Python Python 2.7.3:
C:\Python27\python.exe (prefix: C:\Python27)
Traceback


Traceback (most recent call last):
  File
"C:\Users\loic\web2py\gluon\restricted.py", line
217, in restricted
exec ccode in environment
  File

"C:/Users/loic/web2py/applications/espern/models/db_calendar.py",
line 2, in 
from model

Re: [web2py] Re: Testing redirection with py.test

2013-10-31 Thread Vinicius Assef
Good idea.

I'll make it, but it is based on a previous work [1]. I need improve
docs for it.

[1] http://github.com/viniciusban/web2py.test

On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
 wrote:
> Can you please make a web2py slice about this?
>
>
> On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
>>
>> I created this gist to help people testing controllers that makes
>> redirection:
>> https://gist.github.com/viniciusban/7206413
>>
>> Hope it helps someone.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Join might work? Table limits?

2013-10-31 Thread Vinicius Assef
That was my point, Diogo.

Is there some fault when we have many explicit joins in DAL?


On Wed, Oct 30, 2013 at 4:01 PM, Diogo Munaro  wrote:
> Hi Vinicius!
> The query with a lot of natural joins really don't work, but join with WHERE
> worked.
>
> I don't know what happend, but web2py become crazy when I set more natural
> joins
>
>
> 2013/10/30 Vinicius Assef 
>>
>> Maybe I missed something, but why the simple query (with few joins)
>> worked and the complex one (with many joins) didn't?
>>
>> On Wed, Oct 30, 2013 at 2:31 PM, Diogo Munaro 
>> wrote:
>> > Hi Michele, I'm looking here the results...
>> >
>> > If I get where and natural join is different.
>> >
>> > The explain is like that:
>> >
>> > http://stackoverflow.com/questions/15996226/natural-join-vs-where-in-clauses
>> >
>> > Here is massimo suggested code:
>> >
>> > mysql> explain SELECT  groups.name, city.name, auth_user.id,
>> > auth_user.is_active, auth_user.created_on, auth_user.created_by,
>> > auth_user.modified_on, auth_user.modified_by, auth_user.email,
>> > auth_user.person_id, auth_user.password, auth_user.know_id,
>> > auth_user.registration_key, auth_user.reset_password_key,
>> > auth_user.registration_id FROM researcher, researcher_lab_permission,
>> > lab,
>> > groups, auth_user, city WHERE groups.id = lab.group_id) AND
>> > (lab.id
>> > = researcher_lab_permission.lab_id)) AND (researcher.id =
>> > researcher_lab_permission.researcher_id)) AND (researcher.user_id =
>> > auth_user.id)) AND (researcher_lab_permission.is_active = 'T')) AND
>> > (lab.is_active = 'T')) AND (groups.is_active = 'T')) AND
>> > (auth_user.is_active = 'T'))
>> > -> ;
>> >
>> > ++-+---+++-+-++--++
>> > | id | select_type | table | type   | possible_keys
>> > | key | key_len | ref|
>> > rows
>> > | Extra  |
>> >
>> > ++-+---+++-+-++--++
>> > |  1 | SIMPLE  | city  | ALL| NULL
>> > | NULL| NULL| NULL   |
>> > 5535
>> > ||
>> > |  1 | SIMPLE  | researcher_lab_permission | ALL|
>> > researcher_id__idx,lab_id__idx | NULL| NULL| NULL
>> > |2 | Using where; Using join buffer |
>> > |  1 | SIMPLE  | lab   | eq_ref |
>> > PRIMARY,group_id__idx  | PRIMARY | 4   |
>> > labsyn.researcher_lab_permission.lab_id|1 | Using where
>> > |
>> > |  1 | SIMPLE  | groups| eq_ref | PRIMARY
>> > | PRIMARY | 4   | labsyn.lab.group_id|
>> > 1
>> > | Using where|
>> > |  1 | SIMPLE  | researcher| eq_ref |
>> > PRIMARY,user_id__idx   | PRIMARY | 4   |
>> > labsyn.researcher_lab_permission.researcher_id |1 |
>> > |
>> > |  1 | SIMPLE  | auth_user | eq_ref | PRIMARY
>> > | PRIMARY | 4   | labsyn.researcher.user_id  |
>> > 1
>> > | Using where|
>> >
>> > ++-+---+++-+-++--++
>> >
>> >
>> > Here is with JOIN:
>> >
>> > explain SELECT l.id,g.name,c.name FROM researcher_lab_permission as rl
>> > JOIN
>> > lab as l
>> > -> JOIN researcher as r JOIN auth_user as a JOIN groups
>> > as g
>> > JOIN city as c
>> > -> ON rl.researcher_id = r.id AND rl.lab_id = l.id AND
>> > a.id
>> > = r.user_id AND l.group_id = g.id
>> > -> AND c.id = g.city_id
>> > -> ;
>> >
>> > ++-+---+++-+-+-+--++
>> > | id | select_type | table | type   | possible_keys  |
>> > key
>> > | key_len | ref | rows | Extra
>> > |
>> >
>> > ++-+---+++-+-+-+--++
>> > |  1 | SIMPLE  | l | index  | PRIMARY,group_id__idx  |
>> > group_id__idx   | 5   | NULL|2 | Using index
>> > |
>> > |  1 | SIMPLE  | rl| ALL| researcher_id__idx,lab_id__idx |
>> > NULL
>> > | NULL| NULL|2 | Using where; Using join
>> > buffer
>> > |
>> > |  1 | SIMPLE  | a | index  | PRIMARY|
>> > created_by__id

[web2py] Re: Invalid literal for long () with base 10: 'ie' - using BEAUTIFY

2013-10-31 Thread Gael Princivalle
Hi Niphlod. You're right, there was something wrong in this field, I've 
delete it and create another one 'integer' and now it works fine. Thanks a 
lot.

Il giorno mercoledì 30 ottobre 2013 21:22:56 UTC+1, Niphlod ha scritto:
>
> has the cat_id field been a "string" before being a reference in a sqlite 
> database?
> If yes, you need to delete the column data and re-fill it.
>
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Gotchas
>
> On Wednesday, October 30, 2013 4:55:50 PM UTC+1, Gael Princivalle wrote:
>>
>> Hi.
>>
>> I've got a strange error.
>>
>> My db:
>> db.define_table('models',
>> Field('code', unique=True),
>> Field('category'),
>> Field('cat_id', 'reference categories'),
>> Field('description_en'),
>> Field('description_it'),
>> Field('pdf_path'))
>> db.define_table('images',
>> Field('title_en'),
>> Field('title_it'),
>> Field('contents'),
>> Field('image_file', 'upload'),
>> Field('image_file_s', 'upload'))
>>
>> When I do a beautify on the "images" table in the same view, it works.
>> With the "models table", I've got this error:
>> invalid literal for long() with base 10: 'ie'
>>
>> My controller:
>> def hp():
>> models=db().select(db.models.ALL)
>> return dict(models=models)
>>
>> My view:
>> {{=BEAUTIFY(response._vars)}}
>>
>> I use this "models" table also with a Grid and it works.
>>
>> What's wrong ?
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Escolher qual base de dados acessar ao entrar no sistema...

2013-10-31 Thread Carlynhos77
Ola, bom dia...

Estou desenvolvendo uma aplicação que será disponibilizada para vários 
clientes, nisso terei para cada cliente um banco de dados (prefeitura).. 
gostaria de saber dos colegas, como posso identificar o banco de dados que 
cada cliente deverá ter acesso, no meu arquivo DB.PY,  eu tenho a string de 
conexao:

*import psycopg2*
*db = DAL('postgres://postgres:123@localhost:5432/saude')*

penso que teria q ser nesse ponto, ao usuario ao digitar seu login, ja 
seria também identificado ao qual banco de dados ele pertence... daria eu 
teria por exemplo as opcoes:

*import psycopg2*
*se login 1*
*db = DAL('postgres://postgres:123@localhost:5432/saude_1')*

*se login 2*
*db = DAL('postgres://postgres:123@localhost:5432/saude_2')*

*se login 3*
*db = DAL('postgres://postgres:123@localhost:5432/saude_3')*
*
*
*
*
ou talvez, seria um unico banco de dados, mas teria vários esquemas, no 
caso teria um esquema para cada usuário, iria precisar da mesma logica para 
identificar a qual esquema ele pertence... 


alguém tem alguma dica sobre isso?


*
*
*
*

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How do I recieve files in a regular post message?

2013-10-31 Thread Jason (spot) Brower
I have various data I can handle but how do I handle the file upload?
I can read the message from request.post_vars.file_data.  But how do I do
things like save it to my uploads directory (or another directory if
needed.)
I am not using a tradition form because it's data I use in a very different
way.
A phone app is sending the data as a post request. (In the quickest way to
describe it.)
BR,
Jason Brower

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Escolher qual base de dados acessar ao entrar no sistema...

2013-10-31 Thread Vinicius Assef
O Web2py permite trabalhar com vários bancos de dados na mesma
aplicação ou escolher a qual deles fazer sua conexão.

Assim, fazer o que você sugeriu acima é muito simples. A lógica foi a
que você escreveu mesmo.

No entanto, precisa ter em mente algumas coisas:
1) Dependendo da quantidade de bancos de dados existentes, prepare-se
para algum (enorme!) trabalho para sincronizar as versões do seu
schema, manutenção de tabelas em vários BD's, etc.
2) O seu banco de dados de autenticação de usuários precisa ser
diferente daquele que vai guardar os dados de sua aplicação, já que é
pelo usuário autenticado que você vai determinar aonde estão os dados
sobre os quais ele vai trabalhar. Caso os logins de seus usuários já
indiquem a qual banco de dados ele irá se contectar, esse problema é
diminuído.

É certo que cada aplicação tem requisitos específicos, mas tenho visto
que vale muito mais a pena trabalhar com um banco de dados unificado e
investir na otimização da infra de BD (servidores, cache, índices, às
vezes queries na mão, etc.)

As duas abordagens: unificar o BD e separá-lo para cada cliente tem
prós e contras. Sua necessidade é que vai determinar qual escolher.




2013/10/31 Carlynhos77 :
> Ola, bom dia...
>
> Estou desenvolvendo uma aplicação que será disponibilizada para vários
> clientes, nisso terei para cada cliente um banco de dados (prefeitura)..
> gostaria de saber dos colegas, como posso identificar o banco de dados que
> cada cliente deverá ter acesso, no meu arquivo DB.PY,  eu tenho a string de
> conexao:
>
> import psycopg2
> db = DAL('postgres://postgres:123@localhost:5432/saude')
>
> penso que teria q ser nesse ponto, ao usuario ao digitar seu login, ja seria
> também identificado ao qual banco de dados ele pertence... daria eu teria
> por exemplo as opcoes:
>
> import psycopg2
> se login 1
> db = DAL('postgres://postgres:123@localhost:5432/saude_1')
>
> se login 2
> db = DAL('postgres://postgres:123@localhost:5432/saude_2')
>
> se login 3
> db = DAL('postgres://postgres:123@localhost:5432/saude_3')
>
>
> ou talvez, seria um unico banco de dados, mas teria vários esquemas, no caso
> teria um esquema para cada usuário, iria precisar da mesma logica para
> identificar a qual esquema ele pertence...
>
>
> alguém tem alguma dica sobre isso?
>
>
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py 'way' for windows NET USE?

2013-10-31 Thread Willoughby
Thanks Massimo - win32 is new to me, so that helps on many fronts.

On Wednesday, October 30, 2013 9:53:02 PM UTC-4, Massimo Di Pierro wrote:
>
> You can try this: http://code.activestate.com/lists/python-list/44825/
>
> not web2py specific but  win32 ships with web2py for windows
>
> On Wednesday, 30 October 2013 10:10:22 UTC-5, Willoughby wrote:
>>
>> I'm looking at executing 'NET USE' using the @contextmanager code found 
>> here:
>>
>> http://stackoverflow.com/questions/2625877/copy-files-to-nework-path-or-drive-using-python
>>
>> But was wondering if there's a more 'web2py' like way to do it?
>> Searched the forums, searched the docs and didn't see anything...
>>
>> Thanks.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Rich text in text fields

2013-10-31 Thread Johann Spies
Thanks Tim and Anthony.  I have installed CKeditor and it works very nicely.

Regards
Johann


On 18 October 2013 16:59, Anthony  wrote:

> This (advanced_editor) is not documented in the book as far as I can see.
>
>
> See the end of this 
> sectionfor
>  a custom widget example.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] What is inserting '_2.7.3' into my static url's?

2013-10-31 Thread Johann Spies
Investing why admin on the server does not use CSS (at least for the
initial view and the 'design' view) I found (using Firebug) that the
references to the static files look like this:


Re: [web2py] Re: Join might work? Table limits?

2013-10-31 Thread Diogo Munaro
Yes, web2py is not ok with it. Making 3 or 4 explicit joins and it gets
errors


2013/10/31 Vinicius Assef 

> That was my point, Diogo.
>
> Is there some fault when we have many explicit joins in DAL?
>
>
> On Wed, Oct 30, 2013 at 4:01 PM, Diogo Munaro 
> wrote:
> > Hi Vinicius!
> > The query with a lot of natural joins really don't work, but join with
> WHERE
> > worked.
> >
> > I don't know what happend, but web2py become crazy when I set more
> natural
> > joins
> >
> >
> > 2013/10/30 Vinicius Assef 
> >>
> >> Maybe I missed something, but why the simple query (with few joins)
> >> worked and the complex one (with many joins) didn't?
> >>
> >> On Wed, Oct 30, 2013 at 2:31 PM, Diogo Munaro 
> >> wrote:
> >> > Hi Michele, I'm looking here the results...
> >> >
> >> > If I get where and natural join is different.
> >> >
> >> > The explain is like that:
> >> >
> >> >
> http://stackoverflow.com/questions/15996226/natural-join-vs-where-in-clauses
> >> >
> >> > Here is massimo suggested code:
> >> >
> >> > mysql> explain SELECT  groups.name, city.name, auth_user.id,
> >> > auth_user.is_active, auth_user.created_on, auth_user.created_by,
> >> > auth_user.modified_on, auth_user.modified_by, auth_user.email,
> >> > auth_user.person_id, auth_user.password, auth_user.know_id,
> >> > auth_user.registration_key, auth_user.reset_password_key,
> >> > auth_user.registration_id FROM researcher, researcher_lab_permission,
> >> > lab,
> >> > groups, auth_user, city WHERE groups.id = lab.group_id) AND
> >> > (lab.id
> >> > = researcher_lab_permission.lab_id)) AND (researcher.id =
> >> > researcher_lab_permission.researcher_id)) AND (researcher.user_id =
> >> > auth_user.id)) AND (researcher_lab_permission.is_active = 'T')) AND
> >> > (lab.is_active = 'T')) AND (groups.is_active = 'T')) AND
> >> > (auth_user.is_active = 'T'))
> >> > -> ;
> >> >
> >> >
> ++-+---+++-+-++--++
> >> > | id | select_type | table | type   |
> possible_keys
> >> > | key | key_len | ref|
> >> > rows
> >> > | Extra  |
> >> >
> >> >
> ++-+---+++-+-++--++
> >> > |  1 | SIMPLE  | city  | ALL| NULL
> >> > | NULL| NULL| NULL   |
> >> > 5535
> >> > ||
> >> > |  1 | SIMPLE  | researcher_lab_permission | ALL|
> >> > researcher_id__idx,lab_id__idx | NULL| NULL| NULL
> >> > |2 | Using where; Using join buffer |
> >> > |  1 | SIMPLE  | lab   | eq_ref |
> >> > PRIMARY,group_id__idx  | PRIMARY | 4   |
> >> > labsyn.researcher_lab_permission.lab_id|1 | Using where
> >> > |
> >> > |  1 | SIMPLE  | groups| eq_ref | PRIMARY
> >> > | PRIMARY | 4   | labsyn.lab.group_id|
> >> > 1
> >> > | Using where|
> >> > |  1 | SIMPLE  | researcher| eq_ref |
> >> > PRIMARY,user_id__idx   | PRIMARY | 4   |
> >> > labsyn.researcher_lab_permission.researcher_id |1 |
> >> > |
> >> > |  1 | SIMPLE  | auth_user | eq_ref | PRIMARY
> >> > | PRIMARY | 4   | labsyn.researcher.user_id  |
> >> > 1
> >> > | Using where|
> >> >
> >> >
> ++-+---+++-+-++--++
> >> >
> >> >
> >> > Here is with JOIN:
> >> >
> >> > explain SELECT l.id,g.name,c.name FROM researcher_lab_permission as
> rl
> >> > JOIN
> >> > lab as l
> >> > -> JOIN researcher as r JOIN auth_user as a JOIN
> groups
> >> > as g
> >> > JOIN city as c
> >> > -> ON rl.researcher_id = r.id AND rl.lab_id = l.idAND
> >> > a.id
> >> > = r.user_id AND l.group_id = g.id
> >> > -> AND c.id = g.city_id
> >> > -> ;
> >> >
> >> >
> ++-+---+++-+-+-+--++
> >> > | id | select_type | table | type   | possible_keys  |
> >> > key
> >> > | key_len | ref | rows | Extra
> >> > |
> >> >
> >> >
> ++-+---+++-+-+-+--++
> >> > |  1 | SIMPLE  | l | index  | PRIMARY,group_id__idx  |
> >> > group_id__idx   |

Re: [web2py] What is inserting '_2.7.3' into my static url's?

2013-10-31 Thread Kiran Subbaraman
Am not sure what is causing the issue. But reading this bit of the 
documentation may give you a clue: 
http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On 10/31/2013 5:52 PM, Johann Spies wrote:
Investing why admin on the server does not use CSS (at least for the 
initial view and the 'design' view) I found (using Firebug) that the 
references to the static files look like this:





404 Not Found

Not Found
The requested URL /admin/static/_2.7.3/js/jquery.js was not found 
on this server.


Apache/2.2.22 (Debian) Server at crest2.sun.ac.za 
 Port 443



I can not find what is causing this.  I suspect this happened with the 
upgrade to Web2py version 2.7.3.  At the moment the version is: 
Version 2.7.4-stable+timestamp.2013.10.21.21.29.21


I have rsynced the installation on the server to my local computer and 
there it does not happen when I run web2py from that rsynced version.


The server uses Apache2.

How do I correct this?  The files in admin/views does not contain that 
string. So something is inserting '_2.7.3'  whenever a static url is 
formed.


Regards
Johann


--
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google 
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to web2py+unsubscr...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: 2.4.7 problems

2013-10-31 Thread Arglanir
Hello everyone,
I encountered this problem on 2.2.1 myself, so I checked the trunk source 
code and it has not moved a lot since.
I investigated this problem and found the bug, and thus the correction:
https://code.google.com/p/web2py/issues/detail?id=1736#c1
You can now correct if for next version :-)
You're welcome.

Le lundi 21 octobre 2013 02:11:32 UTC+2, Mark Li a écrit :
>
> I've just encountered this problem myself, and I opened a ticket about 
> this since I couldn't find one already posted.
>
>
> http://code.google.com/p/web2py/issues/detail?id=1736&thanks=1736&ts=1382314136
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How do I recieve files in a regular post message?

2013-10-31 Thread Niphlod
if it's a multipart upload you'd have the corresponding FieldStorage 
instance on the request.post_vars

On Thursday, October 31, 2013 12:53:31 PM UTC+1, encompass wrote:
>
> I have various data I can handle but how do I handle the file upload?
> I can read the message from request.post_vars.file_data.  But how do I do 
> things like save it to my uploads directory (or another directory if 
> needed.)
> I am not using a tradition form because it's data I use in a very 
> different way.
> A phone app is sending the data as a post request. (In the quickest way to 
> describe it.)
> BR,
> Jason Brower
>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] change web2py application directory

2013-10-31 Thread Richard Vézina
Loïc, what I was saying is that you will get in trouble when you upgrade
web2py with this scenario... Migration from version of web2py to another is
sometime not straigh as it should and you found yourself having to go back
an forth between both version. In this situation you have sometime to make
changes to your app that are not backward compatible so you can't have only
one copy of your app in this case at least if you want to be flexible...
What I do is to copy my repo from one web2py version to another. My setup
is like this :

programmation/version_246/web2py/applications/myapp
programmation/version_247/web2py/applications/myapp
programmation/version_274/web2py/applications/myapp

myapp in each of these web2py version is a clone from the precedent version
of web2py. When I feel confortable that I will migrate definitly to a new
version I leave the old app behind that sit. It is not that clean, but it
had prove to be effective... And if I want to make cleanup I just have to
delete the old web2py version tree to make space.

Hope it help.

Richard






On Thu, Oct 31, 2013 at 6:09 AM, Kiran Subbaraman <
subbaraman.ki...@gmail.com> wrote:

>  Loic,
> I find this to be useful, primarily because I want to add just my web2py
> applications to source control, and not necessarily the web2py
> installation. Also, am developing this stuff on windows, and actually
> deploy it on ubuntu. I feel this separation of my apps from the web2py
> platform is useful in this sense too.
> Some details like:
> * Where to run the script from
> * Also an additional step would be to script the wget of the web2py
> install, and follow that up with this script automatically. This is
> something that could be contributed later on...
>
> Possible for you to add this to web2py slices, as a recipe? (
> http://www.web2pyslices.com/home).
> Thank you.
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On 10/31/2013 2:42 PM, Loïc wrote:
>
> For Windows users who are interested...
>
> Now I have 2 separate folders :
>
> |_web2py (containing web2py source files with default applications)
>|_...
>|_applications
>   |_admin
>   |_welcome
>
> |_web2py_apps (folder containing all my apps)
>|_app1
>|_app2
>|_...
>
> When I upgrade web2py , I replace the whole "web2py" folder
> Then I launch a little batch file stored in "web2py_apps" to recreate all
> directory junctions.
> Code here :
>
> *create_junctions.bat*
>  for /f "delims=" %%a In ('dir /ad/b  "./" ') Do mklink /J ..\web2py\
> applications\%%a .\%%a
> pause
>
>
>
> Le mercredi 30 octobre 2013 18:18:17 UTC+1, Loïc ESPERN a écrit :
>>
>> Good idea
>> I will make a try when upgrading my web2py repo...
>>
>> Thank you
>> Le 30 oct. 2013 16:01, "Richard Vézina"  a écrit :
>>
>>>  Loïc, just a thought... How will you manage the upgrade of web2py
>>> version? If you have only a single repo, you will make symlink in new
>>> version of web2py applications folder, but then you may face issue with the
>>> new version that force you to stick with previous version... If you have
>>> commit change over your trunk you will have to revert...
>>>
>>>  I generally just copy my entire repo, that become a clone...
>>>
>>>  Richard
>>>
>>>
>>> On Wed, Oct 30, 2013 at 10:56 AM, Richard Vézina 
>>> wrote:
>>>
 Great!

  :)

  Richard


 On Wed, Oct 30, 2013 at 10:11 AM, Loïc  wrote:

> I have found the problem. Thank you Richard!
>
> For Windows users who want to move the applications subfolders out of
> web2py directory, the correct syntax is :
>  mklink /J TheLinkName ThePath
>
> mklink /J created a directory junction
> Previously, I used mklink /D (which creates a symlink for a folder)
> but this doesn't work.
>
>
>
>
> Le mercredi 30 octobre 2013 14:53:31 UTC+1, Richard a écrit :
>>
>> http://en.wikipedia.org/wiki/H**ard_link
>>
>>
>>  On Wed, Oct 30, 2013 at 9:52 AM, Richard Vézina <
>> ml.richa...@gmail.com> wrote:
>>
>>>  Hmmm... I pretty sure in linux a symlink would work, but in win it
>>> is different... If I remember there is a difference in hardlink and
>>> softlink that need to be consider...
>>>
>>>  Richard
>>>
>>>
>>> On Wed, Oct 30, 2013 at 4:06 AM, Loïc  wrote:
>>>
 Some weeks ago, I tried to create a symlink inside /applications
 folder, but I got an error in modules.
 I was using mklink command on Win7, and my app works fine when
 located inside /applications folder without symlink...

 Below is the ticket I got. Maybe you have an idea?

 Ticket ID

 127.0.0.1.2013-09-25.13-53-37.**347db33f-279e-4ae1-b231-669046**
 61519e
  No module named
 espern.modules.models_tools
 Version
 web2py™ Versio

Re: [web2py] Re: Testing redirection with py.test

2013-10-31 Thread Richard Vézina
I would like to help you Vinicius, what could I do?

Richard


On Thu, Oct 31, 2013 at 6:29 AM, Vinicius Assef wrote:

> Good idea.
>
> I'll make it, but it is based on a previous work [1]. I need improve
> docs for it.
>
> [1] http://github.com/viniciusban/web2py.test
>
> On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
>  wrote:
> > Can you please make a web2py slice about this?
> >
> >
> > On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
> >>
> >> I created this gist to help people testing controllers that makes
> >> redirection:
> >> https://gist.github.com/viniciusban/7206413
> >>
> >> Hope it helps someone.
> >
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to web2py+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: SQLFORM factory field width is less than the text on IE8, works fine on FF

2013-10-31 Thread Paolo Caruccio
By applying Server-side DOM and parsing (
http://web2py.com/books/default/chapter/29/05/the-views?search=DOM#parent-and-siblings)
 
you could use:

 my_select = form.element('select[name=TestField]')
 my_select_parent = my_select.parent
 my_select_parent['_style'] ='width:400px;'



Il giorno giovedì 31 ottobre 2013 04:54:51 UTC+1, Sarbjit ha scritto:
>
>
> Thanks for reply.
>
> Well, this issue that I am observing is not specific to my system only, I 
> tried it on two other systems in IE8 and all of them were having the same 
> issue.
>
> Anyways, I was able to get the exact width in IE, if I added a width of 
> 400px to TD element containing the SELECT. So, I modified the web2py.css 
> and added width for TD.w2p_fw and it resolved the issue. 
>
> One question is :
>
> What If I had to modify the style using my controller i.e I want to modify 
> the style for the element using controller only and not modifying the css 
> file. What should be the code for the same.
>
>
> -Sarbjit
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Loading message using web2py_ajax_page

2013-10-31 Thread Tito Garrido
Hi Folks,

Is there a way to render a loading message while web2py_ajax_page is
redering the component?


Thanks,

Tito

-- 

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] What is inserting '_2.7.3' into my static url's?

2013-10-31 Thread Richard Vézina
This should be something forget in web2py code I guess, or the activate
response.static_version

But I think it has been forget, since response.static_version should be
from your app.

Anyway to workaround this you have to configure appache, read the doc form
the link post by Kiran above.

:)

Richard


On Thu, Oct 31, 2013 at 9:08 AM, Kiran Subbaraman <
subbaraman.ki...@gmail.com> wrote:

>  Am not sure what is causing the issue. But reading this bit of the
> documentation may give you a clue:
> http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management
>
> 
> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>
> On 10/31/2013 5:52 PM, Johann Spies wrote:
>
> Investing why admin on the server does not use CSS (at least for the
> initial view and the 'design' view) I found (using Firebug) that the
> references to the static files look like this:
>
> 

[web2py] Re: can grid export represented values rather than raw db values?

2013-10-31 Thread Massimo Di Pierro
This is a big can of worms. represents will often do recursive selects (one 
per records). When you export all you data in CSV we cannot call it for 
every record.

If that's what you want to do and keep performance, you need to 
de-normalize your database.


On Thursday, 31 October 2013 00:50:08 UTC-5, weheh wrote:
>
> My grid has a bunch of its data created with .represent. I want to export 
> this in CSV format. The export class dumps raw underlying data without the 
> represent values shown by the grid. Is there a way to get export to put out 
> the represented format used by grid? Or do I have to write a custom 
> exporter that loops through all the rows and does lambda substitutions 
> again?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Testing redirection with py.test

2013-10-31 Thread Vinicius Assef
Thank you, Richard.

Basically, I need to isolate web2py.test from my example app and
prepare better examples.



On Thu, Oct 31, 2013 at 11:59 AM, Richard Vézina
 wrote:
> I would like to help you Vinicius, what could I do?
>
> Richard
>
>
> On Thu, Oct 31, 2013 at 6:29 AM, Vinicius Assef 
> wrote:
>>
>> Good idea.
>>
>> I'll make it, but it is based on a previous work [1]. I need improve
>> docs for it.
>>
>> [1] http://github.com/viniciusban/web2py.test
>>
>> On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
>>  wrote:
>> > Can you please make a web2py slice about this?
>> >
>> >
>> > On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
>> >>
>> >> I created this gist to help people testing controllers that makes
>> >> redirection:
>> >> https://gist.github.com/viniciusban/7206413
>> >>
>> >> Hope it helps someone.
>> >
>> > --
>> > Resources:
>> > - http://web2py.com
>> > - http://web2py.com/book (Documentation)
>> > - http://github.com/web2py/web2py (Source code)
>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> > ---
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "web2py-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to web2py+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Join might work? Table limits?

2013-10-31 Thread Massimo Di Pierro
Are you sure you do not want left joins? Except for this query (db.city.id == 
db.groups.city_id) everything else seems un-necessary to me and perhaps 
should be a left join. Perhaps that's what is confusing the DB too.

On Thursday, 31 October 2013 07:50:47 UTC-5, Diogo Munaro wrote:
>
> Yes, web2py is not ok with it. Making 3 or 4 explicit joins and it gets 
> errors
>
>
> 2013/10/31 Vinicius Assef >
>
>> That was my point, Diogo.
>>
>> Is there some fault when we have many explicit joins in DAL?
>>
>>
>> On Wed, Oct 30, 2013 at 4:01 PM, Diogo Munaro 
>> > 
>> wrote:
>> > Hi Vinicius!
>> > The query with a lot of natural joins really don't work, but join with 
>> WHERE
>> > worked.
>> >
>> > I don't know what happend, but web2py become crazy when I set more 
>> natural
>> > joins
>> >
>> >
>> > 2013/10/30 Vinicius Assef >
>> >>
>> >> Maybe I missed something, but why the simple query (with few joins)
>> >> worked and the complex one (with many joins) didn't?
>> >>
>> >> On Wed, Oct 30, 2013 at 2:31 PM, Diogo Munaro 
>> >> 
>> >
>> >> wrote:
>> >> > Hi Michele, I'm looking here the results...
>> >> >
>> >> > If I get where and natural join is different.
>> >> >
>> >> > The explain is like that:
>> >> >
>> >> > 
>> http://stackoverflow.com/questions/15996226/natural-join-vs-where-in-clauses
>> >> >
>> >> > Here is massimo suggested code:
>> >> >
>> >> > mysql> explain SELECT  groups.name, city.name, auth_user.id,
>> >> > auth_user.is_active, auth_user.created_on, auth_user.created_by,
>> >> > auth_user.modified_on, auth_user.modified_by, auth_user.email,
>> >> > auth_user.person_id, auth_user.password, auth_user.know_id,
>> >> > auth_user.registration_key, auth_user.reset_password_key,
>> >> > auth_user.registration_id FROM researcher, researcher_lab_permission,
>> >> > lab,
>> >> > groups, auth_user, city WHERE groups.id = lab.group_id) AND
>> >> > (lab.id
>> >> > = researcher_lab_permission.lab_id)) AND (researcher.id =
>> >> > researcher_lab_permission.researcher_id)) AND (researcher.user_id =
>> >> > auth_user.id)) AND (researcher_lab_permission.is_active = 'T')) AND
>> >> > (lab.is_active = 'T')) AND (groups.is_active = 'T')) AND
>> >> > (auth_user.is_active = 'T'))
>> >> > -> ;
>> >> >
>> >> > 
>> ++-+---+++-+-++--++
>> >> > | id | select_type | table | type   | 
>> possible_keys
>> >> > | key | key_len | ref   
>>  |
>> >> > rows
>> >> > | Extra  |
>> >> >
>> >> > 
>> ++-+---+++-+-++--++
>> >> > |  1 | SIMPLE  | city  | ALL| NULL
>> >> > | NULL| NULL| NULL   
>> |
>> >> > 5535
>> >> > ||
>> >> > |  1 | SIMPLE  | researcher_lab_permission | ALL|
>> >> > researcher_id__idx,lab_id__idx | NULL| NULL| NULL
>> >> > |2 | Using where; Using join buffer |
>> >> > |  1 | SIMPLE  | lab   | eq_ref |
>> >> > PRIMARY,group_id__idx  | PRIMARY | 4   |
>> >> > labsyn.researcher_lab_permission.lab_id|1 | Using where
>> >> > |
>> >> > |  1 | SIMPLE  | groups| eq_ref | PRIMARY
>> >> > | PRIMARY | 4   | labsyn.lab.group_id   
>>  |
>> >> > 1
>> >> > | Using where|
>> >> > |  1 | SIMPLE  | researcher| eq_ref |
>> >> > PRIMARY,user_id__idx   | PRIMARY | 4   |
>> >> > labsyn.researcher_lab_permission.researcher_id |1 |
>> >> > |
>> >> > |  1 | SIMPLE  | auth_user | eq_ref | PRIMARY
>> >> > | PRIMARY | 4   | labsyn.researcher.user_id 
>>  |
>> >> > 1
>> >> > | Using where|
>> >> >
>> >> > 
>> ++-+---+++-+-++--++
>> >> >
>> >> >
>> >> > Here is with JOIN:
>> >> >
>> >> > explain SELECT l.id,g.name,c.name FROM researcher_lab_permission as 
>> rl
>> >> > JOIN
>> >> > lab as l
>> >> > -> JOIN researcher as r JOIN auth_user as a JOIN 
>> groups
>> >> > as g
>> >> > JOIN city as c
>> >> > -> ON rl.researcher_id = r.id AND rl.lab_id = l.idAND
>> >> > a.id
>> >> > = r.user_id AND l.group_id = g.id
>> >> > -> AND c.id = g.city_id
>> >> > -> ;
>> >> >
>> >> > 
>> ++-+---+++-+-+-+--+--

[web2py] _filter_fields

2013-10-31 Thread Carlos Zenteno
Where can I find info about _filter_fields?

What does it do?

def 
_filter_fields
(self, record, id=False): 
   return dict([(k, v) for (k, v) in 
record.iteritems
() if k in 
self.fields 
and (self[k].type!='id' or id)])

Can somebody help me explaining the above code?

Thanks...
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Testing redirection with py.test

2013-10-31 Thread Richard Vézina
Ok, I get web2py.test and web2py 2.7.4 (I will test at the same time that
web2py.test works well with it).

Now, https://gist.github.com/viniciusban/7206413 seems just a example...
Should I just add it to web2py.test app?

Richard


On Thu, Oct 31, 2013 at 11:39 AM, Vinicius Assef wrote:

> Thank you, Richard.
>
> Basically, I need to isolate web2py.test from my example app and
> prepare better examples.
>
>
>
> On Thu, Oct 31, 2013 at 11:59 AM, Richard Vézina
>  wrote:
> > I would like to help you Vinicius, what could I do?
> >
> > Richard
> >
> >
> > On Thu, Oct 31, 2013 at 6:29 AM, Vinicius Assef 
> > wrote:
> >>
> >> Good idea.
> >>
> >> I'll make it, but it is based on a previous work [1]. I need improve
> >> docs for it.
> >>
> >> [1] http://github.com/viniciusban/web2py.test
> >>
> >> On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
> >>  wrote:
> >> > Can you please make a web2py slice about this?
> >> >
> >> >
> >> > On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
> >> >>
> >> >> I created this gist to help people testing controllers that makes
> >> >> redirection:
> >> >> https://gist.github.com/viniciusban/7206413
> >> >>
> >> >> Hope it helps someone.
> >> >
> >> > --
> >> > Resources:
> >> > - http://web2py.com
> >> > - http://web2py.com/book (Documentation)
> >> > - http://github.com/web2py/web2py (Source code)
> >> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> >> > ---
> >> > You received this message because you are subscribed to the Google
> >> > Groups
> >> > "web2py-users" group.
> >> > To unsubscribe from this group and stop receiving emails from it, send
> >> > an
> >> > email to web2py+unsubscr...@googlegroups.com.
> >> > For more options, visit https://groups.google.com/groups/opt_out.
> >>
> >> --
> >> Resources:
> >> - http://web2py.com
> >> - http://web2py.com/book (Documentation)
> >> - http://github.com/web2py/web2py (Source code)
> >> - https://code.google.com/p/web2py/issues/list (Report Issues)
> >> ---
> >> You received this message because you are subscribed to the Google
> Groups
> >> "web2py-users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to web2py+unsubscr...@googlegroups.com.
> >> For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
> > --
> > Resources:
> > - http://web2py.com
> > - http://web2py.com/book (Documentation)
> > - http://github.com/web2py/web2py (Source code)
> > - https://code.google.com/p/web2py/issues/list (Report Issues)
> > ---
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to web2py+unsubscr...@googlegroups.com.
> > For more options, visit https://groups.google.com/groups/opt_out.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] add / append to db() set?

2013-10-31 Thread Richard
Hello,

I found this solution :

where_1 = (db.auth_user.first_name == 'Jambon')
where_2 = (db.auth_user.last_name == 'Forêt Noir')
where_3 = ''
where_4 = ''
where_5 = ''
where_6 = ''

where_clauses = {'where_1': where_1, 
 'where_2': where_2, 'where_3': where_3, 
 'where_4': where_4, 'where_5': where_5, 
 'where_6': where_6}

where_clauses_list = []
for k, value in where_clauses.iteritems():
if value:
where_clauses_list.append(k)
if len(where_clauses_list) == 2:
test123 = db(where_clauses[where_clauses_list[0]] & 
where_clauses[where_clauses_list[1]])

 
myselect = test123.select(db.auth_user.ALL)

But I would like to know it there is a better/simpler way to create a db() 
set for a finite number of where clauses ((db.auth_user.field ...) == one 
where clause) ?

Thanks

Richard

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: _filter_fields

2013-10-31 Thread Anthony
It takes a dictionary-like object (e.g., a web2py Storage object, such as 
request.vars) and converts it to a dictionary that includes only keys whose 
names match the fields in the given DAL Table -- so it filters out any keys 
that are not associated with fields in the table. It is useful if you want 
to insert request.vars into a database table but request.vars includes some 
variables that do not belong to the table (e.g., when you use 
SQLFORM.factory to create a form based on more than one database table).

Anthony

On Thursday, October 31, 2013 12:06:43 PM UTC-4, Carlos Zenteno wrote:
>
> Where can I find info about _filter_fields?
>
> What does it do?
>
> def 
> _filter_fields
> (self, record, id=False): 
>return dict([(k, v) for (k, v) in 
> record.iteritems
> () if k in 
> self.fields 
> and (self[k].type!='id' or id)])
>
> Can somebody help me explaining the above code?
>
> Thanks...
>  
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Testing redirection with py.test

2013-10-31 Thread Richard Vézina
Wait, I didn't read carefully web2py.test more complex than I thought, I
thought it was just an app.

I will set up a virtualenv.

Richard


On Thu, Oct 31, 2013 at 12:08 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Ok, I get web2py.test and web2py 2.7.4 (I will test at the same time that
> web2py.test works well with it).
>
> Now, https://gist.github.com/viniciusban/7206413 seems just a example...
> Should I just add it to web2py.test app?
>
> Richard
>
>
> On Thu, Oct 31, 2013 at 11:39 AM, Vinicius Assef wrote:
>
>> Thank you, Richard.
>>
>> Basically, I need to isolate web2py.test from my example app and
>> prepare better examples.
>>
>>
>>
>> On Thu, Oct 31, 2013 at 11:59 AM, Richard Vézina
>>  wrote:
>> > I would like to help you Vinicius, what could I do?
>> >
>> > Richard
>> >
>> >
>> > On Thu, Oct 31, 2013 at 6:29 AM, Vinicius Assef 
>> > wrote:
>> >>
>> >> Good idea.
>> >>
>> >> I'll make it, but it is based on a previous work [1]. I need improve
>> >> docs for it.
>> >>
>> >> [1] http://github.com/viniciusban/web2py.test
>> >>
>> >> On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
>> >>  wrote:
>> >> > Can you please make a web2py slice about this?
>> >> >
>> >> >
>> >> > On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
>> >> >>
>> >> >> I created this gist to help people testing controllers that makes
>> >> >> redirection:
>> >> >> https://gist.github.com/viniciusban/7206413
>> >> >>
>> >> >> Hope it helps someone.
>> >> >
>> >> > --
>> >> > Resources:
>> >> > - http://web2py.com
>> >> > - http://web2py.com/book (Documentation)
>> >> > - http://github.com/web2py/web2py (Source code)
>> >> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> >> > ---
>> >> > You received this message because you are subscribed to the Google
>> >> > Groups
>> >> > "web2py-users" group.
>> >> > To unsubscribe from this group and stop receiving emails from it,
>> send
>> >> > an
>> >> > email to web2py+unsubscr...@googlegroups.com.
>> >> > For more options, visit https://groups.google.com/groups/opt_out.
>> >>
>> >> --
>> >> Resources:
>> >> - http://web2py.com
>> >> - http://web2py.com/book (Documentation)
>> >> - http://github.com/web2py/web2py (Source code)
>> >> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "web2py-users" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> >> email to web2py+unsubscr...@googlegroups.com.
>> >> For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>> > --
>> > Resources:
>> > - http://web2py.com
>> > - http://web2py.com/book (Documentation)
>> > - http://github.com/web2py/web2py (Source code)
>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>> > ---
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "web2py-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to web2py+unsubscr...@googlegroups.com.
>> > For more options, visit https://groups.google.com/groups/opt_out.
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] add / append to db() set?

2013-10-31 Thread Massimo Di Pierro
yes.

where = [(db.auth_user.first_name == 'Jambon'), (db.auth_user.last_name == 
'Forêt Noir')] # etc etc
query = reduce(lambda a,b:a&b, where)
rows = db(query).select()


On Thursday, 31 October 2013 11:14:22 UTC-5, Richard wrote:
>
> Hello,
>
> I found this solution :
>
> where_1 = (db.auth_user.first_name == 'Jambon')
> where_2 = (db.auth_user.last_name == 'Forêt Noir')
> where_3 = ''
> where_4 = ''
> where_5 = ''
> where_6 = ''
>
> where_clauses = {'where_1': where_1, 
>  'where_2': where_2, 'where_3': where_3, 
>  'where_4': where_4, 'where_5': where_5, 
>  'where_6': where_6}
>
> where_clauses_list = []
> for k, value in where_clauses.iteritems():
> if value:
> where_clauses_list.append(k)
> if len(where_clauses_list) == 2:
> test123 = db(where_clauses[where_clauses_list[0]] & 
> where_clauses[where_clauses_list[1]])
>
>  
> myselect = test123.select(db.auth_user.ALL)
>
> But I would like to know it there is a better/simpler way to create a db() 
> set for a finite number of where clauses ((db.auth_user.field ...) == one 
> where clause) ?
>
> Thanks
>
> Richard
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: can grid export represented values rather than raw db values?

2013-10-31 Thread Michele Comitini
... or create a SQL view with the formats you need...


2013/10/31 Massimo Di Pierro 

> This is a big can of worms. represents will often do recursive selects
> (one per records). When you export all you data in CSV we cannot call it
> for every record.
>
> If that's what you want to do and keep performance, you need to
> de-normalize your database.
>
>
>
> On Thursday, 31 October 2013 00:50:08 UTC-5, weheh wrote:
>>
>> My grid has a bunch of its data created with .represent. I want to export
>> this in CSV format. The export class dumps raw underlying data without the
>> represent values shown by the grid. Is there a way to get export to put out
>> the represented format used by grid? Or do I have to write a custom
>> exporter that loops through all the rows and does lambda substitutions
>> again?
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] What is inserting '_2.7.3' into my static url's?

2013-10-31 Thread Niphlod
it's not a forgotten piece of codeit's there for a reason.

1) tell people about response.static_version
2) avoid any errors related to stale browser cache for the admin app files, 
that is getting more a javascript app than a python one

BTW, response.static_version is in web2py since Oct 2012, so a revised 
static alias in the setup (if needed) it's only going to keep people's 
setups updated with the current web2py setup scripts.

On Thursday, October 31, 2013 3:41:11 PM UTC+1, Richard wrote:
>
> This should be something forget in web2py code I guess, or the activate 
> response.static_version
>
> But I think it has been forget, since response.static_version should be 
> from your app.
>
> Anyway to workaround this you have to configure appache, read the doc form 
> the link post by Kiran above.
>
> :)
>
> Richard
>
>
> On Thu, Oct 31, 2013 at 9:08 AM, Kiran Subbaraman 
> 
> > wrote:
>
>>  Am not sure what is causing the issue. But reading this bit of the 
>> documentation may give you a clue: 
>> http://web2py.com/books/default/chapter/29/04/the-core#Static-asset-management
>>
>> 
>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>
>> On 10/31/2013 5:52 PM, Johann Spies wrote:
>>  
>> Investing why admin on the server does not use CSS (at least for the 
>> initial view and the 'design' view) I found (using Firebug) that the 
>> references to the static files look like this:
>>
>> 

[web2py] Re: Loading message using web2py_ajax_page

2013-10-31 Thread Niphlod
use the "content" attribute of the LOAD helper for that

http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components

On Thursday, October 31, 2013 3:15:24 PM UTC+1, Tito Garrido wrote:
>
> Hi Folks,
>
> Is there a way to render a loading message while web2py_ajax_page is 
> redering the component?
>
>
> Thanks,
>
> Tito
>
> -- 
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___ 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] What is inserting '_2.7.3' into my static url's?

2013-10-31 Thread Richard Vézina
Doh!

:)

Richard


On Thu, Oct 31, 2013 at 1:00 PM, Niphlod  wrote:

> it's not a forgotten piece of codeit's there for a reason.
>
> 1) tell people about response.static_version
> 2) avoid any errors related to stale browser cache for the admin app
> files, that is getting more a javascript app than a python one
>
> BTW, response.static_version is in web2py since Oct 2012, so a revised
> static alias in the setup (if needed) it's only going to keep people's
> setups updated with the current web2py setup scripts.
>
>
> On Thursday, October 31, 2013 3:41:11 PM UTC+1, Richard wrote:
>
>> This should be something forget in web2py code I guess, or the activate
>> response.static_version
>>
>> But I think it has been forget, since response.static_version should be
>> from your app.
>>
>> Anyway to workaround this you have to configure appache, read the doc
>> form the link post by Kiran above.
>>
>> :)
>>
>> Richard
>>
>>
>> On Thu, Oct 31, 2013 at 9:08 AM, Kiran Subbaraman 
>> wrote:
>>
>>>  Am not sure what is causing the issue. But reading this bit of the
>>> documentation may give you a clue: http://web2py.com/books/**
>>> default/chapter/29/04/the-**core#Static-asset-management
>>>
>>> __**__
>>> Kiran Subbaramanhttp://subbaraman.wordpress.**com/about/ 
>>> 
>>>
>>> On 10/31/2013 5:52 PM, Johann Spies wrote:
>>>
>>> Investing why admin on the server does not use CSS (at least for the
>>> initial view and the 'design' view) I found (using Firebug) that the
>>> references to the static files look like this:
>>>
>>> 

Re: [web2py] Re: Loading message using web2py_ajax_page

2013-10-31 Thread Tito Garrido
During the component load it is working, since I am using LOAD() function,
I am trying to refresh the component via a button click using
web2py_ajax_page... I guess there is no way to add a "loading" during the
refresh, right?

Regards,

Tito


On Thu, Oct 31, 2013 at 2:00 PM, Niphlod  wrote:

> use the "content" attribute of the LOAD helper for that
>
>
> http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components
>
>
> On Thursday, October 31, 2013 3:15:24 PM UTC+1, Tito Garrido wrote:
>>
>> Hi Folks,
>>
>> Is there a way to render a loading message while web2py_ajax_page is
>> redering the component?
>>
>>
>> Thanks,
>>
>> Tito
>>
>> --
>>
>> Linux User #387870
>> .
>>  _/_õ|__|
>> ..º[ .-.___.-._| . . . .
>> .__( o)__( o).:___
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>



-- 

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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] add / append to db() set?

2013-10-31 Thread Richard Vézina
Thank you Massimo,

It will be much simpler...

:)

Richard


On Thu, Oct 31, 2013 at 12:43 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> yes.
>
> where = [(db.auth_user.first_name == 'Jambon'), (db.auth_user.last_name ==
> 'Forêt Noir')] # etc etc
> query = reduce(lambda a,b:a&b, where)
> rows = db(query).select()
>
>
> On Thursday, 31 October 2013 11:14:22 UTC-5, Richard wrote:
>>
>> Hello,
>>
>> I found this solution :
>>
>> where_1 = (db.auth_user.first_name == 'Jambon')
>> where_2 = (db.auth_user.last_name == 'Forêt Noir')
>> where_3 = ''
>> where_4 = ''
>> where_5 = ''
>> where_6 = ''
>>
>> where_clauses = {'where_1': where_1,
>>  'where_2': where_2, 'where_3': where_3,
>>  'where_4': where_4, 'where_5': where_5,
>>  'where_6': where_6}
>>
>> where_clauses_list = []
>> for k, value in where_clauses.iteritems():
>> if value:
>> where_clauses_list.append(k)
>> if len(where_clauses_list) == 2:
>> test123 = db(where_clauses[where_**clauses_list[0]] &
>> where_clauses[where_clauses_**list[1]])
>>
>>
>> myselect = test123.select(db.auth_user.**ALL)
>>
>> But I would like to know it there is a better/simpler way to create a
>> db() set for a finite number of where clauses ((db.auth_user.field ...) ==
>> one where clause) ?
>>
>> Thanks
>>
>> Richard
>>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Alteração descrição de botões da SQLFORM.grid (Add, Delete)...

2013-10-31 Thread Carlynhos77
Ola, boa tarde

Estou usando a SQLFORM.grid para criar alguns formularios q nao necessitam 
de muito implemento... mas queria alterar algumas coisas, tipo o botao ADD, 
DELETE.. queria colocar tipo NOVO, DELETAR... com eu acesso ele atraves do 
ID do controle...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: _filter_fields

2013-10-31 Thread Carlos Zenteno
Thanks for the great explanation Anthony...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Form confirmation without ajax

2013-10-31 Thread kwebb
I am trying to add a confirmation step to SQLFORM.grid (and possibly 
SQLFORM.smartgrid eventually).
I would like this to work with browsers that disable java script .

For example, when deleteing a record, redirect to a confirmation URL that 
displays the details
of the object to be deleted with confirm/cancel choices, and then back to 
the orginal form
whatever decision is made.  Is the _before_delete callback part of the 
answer?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] embed image from variable

2013-10-31 Thread Michele Comitini
Maybe you want "embed" in html which is much cooler it requires only one
single request/response:

def index():
   form  = SQLFORM.factory(Field('x')).process()

   img64 = None

   if form.accepted:
 img = myplotfunction(form.vars.x)
 img64 = embed64(data=img,extension='image/png') # <- ! if img not png
 then change extension !
   return locals()

{{=form}}
{{if form.accepted:}}

{{pass}}





2013/10/31 Massimo Di Pierro 

> Not sure I understand. You have every piece you need.
>
> def index():
>form  = SQLFORM.factory(Field('x')).process()
>return locals()
>
> and in index.html()
>
> {{=form}}
> {{if form.accepted:}}
> 
> {{pass}}
>
>
> On Wednesday, 30 October 2013 14:55:50 UTC-5, Josh Myers wrote:
>>
>> I have all this working the same way as Massimo suggested with
>> matplotlib, no problems.
>>
>> But, I can't for the life of me figure out how to pass a variable into
>> the controller plot function from the view.  This would be so I can, for
>> example, ask the user to choose a variable through a form and then produce
>> a histogram of that variable with matplotlib.  Right now I have it working
>> but only if the variable for the histogram is preset in the controller plot
>> function.
>>
>> I tried to set the variable with request.vars like so:
>>
>> 
>>
>> And then simply use request.vars.myvar in the function:
>>
>> def myplotfunction():
>> ...
>>return ...
>>
>> Where am I going wrong?  I am misunderstanding syntax or how request.vars
>> works?
>>
>> I would appreciate any help.
>>
>> - Josh
>>
>>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: can grid export represented values rather than raw db values?

2013-10-31 Thread Anthony
If you can live with tab-delimited instead of comma delimited, the TSV 
format does exactly what you want (it actually downloads with a .csv 
extension, so it will open up in Excel as is). If you need CSV, perhaps you 
could copy the gluon.sqlhtml.ExportTSV class and just change the delimiter 
to a comma. Note, the HTML download also uses represent.

Also, outside of the grid, if you want to use represent in CSV exports, you 
can do rows.export_to_csv(..., represent=True).

Anthony

On Thursday, October 31, 2013 1:50:08 AM UTC-4, weheh wrote:
>
> My grid has a bunch of its data created with .represent. I want to export 
> this in CSV format. The export class dumps raw underlying data without the 
> represent values shown by the grid. Is there a way to get export to put out 
> the represented format used by grid? Or do I have to write a custom 
> exporter that loops through all the rows and does lambda substitutions 
> again?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Erro ao criar um campo no postgresql via codigo, e excluir manual...

2013-10-31 Thread Carlynhos77
Ola, boa tarde...

Pessoal, o tal do iniciante sobre ne... no meu projeto organizei o codigo 
no qual via codigo foram criados as tabelas/campos no banco de dados 
postgresql, dai tava tudo funcionando, eu na curiosidade adicionei mas uma 
linha para criar mais um campo numa tabela ja existente... verifiquei q o 
campo foi criado, dai eu ja dentro do postgresql apaguei esse campo 
manual... dai pronto, o sistema nao abre mais... dai eu apaguei todo o 
banco, para iniciar a geracao das tabelas, mas dá o erro:

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "C:\web2py\gluon\main.py", line 461, in wsgibase
session._try_store_in_db(request, response)
  File "C:\web2py\gluon\globals.py", line 1078, in _try_store_in_db
record_id = table.insert(**dd)
  File "C:\web2py\gluon\dal.py", line 8781, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File "C:\web2py\gluon\dal.py", line 1250, in insert
raise e
ProgrammingError: ERRO:  relação "web2py_session_info_saude" não existe
LINE 1: INSERT INTO web2py_session_info_saude(client_ip,locked,modif...
^

alguem pode me dizer algo sobre isso?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] web2py calendar

2013-10-31 Thread Ramesh Kumar
Web2py calendar or datepicker not working in firefox. Any idea why?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Erro ao criar um campo no postgresql via codigo, e excluir manual...

2013-10-31 Thread Carlynhos77
ola, percebi fazendo uns testes aqui.. q se eu tirar essa linha:

session.connect(request, response, db=db)

nao aparece o erro, mas tambem nao cria as tabelasrss

essa linha ta logo abaixo a conexao do banco de dados...


import psycopg2
db = DAL('postgres://postgres:123@localhost:5432/saude')

session.connect(request, response, db=db)





Em quinta-feira, 31 de outubro de 2013 16h18min54s UTC-2, Carlynhos77 
escreveu:
>
> Ola, boa tarde...
>
> Pessoal, o tal do iniciante sobre ne... no meu projeto organizei o codigo 
> no qual via codigo foram criados as tabelas/campos no banco de dados 
> postgresql, dai tava tudo funcionando, eu na curiosidade adicionei mas uma 
> linha para criar mais um campo numa tabela ja existente... verifiquei q o 
> campo foi criado, dai eu ja dentro do postgresql apaguei esse campo 
> manual... dai pronto, o sistema nao abre mais... dai eu apaguei todo o 
> banco, para iniciar a geracao das tabelas, mas dá o erro:
>
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
>
> Traceback (most recent call last):
>   File "C:\web2py\gluon\main.py", line 461, in wsgibase
> session._try_store_in_db(request, response)
>   File "C:\web2py\gluon\globals.py", line 1078, in _try_store_in_db
> record_id = table.insert(**dd)
>   File "C:\web2py\gluon\dal.py", line 8781, in insert
> ret =  self._db._adapter.insert(self, self._listify(fields))
>   File "C:\web2py\gluon\dal.py", line 1250, in insert
> raise e
> ProgrammingError: ERRO:  relação "web2py_session_info_saude" não existe
> LINE 1: INSERT INTO web2py_session_info_saude(client_ip,locked,modif...
> ^
>
> alguem pode me dizer algo sobre isso?
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Erro ao criar um campo no postgresql via codigo, e excluir manual...

2013-10-31 Thread LightDot
Could you please post in English?

This is an English list and it's impossible to follow either the questions 
or the answers for all of us that don't speak your language.

Thanks and regards


On Thursday, October 31, 2013 7:40:42 PM UTC+1, Carlynhos77 wrote:
>
> ola, percebi fazendo uns testes aqui.. q se eu tirar essa linha:
>
> session.connect(request, response, db=db)
>
> nao aparece o erro, mas tambem nao cria as tabelasrss
>
> essa linha ta logo abaixo a conexao do banco de dados...
>
>
> 
> import psycopg2
> db = DAL('postgres://postgres:123@localhost:5432/saude')
>
> session.connect(request, response, db=db)
>
>
> 
>
>
>
> Em quinta-feira, 31 de outubro de 2013 16h18min54s UTC-2, Carlynhos77 
> escreveu:
>>
>> Ola, boa tarde...
>>
>> Pessoal, o tal do iniciante sobre ne... no meu projeto organizei o codigo 
>> no qual via codigo foram criados as tabelas/campos no banco de dados 
>> postgresql, dai tava tudo funcionando, eu na curiosidade adicionei mas uma 
>> linha para criar mais um campo numa tabela ja existente... verifiquei q o 
>> campo foi criado, dai eu ja dentro do postgresql apaguei esse campo 
>> manual... dai pronto, o sistema nao abre mais... dai eu apaguei todo o 
>> banco, para iniciar a geracao das tabelas, mas dá o erro:
>>
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py\gluon\main.py", line 461, in wsgibase
>> session._try_store_in_db(request, response)
>>   File "C:\web2py\gluon\globals.py", line 1078, in _try_store_in_db
>> record_id = table.insert(**dd)
>>   File "C:\web2py\gluon\dal.py", line 8781, in insert
>> ret =  self._db._adapter.insert(self, self._listify(fields))
>>   File "C:\web2py\gluon\dal.py", line 1250, in insert
>> raise e
>> ProgrammingError: ERRO:  relação "web2py_session_info_saude" não existe
>> LINE 1: INSERT INTO web2py_session_info_saude(client_ip,locked,modif...
>> ^
>>
>> alguem pode me dizer algo sobre isso?
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Error creating a field in postgresql via code, and delete manual ...

2013-10-31 Thread Carlynhos77
Hello, good afternoon ...

Guys, this newcomer on the ne ... in my project I organized the code in 
which were created via code tables / fields in database postgresql, give 
everything was working, I added in curiosity but a line to create another 
field in a table already exists ... checked qo field was created, there I 
already deleted within the postgresql this field manual ... dai ready, the 
system does not open more ... hence I deleted the entire database to start 
the generation of the tables, but it gives the error:


I realized doing some tests here .. q if I take this line:

session.connect (request, response, db = db)

does not appear the error, but also does not create tables  rss

ta this line just below the connection of the database ...


Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Traceback (most recent call last):
  File "C:\web2py\gluon\main.py", line 461, in wsgibase
session._try_store_in_db(request, response)
  File "C:\web2py\gluon\globals.py", line 1078, in _try_store_in_db
record_id = table.insert(**dd)
  File "C:\web2py\gluon\dal.py", line 8781, in insert
ret =  self._db._adapter.insert(self, self._listify(fields))
  File "C:\web2py\gluon\dal.py", line 1250, in insert
raise e
ProgrammingError: ERRO:  relação "web2py_session_info_saude" não existe
LINE 1: INSERT INTO web2py_session_info_saude(client_ip,locked,modif...

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py calendar

2013-10-31 Thread Niphlod
here it does. post an app to reproduce the issue.

On Thursday, October 31, 2013 7:39:09 PM UTC+1, Ramesh Kumar wrote:
>
> Web2py calendar or datepicker not working in firefox. Any idea why?
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py resources

2013-10-31 Thread Andreas Wienes
Thanks for your feedback. I'll check the different Mercurial guides and 
update my website, if I find a better solution.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Loading message using web2py_ajax_page

2013-10-31 Thread Niphlod
if you dig into web2py.js you can find the way to do it, but it's not 
implemented by default.
this is because you could potentially replace a very large fragment of the 
page with a very little "loading..." content, and this can be bad from a ui 
interaction perspective.

try to elaborate on this, though

What the new hookable events enabled .. 

create a new app
1. fetch https://raw.github.com/HubSpot/pace/master/pace.js and put under 
static/js/pace.js
2. fetch 
https://raw.github.com/HubSpot/pace/master/themes/pace-theme-corner-indicator.cssand
 put under static/css/pace.css
3. alter layout.html 

.



.

4. put in controllers/default.py

def test():
script = """$(function() {
$(document).on('ajax:beforeSend', function() {
Pace.restart();
})
})"""
return dict(a=LOAD('default', 'thegrid.load', ajax=True), script=SCRIPT(
script))

def thegrid():
import time
time.sleep(5)
grid = SQLFORM.grid(db.auth_user, user_signature=False)
return dict(grid=grid)

5. enjoy clicking around /appname/default/test . 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py calendar

2013-10-31 Thread Ramesh Kumar
{{=INPUT(_name='Workingday',_type='date')}}

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py calendar

2013-10-31 Thread Niphlod
in web2py if you want the calendar widget attached to an input you should 
use _type="string" and _class="date" . What you're using is HTML5 new 
inputs, and that kind of support is outside the realm of web2py (because 
every browser will implement its own widget for HTML5 new input types).

On Thursday, October 31, 2013 8:37:52 PM UTC+1, Ramesh Kumar wrote:
>
> {{=INPUT(_name='Workingday',_type='date')}}
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py calendar

2013-10-31 Thread Ramesh Kumar
hmm its working. thanks

On Friday, 1 November 2013 01:10:25 UTC+5:30, Niphlod wrote:
>
> in web2py if you want the calendar widget attached to an input you should 
> use _type="string" and _class="date" . What you're using is HTML5 new 
> inputs, and that kind of support is outside the realm of web2py (because 
> every browser will implement its own widget for HTML5 new input types).
>
> On Thursday, October 31, 2013 8:37:52 PM UTC+1, Ramesh Kumar wrote:
>>
>> {{=INPUT(_name='Workingday',_type='date')}}
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Testing redirection with py.test

2013-10-31 Thread Vinicius Assef
Yes, that's the way to go. :-)

On Thu, Oct 31, 2013 at 2:28 PM, Richard Vézina
 wrote:
> Wait, I didn't read carefully web2py.test more complex than I thought, I
> thought it was just an app.
>
> I will set up a virtualenv.
>
> Richard
>
>
> On Thu, Oct 31, 2013 at 12:08 PM, Richard Vézina
>  wrote:
>>
>> Ok, I get web2py.test and web2py 2.7.4 (I will test at the same time that
>> web2py.test works well with it).
>>
>> Now, https://gist.github.com/viniciusban/7206413 seems just a example...
>> Should I just add it to web2py.test app?
>>
>> Richard
>>
>>
>> On Thu, Oct 31, 2013 at 11:39 AM, Vinicius Assef 
>> wrote:
>>>
>>> Thank you, Richard.
>>>
>>> Basically, I need to isolate web2py.test from my example app and
>>> prepare better examples.
>>>
>>>
>>>
>>> On Thu, Oct 31, 2013 at 11:59 AM, Richard Vézina
>>>  wrote:
>>> > I would like to help you Vinicius, what could I do?
>>> >
>>> > Richard
>>> >
>>> >
>>> > On Thu, Oct 31, 2013 at 6:29 AM, Vinicius Assef 
>>> > wrote:
>>> >>
>>> >> Good idea.
>>> >>
>>> >> I'll make it, but it is based on a previous work [1]. I need improve
>>> >> docs for it.
>>> >>
>>> >> [1] http://github.com/viniciusban/web2py.test
>>> >>
>>> >> On Thu, Oct 31, 2013 at 12:11 AM, Massimo Di Pierro
>>> >>  wrote:
>>> >> > Can you please make a web2py slice about this?
>>> >> >
>>> >> >
>>> >> > On Monday, 28 October 2013 18:13:22 UTC-5, viniciusban wrote:
>>> >> >>
>>> >> >> I created this gist to help people testing controllers that makes
>>> >> >> redirection:
>>> >> >> https://gist.github.com/viniciusban/7206413
>>> >> >>
>>> >> >> Hope it helps someone.
>>> >> >
>>> >> > --
>>> >> > Resources:
>>> >> > - http://web2py.com
>>> >> > - http://web2py.com/book (Documentation)
>>> >> > - http://github.com/web2py/web2py (Source code)
>>> >> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> >> > ---
>>> >> > You received this message because you are subscribed to the Google
>>> >> > Groups
>>> >> > "web2py-users" group.
>>> >> > To unsubscribe from this group and stop receiving emails from it,
>>> >> > send
>>> >> > an
>>> >> > email to web2py+unsubscr...@googlegroups.com.
>>> >> > For more options, visit https://groups.google.com/groups/opt_out.
>>> >>
>>> >> --
>>> >> Resources:
>>> >> - http://web2py.com
>>> >> - http://web2py.com/book (Documentation)
>>> >> - http://github.com/web2py/web2py (Source code)
>>> >> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> >> ---
>>> >> You received this message because you are subscribed to the Google
>>> >> Groups
>>> >> "web2py-users" group.
>>> >> To unsubscribe from this group and stop receiving emails from it, send
>>> >> an
>>> >> email to web2py+unsubscr...@googlegroups.com.
>>> >> For more options, visit https://groups.google.com/groups/opt_out.
>>> >
>>> >
>>> > --
>>> > Resources:
>>> > - http://web2py.com
>>> > - http://web2py.com/book (Documentation)
>>> > - http://github.com/web2py/web2py (Source code)
>>> > - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> > ---
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "web2py-users" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send
>>> > an
>>> > email to web2py+unsubscr...@googlegroups.com.
>>> > For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE compatability with recent web2py versions

2013-10-31 Thread David Manns
My case too was passing a list of values from a reference field.

On Wednesday, October 30, 2013 9:59:29 PM UTC-4, Massimo Di Pierro wrote:
>
> Belongs on GAE has always been supported. The cited code in version 2.7.4 
> is
>
> def BELONGS(self,first,second=None):
> if not isinstance(second,(list, tuple)):
> raise SyntaxError("Not supported")
> ...
>
> So perhaps you are passing something to belongs which is not a list or 
> tuple. It is possible that in the past we did not check.
>
> On Wednesday, 30 October 2013 13:28:05 UTC-5, Scott Hunter wrote:
>>
>> This doesn't sound very "backwards compatible" to me; I couldn't find any 
>> documentation that says belongs DOESN'T work in GAE, and it clearly used to 
>> (if imperfectly).
>>
>> So is the bug that it USED to work, or that it doesn't work now?
>>
>> On Wednesday, October 30, 2013 11:53:04 AM UTC-4, David Manns wrote:
>>>
>>> 'Belongs' was the problem. Older versions of web2py supported a limited 
>>> implementation of belongs (up to 30 items in the set) on GAE datastore. 
>>> Current version does not support 'belongs' on GAE datastore. I have worked 
>>> around this and now have my application working again. Thanks Scott and 
>>> Massimo.
>>>
>>> On Wednesday, October 30, 2013 7:39:54 AM UTC-4, David Manns wrote:

 Scott is probably right - I will do some experiments to check. Earlier 
 versions of web2py supported 'belongs' on GAE so long as the set contained 
 30 or fewer members (by experiment, not documented). I can see how this 
 limited support may have been dropped in a DAL rewrite!

 On Tuesday, October 29, 2013 9:49:35 PM UTC-4, Scott Hunter wrote:
>
> Don't know if this helps, but I see that the query for affl uses 
> belongs, and I'm seeing the following in my GAE log for a query that uses 
> belongs:
>
>   File 
>> "/Users/shunter/Dropbox/webdev/google_app_engine/mypptrials/gluon/dal.py",
>>  
>> line 4802, in BELONGS
>> raise SyntaxError("Not supported")
>
>
> I also see the same thing in your log.
>


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Ticket issued: unknown after upgrade to 2.7.4 from 2.4.6 and running on GAE SDK

2013-10-31 Thread David Manns
Running standalone in the web2py dev environment, errors produce good 
tickets.  However, when running in the GAE SDK, all I get is "Ticket 
issued: unknown". 

I have done these things that I found in the users group:

 Attention all users: For pre 2.6 applications to work with web2py 
>=2.6, you must copy static/js/web2py.js, controllers/appadmin.py, and 
views/appadmin.html from the welcome app to your own apps (all of them).

 Attention production users: The updated handlers and examples are in 
handlers/ and examples/. The updated ones will not override the existing 
ones. To use the new ones it is not sufficient to upgrade web2py, you also 
need to copy the desired handler/example in the root web2py/ folder.
 Attention all users: For pre 2.6 applications to work with web2py 
>=2.6, you must copy static/js/web2py.js, controllers/appadmin.py, and 
views/appadmin.html from the welcome app to your own apps (all of them).

 Attention production users: The updated handlers and examples are in 
handlers/ and examples/. The updated ones will not override the existing 
ones. To use the new ones it is not sufficient to upgrade web2py, you also 
need to copy the desired handler/example in the root web2py/ folder.

What else do I need to do?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Ticket issued: unknown after upgrade to 2.7.4 from 2.4.6 and running on GAE SDK

2013-10-31 Thread Richard Vézina
I have ticket issued: unknown when there is bad persmission on web2py
folder, sub-folder and files...

sudo chown -R www-data.www-data web2py/

Should do the tricks

Richard


On Thu, Oct 31, 2013 at 4:52 PM, David Manns  wrote:

> Running standalone in the web2py dev environment, errors produce good
> tickets.  However, when running in the GAE SDK, all I get is "Ticket
> issued: unknown".
>
> I have done these things that I found in the users group:
>
>  Attention all users: For pre 2.6 applications to work with web2py
> >=2.6, you must copy static/js/web2py.js, controllers/appadmin.py, and
> views/appadmin.html from the welcome app to your own apps (all of them).
>
>  Attention production users: The updated handlers and examples are in
> handlers/ and examples/. The updated ones will not override the existing
> ones. To use the new ones it is not sufficient to upgrade web2py, you also
> need to copy the desired handler/example in the root web2py/ folder.
>  Attention all users: For pre 2.6 applications to work with web2py
> >=2.6, you must copy static/js/web2py.js, controllers/appadmin.py, and
> views/appadmin.html from the welcome app to your own apps (all of them).
>
>  Attention production users: The updated handlers and examples are in
> handlers/ and examples/. The updated ones will not override the existing
> ones. To use the new ones it is not sufficient to upgrade web2py, you also
> need to copy the desired handler/example in the root web2py/ folder.
>
> What else do I need to do?
>
>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] SQLFORM.factory same table twice or more...

2013-10-31 Thread Diogo Munaro
Hey guys, it's possible to use sqlform to generate same table twice or more?

example:

form = SQLFORM.factory(db.item,db.item_image,db.item_image,db.item_image)

Is there exists a best way?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Multiple dbs foreign key

2013-10-31 Thread Diogo Munaro
Hello guys!

I'm using web2py to create new dbs automatically for each company that uses
my system. It's using a central DB for authentication and some default
tables.

I heard that somebody was developing an integration to work with these
foreign key inter dbs.

Here everything is working, except auth_user with auth.signature, but I
made a workaround using the default fields (createdby, is_active, etc...),
making index with executesql and mantaining integrity with IS_IN_DB.

IS_IN_DB works great! ex:

*db*.define_table('cool_table',
   Field('user_id', 'integer', requires=IS_IN_DB(*db2*,*db2*.auth_user_id)))

The worst problem is making a record_versioning.

If before this example table I force record_versioning it's create a backup
table, but the feature of make the versioning don't work :(

Example:
*
db*.define_table('cool_table',
Field('created_by', 'integer', requires=IS_EMPTY_OR(IS_IN_DB(db2,
db2.auth_user.id )),
widget=SQLFORM.widgets.options.widget),
   Field('created_on', 'datetime'),
   Field('modified_by', 'integer',
requires=IS_EMPTY_OR(IS_IN_DB(db2,
db2.auth_user.id)),
widget=SQLFORM.widgets.options.widget),
   Field('modified_on', 'datetime'))
db.cool_table._enable_record_versioning()

There is a best way to do it or I need to do my own record versioning?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] SQLFORM.factory same table twice or more...

2013-10-31 Thread Richard Vézina
Your table can't have the same field name :

http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=One+form+for+multiple+tables#Other-types-of-Forms
This only works when the tables don't have field names in common.

But you can .clone() your field :

https://groups.google.com/d/msg/web2py/FAvjWNUiC3Y/gV_4BPXZkw4J

Hope it helps

Richard




On Thu, Oct 31, 2013 at 5:05 PM, Diogo Munaro wrote:

> Hey guys, it's possible to use sqlform to generate same table twice or
> more?
>
> example:
>
> form = SQLFORM.factory(db.item,db.item_image,db.item_image,db.item_image)
>
> Is there exists a best way?
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] SQLFORM.factory same table twice or more...

2013-10-31 Thread Diogo Munaro
Thx Richard! Clone is amazing!!


2013/10/31 Richard Vézina 

> Your table can't have the same field name :
>
>
> http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=One+form+for+multiple+tables#Other-types-of-Forms
> This only works when the tables don't have field names in common.
>
> But you can .clone() your field :
>
> https://groups.google.com/d/msg/web2py/FAvjWNUiC3Y/gV_4BPXZkw4J
>
> Hope it helps
>
> Richard
>
>
>
>
> On Thu, Oct 31, 2013 at 5:05 PM, Diogo Munaro wrote:
>
>>  Hey guys, it's possible to use sqlform to generate same table twice or
>> more?
>>
>> example:
>>
>> form = SQLFORM.factory(db.item,db.item_image,db.item_image,db.item_image)
>>
>> Is there exists a best way?
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] represent of list:reference field

2013-10-31 Thread 黄祥

hi,

is there a way to have represent of list:reference field?
e.g.
models
db.define_table('book', 
Field('title'),
Field('cover', 'upload'),
format = '%(title)s')

db.define_table('course', 
Field('course_name'),
Field('description', 'text'),
Field('book', 'list:reference book'),
Field('lecturer', 'list:reference lecturer'),
Field('price', 'decimal(10,2)'),
format = '%(course_name)s')

db.define_table('registration', 
Field('registration_no'), 
Field('registration_date', 'date'), 
Field('student', 'reference student'),
Field('course', 'reference course'),
Field('price', 'decimal(10,2)'),
Field('registration_fee', 'decimal(10,2)'),
Field('total_price', 'decimal(10,2)'),
format = '%(student)s %(course)s')

controllers
def print_registration():
header = db(db.registration.id == request.args(0)).select().first()
return dict(header = header)

views
{{=header.course.book}}

it return
[1L, 2L]

how can show the other table field name (book title in registration) for 
example :
learning japanese language for beginner, japanese language daily 
conversation?

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: represent of list:reference field

2013-10-31 Thread Anthony
A list:reference field already gets a default "represent" attribute, as 
long as the referenced table has a "format" argument. However, the 
"represent" function (for any type of field) is only applied automatically 
in particular contexts (e.g., SQLTABLE, the grid, and read-only forms). In 
your case, you have to call it explicitly:

{{=db.course.book.represent(header.course.book)}}

Anthony

On Thursday, October 31, 2013 8:33:49 PM UTC-4, 黄祥 wrote:
>
>
> hi,
>
> is there a way to have represent of list:reference field?
> e.g.
> models
> db.define_table('book', 
> Field('title'),
> Field('cover', 'upload'),
> format = '%(title)s')
>
> db.define_table('course', 
> Field('course_name'),
> Field('description', 'text'),
> Field('book', 'list:reference book'),
> Field('lecturer', 'list:reference lecturer'),
> Field('price', 'decimal(10,2)'),
> format = '%(course_name)s')
>
> db.define_table('registration', 
> Field('registration_no'), 
> Field('registration_date', 'date'), 
> Field('student', 'reference student'),
> Field('course', 'reference course'),
> Field('price', 'decimal(10,2)'),
> Field('registration_fee', 'decimal(10,2)'),
> Field('total_price', 'decimal(10,2)'),
> format = '%(student)s %(course)s')
>
> controllers
> def print_registration():
> header = db(db.registration.id == request.args(0)).select().first()
> return dict(header = header)
>
> views
> {{=header.course.book}}
>
> it return
> [1L, 2L]
>
> how can show the other table field name (book title in registration) for 
> example :
> learning japanese language for beginner, japanese language daily 
> conversation?
>
> thanks and best regards,
> stifan
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Ticket issued: unknown after upgrade to 2.7.4 from 2.4.6 and running on GAE SDK

2013-10-31 Thread Scott Hunter
Did you look in the Logs in the GAE Dashboard for your app?  That should at 
least give you the trace for the error, so you are not flying completely 
blind.

- Scott

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: represent of list:reference field

2013-10-31 Thread 黄祥
great, it works, thank you so much for your detail explaination anthony. 
btw, i found the others method in this forum something like : 
{{=', '.join('%s %s' % (lecturer.first_name, lecturer.last_name) for 
lecturer in header.course.lecturer)}}

thanks and best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: GAE compatability with recent web2py versions

2013-10-31 Thread Massimo Di Pierro
Please open a ticket pointing this thread. We can add support for this.

On Thursday, 31 October 2013 15:11:59 UTC-5, David Manns wrote:
>
> My case too was passing a list of values from a reference field.
>
> On Wednesday, October 30, 2013 9:59:29 PM UTC-4, Massimo Di Pierro wrote:
>>
>> Belongs on GAE has always been supported. The cited code in version 2.7.4 
>> is
>>
>> def BELONGS(self,first,second=None):
>> if not isinstance(second,(list, tuple)):
>> raise SyntaxError("Not supported")
>> ...
>>
>> So perhaps you are passing something to belongs which is not a list or 
>> tuple. It is possible that in the past we did not check.
>>
>> On Wednesday, 30 October 2013 13:28:05 UTC-5, Scott Hunter wrote:
>>>
>>> This doesn't sound very "backwards compatible" to me; I couldn't find 
>>> any documentation that says belongs DOESN'T work in GAE, and it clearly 
>>> used to (if imperfectly).
>>>
>>> So is the bug that it USED to work, or that it doesn't work now?
>>>
>>> On Wednesday, October 30, 2013 11:53:04 AM UTC-4, David Manns wrote:

 'Belongs' was the problem. Older versions of web2py supported a limited 
 implementation of belongs (up to 30 items in the set) on GAE datastore. 
 Current version does not support 'belongs' on GAE datastore. I have worked 
 around this and now have my application working again. Thanks Scott and 
 Massimo.

 On Wednesday, October 30, 2013 7:39:54 AM UTC-4, David Manns wrote:
>
> Scott is probably right - I will do some experiments to check. Earlier 
> versions of web2py supported 'belongs' on GAE so long as the set 
> contained 
> 30 or fewer members (by experiment, not documented). I can see how this 
> limited support may have been dropped in a DAL rewrite!
>
> On Tuesday, October 29, 2013 9:49:35 PM UTC-4, Scott Hunter wrote:
>>
>> Don't know if this helps, but I see that the query for affl uses 
>> belongs, and I'm seeing the following in my GAE log for a query that 
>> uses 
>> belongs:
>>
>>   File 
>>> "/Users/shunter/Dropbox/webdev/google_app_engine/mypptrials/gluon/dal.py",
>>>  
>>> line 4802, in BELONGS
>>> raise SyntaxError("Not supported")
>>
>>
>> I also see the same thing in your log.
>>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] SELECT/OPTION field (optional)

2013-10-31 Thread Manu Mora
I want to do a SELECT/OPTION field in a form:

db.define_table('cows',
   Field('type','reference cows_types'),
  ...

db.cows.type.requires = IS_IN_DB(db, db.cows_types.id, '%(type)s')

But I want this field be optional and not mandatory

Thanks!!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: SQLFORM with multiple buttons how to differentiate

2013-10-31 Thread John Felps
OK, thanks. I found a workaround; by naming each button differently and 
instead of checking the value, just check for name in request.vars. 

On Wednesday, October 30, 2013 6:30:53 PM UTC-6, John Felps wrote:
>
> I have an sqlform that populates from a db and has several submit buttons 
> named test with different _values (and appear with different names on the 
> screen). In PHP, the post['test'] would be equal to the button value, 
> however, request.vars includes test, but it is always "Working..." on 
> submission. I need to perform tasks based on the input button for this 
> form. 
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] How to disable debug in production using spawn-fcgi with nginx?

2013-10-31 Thread Umair Ashraf
I have deployed my app but on production it shows stack trace an all info 
which is not intended. How can I disable this? I am not using custom views. 
I am just using routes and it's a very minimal app.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Regarding checkbox implementation in web2py??

2013-10-31 Thread Akash Agrawall
Hie guys I am a newbie in web2py
I have added a Field in the table which goes like this:
{ db.Field('category','list:reference 
Category',requires=IS_IN_DB(db,'Category.id','Category.Name',multiple=True)) 
}
how to implement it more as a checkbox type what is the syntax for 
it ??

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: IE11 vs gluon.contrib.user_agent - 'browser' key not existing anymore

2013-10-31 Thread Baptiste.T
Issue 1755 has just been created about this: 
https://code.google.com/p/web2py/issues/detail?id=1755

Thanks for the update.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: SELECT/OPTION field (optional)

2013-10-31 Thread Massimo Di Pierro
db.cows.type.requires = IS_EMPTY_OR(IS_IN_DB(db, db.cows_types.id, 
'%(type)s',zero=''))

On Thursday, 31 October 2013 03:17:09 UTC-5, Manu Mora wrote:
>
> I want to do a SELECT/OPTION field in a form:
>
> db.define_table('cows',
>Field('type','reference cows_types'),
>   ...
>
> db.cows.type.requires = IS_IN_DB(db, db.cows_types.id, '%(type)s')
>
> But I want this field be optional and not mandatory
>
> Thanks!!
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: IE11 vs gluon.contrib.user_agent - 'browser' key not existing anymore

2013-10-31 Thread Massimo Di Pierro
Should be fixed.

On Thursday, 31 October 2013 03:59:09 UTC-5, Baptiste.T wrote:
>
> Issue 1755 has just been created about this: 
> https://code.google.com/p/web2py/issues/detail?id=1755
>
> Thanks for the update.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Regarding checkbox implementation in web2py??

2013-10-31 Thread Diogo Munaro
Hi Akash!

Use:
db.Field('category','list:
reference
Category',requires=IS_IN_DB(db,'Category.id','Category.Name',multiple=True),
*widget=SQLFORM.widgets.checkboxes.widget*)

I think it works




2013/10/31 Akash Agrawall 

> Hie guys I am a newbie in web2py
> I have added a Field in the table which goes like this:
> { db.Field('category','list:reference
> Category',requires=IS_IN_DB(db,'Category.id','Category.Name',multiple=True))
> }
> how to implement it more as a checkbox type what is the syntax for
> it ??
>
>  --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.