[web2py] Re: error: no such table

2015-01-21 Thread Paolo Valleri
Hi,
why are you using fake_migrate?
it rebuilds web2py metadata.

Paolo
On Thursday, January 22, 2015 at 6:25:10 AM UTC+1, Dmitry Ermolaev wrote:
>
>  no such table: cp_mods
> Versionweb2py™Version 2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 
> 2.7.8: C:\Python27\python.exe (prefix: C:\Python27)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
>
> Traceback (most recent call last):
>   File "C:\web2py-9-12\gluon\restricted.py", line 224, in restricted
> exec ccode in environment
>   File "C:/web2py-9-12/applications/bs3b/models/db.py" 
> , line 615, in 
> 
> if len(db(db.cp_mods).select()) == 0:
>   File "C:\web2py-9-12\gluon\dal\objects.py", line 2066, in select
> return adapter.select(self.query,fields,attributes)
>   File "C:\web2py-9-12\gluon\dal\adapters\sqlite.py", line 125, in select
> return super(SQLiteAdapter, self).select(query, fields, attributes)
>   File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1232, in select
> return self._select_aux(sql,fields,attributes)
>   File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1197, in _select_aux
> self.execute(sql)
>   File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1319, in execute
> return self.log_execute(*a, **b)
>   File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1313, in log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
> OperationalError: no such table: cp_mods
>
>
> code:
> db = DAL("sqlite://storage.sqlite", # on PC locals
> folder='applications/shop/databases',
> pool_size=0,
> migrate=True,
> fake_migrate=True,
> check_reserved=['all'],
> )
> db.define_table('cp_mods', # вакансии
> Field('cms', length=30),
> fake_migrate=True,
> redefine=True,
> )
> if len(db(db.cp_mods).select()) == 0:
>db.cp_mods.truncate()
>db.cp_mods[0] = dict(cms = '_unknown_')
> ===
> my other tables is exist
>

-- 
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/d/optout.


[web2py] Re: error: load module

2015-01-21 Thread Dmitry Ermolaev
I delete all *.pyc files prom all apps
Then run app2 - *.pyc files is made
then run app1 - all impots sucess


четверг, 22 января 2015 г., 9:11:05 UTC+3 пользователь Dmitry Ermolaev 
написал:
>
> if in app2 delete all *.pyc files - all work
>
> четверг, 22 января 2015 г., 8:42:45 UTC+3 пользователь Dmitry Ermolaev 
> написал:
>>
>> in vers 2.9.12 error (in vers 2.5 all worked):
>>
>> in app1 I use import module from app2:
>> from applications.app2.modules.cp_api import check_ars
>>
>> in app2 code:
>> import module1
>>
>> rise error - 
>>  Cannot import module 
>> 'applications.bs3b.modules.orders_lib'Versionweb2py™Version 
>> 2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 2.7.8: 
>> C:\Python27\python.exe (prefix: C:\Python27)Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>>
>> Traceback (most recent call last):
>>   File "C:\web2py-9-12\gluon\restricted.py", line 224, in restricted
>> exec ccode in environment
>>   File "C:/web2py-9-12/applications/bs3b/controllers/bill.py" 
>> , line 
>> 423, in 
>>   File "C:\web2py-9-12\gluon\globals.py", line 393, in 
>> self._caller = lambda f: f()
>>   File "C:/web2py-9-12/applications/bs3b/controllers/bill.py" 
>> , line 
>> 310, in show
>> from applications.shop.modules.cp_api import check_ars
>>   File "C:\web2py-9-12\gluon\custom_import.py", line 105, in custom_importer
>> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>>   File "applications\shop\modules\cp_api.py", line 16, in 
>> import orders_lib
>>   File "C:\web2py-9-12\gluon\custom_import.py", line 86, in custom_importer
>> raise ImportError, 'Cannot import module %s' % str(e)
>> *ImportError: Cannot import module **'applications.bs3b.modules.orders_lib'*
>>
>>

-- 
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/d/optout.


[web2py] Re: error: load module

2015-01-21 Thread Dmitry Ermolaev
if in app2 delete all *.pyc files - all work

четверг, 22 января 2015 г., 8:42:45 UTC+3 пользователь Dmitry Ermolaev 
написал:
>
> in vers 2.9.12 error (in vers 2.5 all worked):
>
> in app1 I use import module from app2:
> from applications.app2.modules.cp_api import check_ars
>
> in app2 code:
> import module1
>
> rise error - 
>  Cannot import module 
> 'applications.bs3b.modules.orders_lib'Versionweb2py™Version 
> 2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 2.7.8: 
> C:\Python27\python.exe (prefix: C:\Python27)Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
>
> Traceback (most recent call last):
>   File "C:\web2py-9-12\gluon\restricted.py", line 224, in restricted
> exec ccode in environment
>   File "C:/web2py-9-12/applications/bs3b/controllers/bill.py" 
> , line 
> 423, in 
>   File "C:\web2py-9-12\gluon\globals.py", line 393, in 
> self._caller = lambda f: f()
>   File "C:/web2py-9-12/applications/bs3b/controllers/bill.py" 
> , line 
> 310, in show
> from applications.shop.modules.cp_api import check_ars
>   File "C:\web2py-9-12\gluon\custom_import.py", line 105, in custom_importer
> return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
>   File "applications\shop\modules\cp_api.py", line 16, in 
> import orders_lib
>   File "C:\web2py-9-12\gluon\custom_import.py", line 86, in custom_importer
> raise ImportError, 'Cannot import module %s' % str(e)
> *ImportError: Cannot import module **'applications.bs3b.modules.orders_lib'*
>
>

-- 
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/d/optout.


[web2py] syntax for "belongs" in IS_IN_DB

2015-01-21 Thread Alex Glaros
see anything wrong with "belongs" and IS_IN_DB off the top of your head, 
with this syntax?

db.Role.roleType.requires = IS_IN_DB(db, db.RoleType.id.belongs(2, 3, 5, 7, 
8, 9, 10, 17, 18, 19), '%(roleType)s',zero=T('choose one'))


thanks,

Alex Glaros

-- 
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/d/optout.


[web2py] error: load module

2015-01-21 Thread Dmitry Ermolaev
in vers 2.9.12 error:

in app1 I use import module from app2:
from applications.app2.modules.cp_api import check_ars

in app2 code:
import module1

rise error - 
 Cannot import module 
'applications.bs3b.modules.orders_lib'Versionweb2py™Version 
2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 2.7.8: 
C:\Python27\python.exe (prefix: C:\Python27)Traceback

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

Traceback (most recent call last):
  File "C:\web2py-9-12\gluon\restricted.py", line 224, in restricted
exec ccode in environment
  File "C:/web2py-9-12/applications/bs3b/controllers/bill.py" 
, line 423, 
in 
  File "C:\web2py-9-12\gluon\globals.py", line 393, in 
self._caller = lambda f: f()
  File "C:/web2py-9-12/applications/bs3b/controllers/bill.py" 
, line 310, 
in show
from applications.shop.modules.cp_api import check_ars
  File "C:\web2py-9-12\gluon\custom_import.py", line 105, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File "applications\shop\modules\cp_api.py", line 16, in 
import orders_lib
  File "C:\web2py-9-12\gluon\custom_import.py", line 86, in custom_importer
raise ImportError, 'Cannot import module %s' % str(e)
ImportError: Cannot import module 'applications.bs3b.modules.orders_lib'

-- 
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/d/optout.


[web2py] error: no such table

2015-01-21 Thread Dmitry Ermolaev
 no such table: cp_mods
Versionweb2py™Version 2.9.12-stable+timestamp.2015.01.17.06.11.03PythonPython 
2.7.8: C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.

Traceback (most recent call last):
  File "C:\web2py-9-12\gluon\restricted.py", line 224, in restricted
exec ccode in environment
  File "C:/web2py-9-12/applications/bs3b/models/db.py" 
, line 615, in 

if len(db(db.cp_mods).select()) == 0:
  File "C:\web2py-9-12\gluon\dal\objects.py", line 2066, in select
return adapter.select(self.query,fields,attributes)
  File "C:\web2py-9-12\gluon\dal\adapters\sqlite.py", line 125, in select
return super(SQLiteAdapter, self).select(query, fields, attributes)
  File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1232, in select
return self._select_aux(sql,fields,attributes)
  File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1197, in _select_aux
self.execute(sql)
  File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1319, in execute
return self.log_execute(*a, **b)
  File "C:\web2py-9-12\gluon\dal\adapters\base.py", line 1313, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
OperationalError: no such table: cp_mods


code:
db = DAL("sqlite://storage.sqlite", # on PC locals
folder='applications/shop/databases',
pool_size=0,
migrate=True,
fake_migrate=True,
check_reserved=['all'],
)
db.define_table('cp_mods', # вакансии
Field('cms', length=30),
fake_migrate=True,
redefine=True,
)
if len(db(db.cp_mods).select()) == 0:
   db.cp_mods.truncate()
   db.cp_mods[0] = dict(cms = '_unknown_')

-- 
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/d/optout.


[web2py] Re: export table to csv

2015-01-21 Thread Dave S


On Wednesday, January 21, 2015 at 5:17:49 PM UTC-8, Dave S wrote:
>
>
>
> On Wednesday, January 21, 2015 at 1:24:36 PM UTC-8, Yebach wrote:
>  
>
>> and one more question. Is there a way to name column headers in csv?
>>
>>
> Exporting, that seems to be done for you.
>
>  http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=import+csv#CSV--one-Table-at-a-time-
> >
> mentions that the import function looks for column names in the CSV header.
> In the appadmin database interface, I update one of my tables with a CSV 
> file all the time, and the first line of my file is
> id,colname1,colname2, etc
>
>
> A quick look at dal.py suggests that the importer doesn't support comment 
lines.

/dps
 

-- 
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/d/optout.


Re: [web2py] Re: Using a graph database with web2py

2015-01-21 Thread Dave S


On Wednesday, January 21, 2015 at 5:34:56 PM UTC-8, Michele Comitini wrote:
>
> if you intend a triple store, yes.  There is nothing stopping you from 
> using a triple store in web2py if it supports python.
>
>
Oooh, obviously I didn't parse the subject properly. Jumping onto WP to 
begin my remedial reading, I see mentions of AllegroGraph, Teradata Aster,
 and Weaver as supporting Python.  Weaver has BSD licenses.

/dps

-- 
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/d/optout.


Re: [web2py] Re: Using a graph database with web2py

2015-01-21 Thread Michele Comitini
if you intend a triple store, yes.  There is nothing stopping you from
using a triple store in web2py if it supports python.

2015-01-22 1:22 GMT+01:00 Dave S :

>
>
> On Wednesday, January 21, 2015 at 12:56:18 AM UTC-8, Y wrote:
>>
>> Hello
>>
>> Has anybody ever used a graph database with web2py. Is this possible?
>>
>>
> If you're wanting to pie graphs and line charts, there's this slice:
>
> http://www.web2pyslices.com/slice/show/1954/web2py-graph-with-rgraph>
>
> If you're looking for tool for directed cyclic graphs and/or solving the
> Bridges of Koenigsberg, then you need a different package, which I assume
> are out there, but the pieces are mostly simple, which is why I have parts
> of it in my homework folder from a data structures class.
>
> /dps
>
>  --
> 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/d/optout.
>

-- 
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/d/optout.


[web2py] Re: export table to csv

2015-01-21 Thread Dave S


On Wednesday, January 21, 2015 at 1:24:36 PM UTC-8, Yebach wrote:
 

> and one more question. Is there a way to name column headers in csv?
>
>
Exporting, that seems to be done for you.

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=import+csv#CSV--one-Table-at-a-time->
mentions that the import function looks for column names in the CSV header.
In the appadmin database interface, I update one of my tables with a CSV 
file all the time, and the first line of my file is
id,colname1,colname2, etc

/dps




-- 
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/d/optout.


Re: [web2py] Re: How to display data at top of nav bar

2015-01-21 Thread Richard Vézina
Hello Alex,

If you use the web2py default layout, the easiest way (if you don't want to
customize one yourself) would be to use jquery and add node to the dom.

Richard

On Tue, Jan 20, 2015 at 3:39 PM, Alex Glaros  wrote:

> want to know basic method for displaying data in nav bar.  For example,
> what is syntax for including something like this in nav bar:
>
> {{=numberOfFriendRequests}} friend requests for
> {{=auth.user_id}}
>
> and how to add a tiny envelope icon if possible
>
> thanks,
>
> Alex
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


Re: [web2py] web2py admin access with HTTPS, loopback 127.0.0.4

2015-01-21 Thread Richard Vézina
You may show us your config file for further help... It is easy to broke
config of apache when not using the script provided or tweaking config...
Is apache working? Did you define an password for web2py (parameters_443.py
in your case because you use httpS)? If you can get to the "Admin is
disabled because insecure channel" that mean you don't have
parameters_443.py file containing your admin password encrypted.

You can generate a new one like this :

sudo -u www-data python -c "from gluon.main import save_password;
save_password('123456',443)"

>From web2py folder.

Richard

On Tue, Jan 20, 2015 at 1:25 PM, rim bulls  wrote:

> Hello!
>
> I'm stuck, please help! :)
>
> Trying to setup web2py on FreeBSD jail, so no 127.0.0.1 is available in
> jail. Using Apache with SSL, mod_proxy, self signed SSL certs.
>
> Execute web2py: "python web2py.py -i localhost -p 7000 -a jyhag", web2py
> is listening on 127.0.0.4 (that's loopback address for jail). Apache
> configured as described in web2py book.
> I am connecting to "https://FQDN/admin"; and get "Admin is disabled
> because insecure channel".
> If I set web2py listen to real IP, same situation.
>
> Can I get some hint, please?
>
> Thanks in advance!
> Rimm
>
> --
> 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/d/optout.
>

-- 
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/d/optout.


[web2py] Re: Broke my button :-(

2015-01-21 Thread Dave S


On Wednesday, January 21, 2015 at 11:49:52 AM UTC-8, Anthony wrote:
>
> Dave had already responded with:
>
>>
>> Both the function for the page with the button and function the button 
>> loads (that is, stuff()) are in the default.py controller, and the relative 
>> URL is working for me, as long as javascript is enabled [author studies 
>> ceiling for a moment].
>>
>
> If the URL of the containing page is something like 
> http://yourdomain.com/default/parent (i.e., where "parent" is a function 
> in the default.py controller), then the "stuff.load" relative URL would 
> make a request to http://yourdomain.com/default/parent/stuff.load, which 
> presumably would not work. On the other hand, if you have "parent" set as 
> the default function for the default.py controller and the page URL is 
> instead just http://yourdomain.com/default/ (or even just 
> http://yourdomain.com/), then your relative URL will work -- but it will 
> break if you change the default function or include an ambiguous URL arg.
>
>
>
I haven't done anything with  routes.py, and parent != index, so I can't 
explain what I'm doing to make it work.  In yet another function inside 
default.py, I moved all the slow part into a component function (still 
within default.py) and used LOAD() to get the data into place, and for that 
I did have to specify "c='default'".

/dps

-- 
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/d/optout.


[web2py] Re: Using a graph database with web2py

2015-01-21 Thread Dave S


On Wednesday, January 21, 2015 at 12:56:18 AM UTC-8, Y wrote:
>
> Hello
>
> Has anybody ever used a graph database with web2py. Is this possible?
>
>
If you're wanting to pie graphs and line charts, there's this slice:

http://www.web2pyslices.com/slice/show/1954/web2py-graph-with-rgraph>

If you're looking for tool for directed cyclic graphs and/or solving the 
Bridges of Koenigsberg, then you need a different package, which I assume 
are out there, but the pieces are mostly simple, which is why I have parts 
of it in my homework folder from a data structures class.

/dps

-- 
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/d/optout.


[web2py] Re: Grid order for reference fields

2015-01-21 Thread Alex Glaros
I think Gael means that when he clicks the "view" button, the key id is 
displayed instead of the field description.  Anyone have an easy way to 
display that?

-- 
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/d/optout.


[web2py] Re: HELP!! Another upgrading failed for Apache running web2py

2015-01-21 Thread Leonel Câmara
Yes, clear for all the apps including admin. Has the admin application been 
updated too for the new version?

-- 
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/d/optout.


[web2py] Not a question, book suggestion

2015-01-21 Thread Otto Domínguez
I read about lazy_tables = True in the book. I used it at once. Then I read 
about smartgrid. I used it at once. But things did not work well with 
reference tables. Looking in this group, I became aware that lazy_tables = 
True impact negatively smartgrid's behavior with reference tables. A note 
in the book part about lazy_tables concerning smartgrid would be a welcome 
addition.

-- 
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/d/optout.


[web2py] export table to csv

2015-01-21 Thread Yebach
Hello

I am trying to create a one button click export to csv, so if a user click 
he gets a download popup without redirect to new page

my controller (script.py)

@auth.requires_login()
def excelExport():
import csv
import cStringIO
scriptId = request.args[0]
rows = db(db.result.r_id_script == scriptId).select(db.result.r_item1_name, 
db.result.r_date, db.result.r_time_start,db.result.r_time_end)
s = cStringIO.StringIO()
rows.export_to_csv_file(s, quoting=csv.QUOTE_ALL)
return s.getvalue()

and my view in views/script/view.html

  {{ if auth.is_logged_in():}}
{{=A(T('Export EXCEL'), _class='btn btn-primary', 
callback=URL('script','excelExport',  args = request.args[0]))}}
{{pass}}

Function is called but what am I missing to get a download window for file 
so user can save it as and where he wishes?

and one more question. Is there a way to name column headers in csv?

thank you




-- 
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/d/optout.


[web2py] Re: Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Spokes
Thanks, Niphlod. Guess this will be a bit less straightforward than I 
anticipated.

On Wednesday, January 21, 2015 at 3:46:36 PM UTC-5, Niphlod wrote:
>
> I don't think there's a T-SQL statement for it. 
> If you strongly need it, performance-wise, it's still best to 
> distinct/groupby on the backend and randomize on the frontend (via python).
>
> You can also randomize limitby parameters if you're feeling "random" at 
> this level (limiting correctly with the count of total results, so 2 
> queries needed in that case).
>
>
>

-- 
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/d/optout.


Re: [web2py] Re: After update 2.9.12, response.json is messing the screen

2015-01-21 Thread Niphlod


On Wednesday, January 21, 2015 at 9:36:09 PM UTC+1, André Kablu wrote:
>
> I was expecting someone tell me that I am using it wrong :)
>
> Since it was there and I was using it (wrong or not) for past 2 years... I 
> was not expecting its behavior to change...
>
> And I always consider testing my apps with trunk... bug I was focusing 
> tests on DAL... sometimes we don`t have much time...
>
> but ok no problem I will change my code...
>
> I just think it must be mention in the changelog that its behavior 
> changed... b/c others can have the same problem...
>
>
Unfortunately it pretty much goes in the same way, being it a feature 
1-month old or 6-years. 
We - maintainers - can't foresee the usage in your app of undocumented 
features and can't mention every commit in a CHANGELOG that  is not a 
bugfix, because from "our side", nobody raised an hand for it. 
We encourage everyone to contribute with tests because our life would be 
far easier: we'd propose a change being sure that nothing breaks.
This specific case is even worse, because the change came from a bug 
 and it got treated 
as one: no way we could have even considered to put it in the CHANGELOG. 
So, I humble bow before you and this "breakage" but - unfortunately - 
that's not going to save you, or anybody else in your situation, from being 
stinged a taddle bit after an upgrade. 

-- 
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/d/optout.


Re: [web2py] Re: HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Omi Chiba
Right, I think I just need to delete the app on pythonanywhere, install new
web2py from their installer and replace routes.py and my apps Hopefully
this works.

On Wed, Jan 21, 2015 at 2:34 PM, Niphlod  wrote:

> in this case it's not platform-dependency the issue: it's the method
> web2py uses for the upgrade-in-place.
> We should label it CLEARLY as "things can go wrong if you press this
> button" and live with it: there are just too much moving parts around an
> upgrade.
> Most of the times it works (and it did), but that does not need to imply a
> fail-proof process.
> Things can change, web2py is (most of the times) backwards compatible with
> app-code but not with apps artifacts coming from different versions , e.g.
> sessions (or cache) serialization due to speed improvements, and so on...
> we simply can't afford to live with years-old choices just for the sake of
> a working in-place upgrade.
>
> Given the build-up of recent-releases crashes/errors/whatnot I dare to say
> we'd need:
> - a "fail-proof" upgrade process documented in the book
> - label the infamous button on admin as "experimental" (proposed in the
> past, but never happened)
>
> It's really damn easy to upgrade web2py knowing its environment...
> - stop the webserver (or prepare a new empty folder leaving the old one
> running)
> - prune existing except of applications/ and/or routes.py-logging.conf-etc
> in the root (or copy applications/ and/or routes.py-logging.conf-etc to the
> new one)
> - unzip new web2py into the root (or the new folder)
> - clean sessions/cache folder for every app
> - start the webserver (or change the configuration of the webserver to
> pick up from the new folder)
>
> voilà.
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/eXIt4HaHF44/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/d/optout.


[web2py] Re: Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Niphlod
I don't think there's a T-SQL statement for it. 
If you strongly need it, performance-wise, it's still best to 
distinct/groupby on the backend and randomize on the frontend (via python).

You can also randomize limitby parameters if you're feeling "random" at 
this level (limiting correctly with the count of total results, so 2 
queries needed in that case).


-- 
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/d/optout.


[web2py] Re: Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Spokes
I tried db(query).select(limitby = (0, number_of_records), orderby = 
'', distinct = db.t_article['f_book_id']). It produces the error 
message:

 SELECT DISTINCT ON expressions must 
match initial ORDER BY expressions LINE 1: SELECT DISTINCT ON 
(t_article.f_book_id) t_book_i... ^ 
groupby produces a comparable error message. I take it that it wants the 
t_article.f_book_id field passed to orderby, but I'd like to have orderby = 
"". Any ideas on how to resolve this?



On Wednesday, January 21, 2015 at 3:08:14 PM UTC-5, Niphlod wrote:
>
> seems like a job for distinct=True (or a groupby) . Docs are here 
> 
>
> On Wednesday, January 21, 2015 at 7:09:41 PM UTC+1, Spokes wrote:
>>
>> I'd like a db(query).select(...) operation to return a set of rows in 
>> which there can only be one instance of a row with a particular value for a 
>> certain field. My query is like this:
>>
>> book_query = ((db.t_article.f_book_id != None) & 
>> (db.t_article.f_book_id == db.t_book_image.id))
>> article_image_query = (db.t_article_image.f_article_id == 
>> db.t_article.id)
>> query = [stuff pertaining to t_article] & (article_image_query | 
>> book_query)
>> 
>> The idea is to find all t_article entries within a certain time frame 
>> (that's the stuff in brackets, which has been omitted), which either have 
>> an image associated with them, or which reference a t_book entry which has 
>> an image associated with it.
>>
>> The select statement is like this:
>>
>> rows = db(query).select(limitby = (0, number_of_records), orderby = 
>> '')
>> 
>> I'd like the select statement to return no more than one row with a 
>> particular value for the f_book_id field. With the above select() statement 
>> as it is, it's possible for rows[0]['t_article']['f_book_id'], 
>> rows[1]['t_article']['f_book_id'], and rows[2]['t_article']['f_book_id'], 
>> for example, to have the same value. Is it possible to modify the above 
>> code so that in situations like the preceding, only one of those rows 
>> (doesn't matter which one) is returned, and assigned to the rows object? 
>> 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/d/optout.


Re: [web2py] Re: After update 2.9.12, response.json is messing the screen

2015-01-21 Thread Kablu®
I was expecting someone tell me that I am using it wrong :)

Since it was there and I was using it (wrong or not) for past 2 years... I
was not expecting its behavior to change...

And I always consider testing my apps with trunk... bug I was focusing
tests on DAL... sometimes we don`t have much time...

but ok no problem I will change my code...

I just think it must be mention in the changelog that its behavior
changed... b/c others can have the same problem...


On Wed, Jan 21, 2015 at 6:05 PM, Niphlod  wrote:

> pretty undocumented feature (so its not a bug per se)
>
> response.json() is clearly NOT meant to be used in views just use
> json(whatever) instead.
>
> on the "can I call it a bug of not" matter, that seems to surface every
> once in a while, please take the following as a word of caution (from the
> initial "heavy pusher" of Continous Integration in web2py)... the (hard ?)
> truth is that for a project the size of web2py, for all intents and
> purposes, as long as something is NOT included in the automated tests, you
> can't call a behavioural change as a bug (or a regression).
>
> If something changed and has been introduced in the core code it's because
> there WASN'T a test for it (or documentation about it in the book) at that
> time and someone proposed a valid usecase for it (that MAY NOT coincide
> with the usecase you're used to).
> In other words, given that:
> - the change seemed legit
> - nobody cared to add a test for it
> - there was no test case for it
> - it raised no alarms
>
> it went merged as a proper fix.
>
> Consider also that if you cared to test your app with trunk, you'd have
> noticed the issue starting from the 17-dec, and could have raised an issue
> before the stable release.
>
> Consider also that if you patch your controller with
>
> response.headers['Content-Type'] = 'text/html'
>
> before returning, also with the current stable version your issue will be
> resolved.
>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/l5CLfJ7cUHQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/d/optout.


[web2py] Re: HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Niphlod
in this case it's not platform-dependency the issue: it's the method web2py 
uses for the upgrade-in-place. 
We should label it CLEARLY as "things can go wrong if you press this 
button" and live with it: there are just too much moving parts around an 
upgrade.
Most of the times it works (and it did), but that does not need to imply a 
fail-proof process.
Things can change, web2py is (most of the times) backwards compatible with 
app-code but not with apps artifacts coming from different versions , e.g. 
sessions (or cache) serialization due to speed improvements, and so on... 
we simply can't afford to live with years-old choices just for the sake of 
a working in-place upgrade.

Given the build-up of recent-releases crashes/errors/whatnot I dare to say 
we'd need:
- a "fail-proof" upgrade process documented in the book
- label the infamous button on admin as "experimental" (proposed in the 
past, but never happened)

It's really damn easy to upgrade web2py knowing its environment... 
- stop the webserver (or prepare a new empty folder leaving the old one 
running)
- prune existing except of applications/ and/or routes.py-logging.conf-etc 
in the root (or copy applications/ and/or routes.py-logging.conf-etc to the 
new one)
- unzip new web2py into the root (or the new folder)
- clean sessions/cache folder for every app
- start the webserver (or change the configuration of the webserver to pick 
up from the new folder)

voilà.

-- 
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/d/optout.


[web2py] Re: HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Omi Chiba
I was overt-rusting the web2py because it always promise backward 
compatibility... but this time it's depanding on platform so no complains. 
Now I failed two upgrade work for both pytonanywhere and my windows 2012 
hosting server with apache... I just take one for the team and failed... : )

On Wednesday, January 21, 2015 at 2:11:31 PM UTC-6, Niphlod wrote:
>
> IMHO the issue with upgrading in place (always an HARD thing to do) is 
> that the upgrade method doesn't take into consideration to prune the 
> directory BEFORE installing the new version. 
>
> When no modules in gluon change (or when things gets added), there is no 
> issue however, this time with dal.py becoming dal/__init__.py things 
> ARE GOING to break.
>

-- 
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/d/optout.


[web2py] Re: stoping database insert in onvalidation

2015-01-21 Thread Niphlod
read the book about onvalidation 

 
. If you want to stop the form from being processed, you have to fill 
form.errors.some_field with something.

-- 
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/d/optout.


[web2py] Re: SQLFORM - field_id - not work

2015-01-21 Thread Niphlod
it's not a matter of "read-only". Grid uses urls like

/app/controller/function/tablename/id

for many things. Imagine what happens when "id" is really something like 
"https://www.google.com/?gfe_rd=cr&ei=mAjAVNLgGo2DcPzrgXA&gws_rd=ssl#q=web2py"; 
... 

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


[web2py] Re: HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Niphlod
IMHO the issue with upgrading in place (always an HARD thing to do) is that 
the upgrade method doesn't take into consideration to prune the directory 
BEFORE installing the new version. 

When no modules in gluon change (or when things gets added), there is no 
issue however, this time with dal.py becoming dal/__init__.py things 
ARE GOING to break.

-- 
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/d/optout.


[web2py] Re: Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Niphlod
seems like a job for distinct=True (or a groupby) . Docs are here 


On Wednesday, January 21, 2015 at 7:09:41 PM UTC+1, Spokes wrote:
>
> I'd like a db(query).select(...) operation to return a set of rows in 
> which there can only be one instance of a row with a particular value for a 
> certain field. My query is like this:
>
> book_query = ((db.t_article.f_book_id != None) & 
> (db.t_article.f_book_id == db.t_book_image.id))
> article_image_query = (db.t_article_image.f_article_id == 
> db.t_article.id)
> query = [stuff pertaining to t_article] & (article_image_query | 
> book_query)
> 
> The idea is to find all t_article entries within a certain time frame 
> (that's the stuff in brackets, which has been omitted), which either have 
> an image associated with them, or which reference a t_book entry which has 
> an image associated with it.
>
> The select statement is like this:
>
> rows = db(query).select(limitby = (0, number_of_records), orderby = 
> '')
> 
> I'd like the select statement to return no more than one row with a 
> particular value for the f_book_id field. With the above select() statement 
> as it is, it's possible for rows[0]['t_article']['f_book_id'], 
> rows[1]['t_article']['f_book_id'], and rows[2]['t_article']['f_book_id'], 
> for example, to have the same value. Is it possible to modify the above 
> code so that in situations like the preceding, only one of those rows 
> (doesn't matter which one) is returned, and assigned to the rows object? 
> 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/d/optout.


[web2py] Re: After update 2.9.12, response.json is messing the screen

2015-01-21 Thread Niphlod
pretty undocumented feature (so its not a bug per se) 

response.json() is clearly NOT meant to be used in views just use 
json(whatever) instead.

on the "can I call it a bug of not" matter, that seems to surface every 
once in a while, please take the following as a word of caution (from the 
initial "heavy pusher" of Continous Integration in web2py)... the (hard ?) 
truth is that for a project the size of web2py, for all intents and 
purposes, as long as something is NOT included in the automated tests, you 
can't call a behavioural change as a bug (or a regression). 

If something changed and has been introduced in the core code it's because 
there WASN'T a test for it (or documentation about it in the book) at that 
time and someone proposed a valid usecase for it (that MAY NOT coincide 
with the usecase you're used to). 
In other words, given that:
- the change seemed legit
- nobody cared to add a test for it
- there was no test case for it
- it raised no alarms

it went merged as a proper fix.

Consider also that if you cared to test your app with trunk, you'd have 
noticed the issue starting from the 17-dec, and could have raised an issue 
before the stable release.

Consider also that if you patch your controller with

response.headers['Content-Type'] = 'text/html'

before returning, also with the current stable version your issue will be 
resolved.

-- 
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/d/optout.


[web2py] Re: Grid order for reference fields

2015-01-21 Thread Niphlod
irregardless of the "business logic" there's a simple caveat with web2py 
grid (and reference fields in general).
for a field to be ordered (or searched, as it poses the exact same deal) 
correctly, web2py would have to fetch for each row of the table (not the 
page, the entire table) the reference record and build the string 
representation for it. 
Of course, this would mean killing performances at any level and with any 
backend. 

"represent" can also accept a function, that further reduces the 
possibilities. references are a "subset" of the issue, that can be 
circumvented with a proper join and leaving the "leftiest" table (along 
with the correct field_id) as the one you'd like to edit. 

that being said, the grid is not (and can't be) a silver-bullet for every 
"business logic", but it closes most of the "needs" with little 
modification to the one-liner 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/d/optout.


[web2py] Re: Broke my button :-(

2015-01-21 Thread Anthony
On Wednesday, January 21, 2015 at 6:09:26 AM UTC-8, Anthony wrote:
>
> On Tuesday, January 20, 2015 at 10:45:53 PM UTC-5, Dave S wrote:
>>>
>>> As mentioned in another thread, I started using
>>>
>>>
>>> TAG.BUTTON('"label" _type="submit", _name="mybutton", 
>>> _value=buttonvalue,
>>>  _onclick='ajax("stuff.load", ["val1","val2"
>>> , "val3"], "stuff_div")')
>>>
>>>
>> and "stuff.load" is a relative URL, so it will simply be appended to the 
>> URL of the page (which may work fine if the page in question happens to be 
>> the default function for the controller and the function is not included in 
>> the URL).
>>
>>
> Both the function for the page with the button and function the button 
> loads (that is, stuff()) are in the default.py controller, and the relative 
> URL is working for me, as long as javascript is enabled [author studies 
> ceiling for a moment].
>

If the URL of the containing page is something like 
http://yourdomain.com/default/parent (i.e., where "parent" is a function in 
the default.py controller), then the "stuff.load" relative URL would make a 
request to http://yourdomain.com/default/parent/stuff.load, which 
presumably would not work. On the other hand, if you have "parent" set as 
the default function for the default.py controller and the page URL is 
instead just http://yourdomain.com/default/ (or even just 
http://yourdomain.com/), then your relative URL will work -- but it will 
break if you change the default function or include an ambiguous URL arg.

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/d/optout.


[web2py] Re: HELP!! Another upgrading failed for Apache running web2py

2015-01-21 Thread Omi Chiba
>Do you mean the clear the sessions folder under web2py\applications\admin?
I tried it anyway but the same error...

On Wednesday, January 21, 2015 at 1:40:43 PM UTC-6, Omi Chiba wrote:
>
> The problem occurs for admin app.
>
> Do you mean the clear the sessions folder under web2py\applications\admin? 
> I didn't migrate admin app so this should be all empty from the 
> beginning... or are you talking about apache? 
>
>
>
> On Wednesday, January 21, 2015 at 1:20:42 PM UTC-6, Leonel Câmara wrote:
>>
>> This error is different from the other one, all you need is to clear the 
>> sessions, compiled and cache folders on your apps and everything will be 
>> fine.
>>
>

-- 
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/d/optout.


[web2py] Re: HELP!! Another upgrading failed for Apache running web2py

2015-01-21 Thread Omi Chiba
The problem occurs for admin app.

Do you mean the clear the sessions folder under web2py\applications\admin? 
I didn't migrate admin app so this should be all empty from the 
beginning... or are you talking about apache? 



On Wednesday, January 21, 2015 at 1:20:42 PM UTC-6, Leonel Câmara wrote:
>
> This error is different from the other one, all you need is to clear the 
> sessions, compiled and cache folders on your apps and everything will be 
> fine.
>

-- 
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/d/optout.


[web2py] Re: How to Set Up Email Subscription Option on Site

2015-01-21 Thread Dave S


On Tuesday, January 20, 2015 at 2:28:04 PM UTC-8, E. Wilson wrote:
>
> I'm new to web2py and have been doing tutorials to set up simple apps.  I 
> want to create a blog using web2py with an option where readers can 
> subscribe to my newsletter using their email address.  I have yet to find 
> tutorial where I can learn how to do this.  Can someone point me in the 
> right direction or provide some basic instructions to get me started? Is 
> there a tool that I should be using?
>


You want to collect the email address as data to add to your records.  I 
suggest you use one of the FORM tools, either FORM() itself or SQLFORM() or 
SQLFORM.factory().  Which one of those do you want?  That depends on how 
you keep your records.  I'll assume that you'll keep a subscribers list in 
a table in your database.  This could be as simple as 2 fields (id and a 
string), or you could have other fields for additional information.  If 
your table and the way you want users to enter data are an exact match, 
then SQLFORM() may be the easiest.  If you want to do some processing of 
the entry, then FORM or SQLFORM.factory() may be easier.  The IS_EMAIL() 
validator should help avoid poisonous entries.

You might find that the existing AUTH facilities already provide everything 
you need; registering a user and recording a subscriber's address are 
pretty similar tasks.

I have to admit, I'm still pretty much a newbie, but I've done some simple 
things with forms, and I think you'll find this sort of task simple when 
you get into it.

/dps

-- 
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/d/optout.


[web2py] Re: Grid order for reference fields

2015-01-21 Thread Gael Princivalle
Db is the same

Controler is the one i've post before:
 query = db.l1_categories.id==db.l2_categories.l1_category
 fields = (db.l1_categories.name,db.l2_categories.name)
 grid = SQLFORM.grid(query=query, fields=fields, csv=False, links_in_grid=
False, links=None, searchable=False, editable=True, deletable=False,create=
True, details=False)

In other words like that grid show db.l1_categories.name in the rows view 
and db.l1_categories.id or db.l2_categories.l1_category in the details view.

It don't take care of the format define in the db.l1_categories table.

Il giorno mercoledì 21 gennaio 2015 20:20:16 UTC+1, Alex Glaros ha scritto:
>
> am a beginner also, please excuse my fishing around for more info
>
> I don't see details-creating code above
>
> can you post latest version?
>
> thanks
>
> Alex
>

-- 
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/d/optout.


[web2py] Re: After update 2.9.12, response.json is messing the screen

2015-01-21 Thread André Kablu
Here is the reason why:

Before 2.9.12 it was (globals.py):

def json(self, data, default=None):
 return json(data, default=default or custom_json)



Now it is:

def json(self, data, default=None):
 if 'Content-Type' not in self.headers:
 self.headers['Content-Type'] = 'application/json'
 return json(data, default=default or custom_json)






On Wednesday, January 21, 2015 at 5:04:31 PM UTC-2, André Kablu wrote:
>
> Hi all,
>
> I just updated one of my projects to 2.9.12 and after that all views that 
> have a code like this does not work:
>
> SCRIPT('somecode(' + response.json + ')')
>
> the response.json is changing the content-type of the page to json...
>
> if we use:
>   return response.json
>
> there will be no problem,
>
> but when we use response.json as part of another string, it will transform 
> content-type to json messing the view...
>
> Think we need to fix that...
>
> 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/d/optout.


[web2py] Re: HELP!! Another upgrading failed for Apache running web2py

2015-01-21 Thread Leonel Câmara
This error is different from the other one, all you need is to clear the 
sessions, compiled and cache folders on your apps and everything will be 
fine.

-- 
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/d/optout.


[web2py] Re: Grid order for reference fields

2015-01-21 Thread Alex Glaros
am a beginner also, please excuse my fishing around for more info

I don't see details-creating code above

can you post latest version?

thanks

Alex

-- 
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/d/optout.


[web2py] Re: What are the usual steps for designing a web2py application?

2015-01-21 Thread Dave S


On Tuesday, January 20, 2015 at 5:18:23 AM UTC-8, Y wrote:
>
> Hello
>
> What are the usual steps for designing a web2py application?
>


Step 1:  Ask "what is the site going to show?"

Does that fit onto one page or several?  What sort of data is involved?  
Who can see it?  Who can change it?  What kind of changes can happen?

For one of my personal sites, these answers came pretty easy.  They also 
changed; originally, I just wanted 1 page, but as I got it going and put 
the data in the table, I had a couple of "oh, wouldn't it be nice to ..." 
moments.  But so far, all 3 pages are each just a few lines of code.  
Web2py makes doing small functions easy.

/dps


-- 
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/d/optout.


[web2py] After update 2.9.12, response.json is messing the screen

2015-01-21 Thread André Kablu
Hi all,

I just updated one of my projects to 2.9.12 and after that all views that 
have a code like this does not work:

SCRIPT('somecode(' + response.json + ')')

the response.json is changing the content-type of the page to json...

if we use:
  return response.json

there will be no problem,

but when we use response.json as part of another string, it will transform 
content-type to json messing the view...

Think we need to fix that...

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/d/optout.


[web2py] Re: Broke my button :-(

2015-01-21 Thread Dave S


On Wednesday, January 21, 2015 at 6:09:26 AM UTC-8, Anthony wrote:
>
> On Tuesday, January 20, 2015 at 10:45:53 PM UTC-5, Dave S wrote:
>>
>> As mentioned in another thread, I started using
>>
>>
>> TAG.BUTTON('"label" _type="submit", _name="mybutton", _value=buttonvalue,
>>  _onclick='ajax("stuff.load", ["val1","val2", 
>> "val3"], "stuff_div")')
>>
>>
> I don't know if these issues are related to your problem, but I notice an 
> extra single quote at the beginning, and "stuff.load" is a relative URL, 
>

Post-production editing error, kinda like Google Maps blurring the face of 
the Michelin Man.

and "stuff.load" is a relative URL, so it will simply be appended to the 
> URL of the page (which may work fine if the page in question happens to be 
> the default function for the controller and the function is not included in 
> the URL).
>
>
Both the function for the page with the button and function the button 
loads (that is, stuff()) are in the default.py controller, and the relative 
URL is working for me, as long as javascript is enabled [author studies 
ceiling for a moment].  I also make conventional links in the page using 
URL() and relative paths, and those are all being properly generated.  I 
may have to pay attention to that if I split it out into a second 
controller file, which I probably should do because I've now got the site 
serving 3 different types of actions (only loosely related).


Thanks for the pointers.  

/dps


-- 
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/d/optout.


[web2py] Re: Grid order for reference fields

2015-01-21 Thread Gael Princivalle
Thanks Alex in fact the join resolve this problem.
Then putting only l1.categories.name and l2.categories.name in the grid it 
looks fine.
But now in the details view I have the l1_categories.id instead of the name.
query = db.l1_categories.id==db.l2_categories.l1_category
fields = (db.l1_categories.name,db.l2_categories.name)
grid = SQLFORM.grid(query=query, fields=fields, csv=False, links_in_grid
=False, links=None, searchable=False, editable=True, deletable=False, create
=True, details=False)

Do you have a suggestion?

Regards.


Il giorno mercoledì 21 gennaio 2015 19:01:17 UTC+1, Alex Glaros ha scritto:
>
> hi Gael,
>
> I think you have to do a join in your query to l1 table to add that field 
> to grid so it can be searched on.  Otherwise, w2p only sees the primary key 
> id in l1.
>
> Alex
>

-- 
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/d/optout.


[web2py] Having db().select() return rows with only one instance with a particular value for a given field?

2015-01-21 Thread Spokes
I'd like a db(query).select(...) operation to return a set of rows in which 
there can only be one instance of a row with a particular value for a 
certain field. My query is like this:

book_query = ((db.t_article.f_book_id != None) & 
(db.t_article.f_book_id == db.t_book_image.id))
article_image_query = (db.t_article_image.f_article_id == 
db.t_article.id)
query = [stuff pertaining to t_article] & (article_image_query | 
book_query)

The idea is to find all t_article entries within a certain time frame 
(that's the stuff in brackets, which has been omitted), which either have 
an image associated with them, or which reference a t_book entry which has 
an image associated with it.

The select statement is like this:

rows = db(query).select(limitby = (0, number_of_records), orderby = 
'')

I'd like the select statement to return no more than one row with a 
particular value for the f_book_id field. With the above select() statement 
as it is, it's possible for rows[0]['t_article']['f_book_id'], 
rows[1]['t_article']['f_book_id'], and rows[2]['t_article']['f_book_id'], 
for example, to have the same value. Is it possible to modify the above 
code so that in situations like the preceding, only one of those rows 
(doesn't matter which one) is returned, and assigned to the rows object? 
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/d/optout.


[web2py] Re: Grid order for reference fields

2015-01-21 Thread Alex Glaros
hi Gael,

I think you have to do a join in your query to l1 table to add that field 
to grid so it can be searched on.  Otherwise, w2p only sees the primary key 
id in l1.

Alex

-- 
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/d/optout.


Re: [web2py] HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Philip Kilner

Hi,

On 21/01/15 16:13, Omi Chiba wrote:

Hi, I clicked the upload on admin and tried to upgrade from 2.4.6 to
2.9.12. As soon as I clicked I got ticket but cannot see the ticket
because now I get a ticket to see the ticket... It means I cannot open
admin site. My app is still working fine.

I don't where to start to fix. Can you guys help?

I can access web2py folder on pythonanywhere no problem. Worst case, I
can delete it and install new and import app which I backup before upgrade.



I don't know if this is relevant, but I've trie to upgrade from 2.9.11 
to 2.9.12 today in my PythonAnywhere instance, and it's failing with: -


unable to upgrade because "[Errno 2] No such file or directory 
'/home/[accname]/web2py/gluon/dal/__init__.py"


where [accname] is my PytonAnywhere account name.

I've not had time to look into this yet, but I'm not sure why it thinks 
that web2py/gluon/dal is a folder.


HTH


--

Regards,

PhilK


'a bell is a cup...until it is struck'

--
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/d/optout.


[web2py] Re: HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Paolo Valleri
Hi,
since you have access to the file system, can you check the content of the 
last ticket in the admin error directory?

Paolo

On Wednesday, January 21, 2015 at 5:13:17 PM UTC+1, Omi Chiba wrote:
>
> Hi, I clicked the upload on admin and tried to upgrade from 2.4.6 to 
> 2.9.12. As soon as I clicked I got ticket but cannot see the ticket because 
> now I get a ticket to see the ticket... It means I cannot open admin site. 
> My app is still working fine.
>
> I don't where to start to fix. Can you guys help?
>
> I can access web2py folder on pythonanywhere no problem. Worst case, I can 
> delete it and install new and import app which I backup before upgrade.
>
>
>

-- 
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/d/optout.


[web2py] Re: auto_import make new recs without defaults !

2015-01-21 Thread Anthony
The auto_import functionality is somewhat limited, as it only reads in the 
metadata from the *.table files, which only hold information relevant to 
the database (i.e., name, type, unique, not null, etc.). It does not import 
web2py specific attributes, such as defaults, validators, widgets, etc.

Anthony

On Wednesday, January 21, 2015 at 10:55:11 AM UTC-5, Dmitry Ermolaev wrote:
>
> If I use auto_import - and add new record - than receive None values 
> instead default
>
> db = DAL("mysql:/s", # 
> folder='applications/shop/databases',
> pool_size=3,
> auto_import=True,
> migrate_enabled = SETS.migrate_enabled,
> migrate=SETS.migrate,
> fake_migrate=SETS.fake_migrate,
> check_reserved=['all'],
> )
> 
> Field('accuracy', 'integer', *default *= 2), # accuracy
>
> not worked default ((
>
> referenced fields too not show list 
> Field('curr_id', db.currs, readable=False),
>
>

-- 
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/d/optout.


[web2py] HELP!! One click upgrade failed for pythonanywhere site

2015-01-21 Thread Omi Chiba
Hi, I clicked the upload on admin and tried to upgrade from 2.4.6 to 
2.9.12. As soon as I clicked I got ticket but cannot see the ticket because 
now I get a ticket to see the ticket... It means I cannot open admin site. 
My app is still working fine.

I don't where to start to fix. Can you guys help?

I can access web2py folder on pythonanywhere no problem. Worst case, I can 
delete it and install new and import app which I backup before upgrade.


-- 
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/d/optout.


[web2py] auto_import make new recs without defaults !

2015-01-21 Thread Dmitry Ermolaev
If I use auto_import - and add new record - than receive None values 
instead default

db = DAL("mysql:/s", # 
folder='applications/shop/databases',
pool_size=3,
auto_import=True,
migrate_enabled = SETS.migrate_enabled,
migrate=SETS.migrate,
fake_migrate=SETS.fake_migrate,
check_reserved=['all'],
)

Field('accuracy', 'integer', *default *= 2), # accuracy

not worked default ((

-- 
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/d/optout.


[web2py] stoping database insert in onvalidation

2015-01-21 Thread UG
Hi, 

i tried to post earlier today but it didn't seem to go through. so please 
forgive me if this appears to be a double post.

i am using onvalidation to call a check on the content of the form vars.

if the content matches i would like to stop the form being saved in to the 
database . i know i could redirect but my form does not carry the args for 
this , i guess i could put them in but wondered if there was just a way to 
quit the insert.


def formcheck(form):


check = ["word one", "word two", "three"]

for x in check:
if x.upper() in form.vars.body.upper():
response.flash = T("Content Not Allowed")



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/d/optout.


[web2py] What are the usual steps for designing a web2py application?

2015-01-21 Thread Yann
Hello

What are the usual steps for designing a web2py application?

Best regards

-- 
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/d/optout.


[web2py] Re: Ajax call does not redirect.

2015-01-21 Thread James O' Driscoll
Hey Leonel,

I tried that, when I ran the code that you suggested, web2py did not 
redirect to display_canvas,

Execution in the following order, with client_side=True:

1.run display_canvas
2.ajax call to display

and with, with client_side=False:

1.   run display_canvas
2.   ajax call to display
3.   redirect to display_canvas, which generates new html based on width, 
however this is not rendered in the browser but can be seen in the resposne 
of the ajax call. 

I saw some other posts on this topic, they say that it is best to use a 
redirect in javascript from the head of display. This works but I am not 
sure if this is the cleanest solution.

I suppose the better question is given the example of what I am trying to 
do what is the best way of accomplishing it in web2py.

Regards,

James

On Monday, January 19, 2015 at 1:26:30 PM UTC+10, Leonel Câmara wrote:
>
> Hey,
>
> For ajax calls you need to use: 
>
> redirect(URL('default', 'display_canvas', args=[screen_width]), 
> client_side=True)
>
>
>
>
>

-- 
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/d/optout.


[web2py] Stop a db insert on validation

2015-01-21 Thread UG
Hi,

I am using on validation to check for text strings in a form . Is there a 
way i stop the database insert happening if the strings are matched ? so 
far i am only able to remove the words.

Thanks

def check(form):

check = ["this word", "or this word"]

for x in check:
if x.upper() in form.vars.body.upper():
response.flash = T("Content Not Allowed")
form.vars.body=''



-- 
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/d/optout.


[web2py] How to Set Up Email Subscription Option on Site

2015-01-21 Thread E. Wilson
I'm new to web2py and have been doing tutorials to set up simple apps.  I 
want to create a blog using web2py with an option where readers can 
subscribe to my newsletter using their email address.  I have yet to find 
tutorial where I can learn how to do this.  Can someone point me in the 
right direction or provide some basic instructions to get me started? Is 
there a tool that I should be using?

-- 
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/d/optout.


Re: [web2py] web2py + maps. Any sugestion?

2015-01-21 Thread Carlos A. Armenta Castro
Thank you Paolo,

I will try you recipe. Regards.

El martes, 20 de enero de 2015, 2:26:41 (UTC-7), Paolo Valleri escribió:
>
> Hi,
> I've been using leaflet, it works great.
> http://www.web2pyslices.com/slice/show/1899/leaflet-and-geojson-with-web2py 
> which proposes a starting point example 
>
> Paolo
>
> On Tuesday, January 20, 2015 at 9:59:17 AM UTC+1, Massimiliano wrote:
>>
>> For the same purpose I tried openlayers 3 but I fall back using google 
>> maps api directly.
>>
>>
>>
>>
>> On Mon, Jan 19, 2015 at 6:42 AM, Carlos A. Armenta Castro <
>> carlos@gmail.com> wrote:
>>
>>> Im trying to work with maps for a vehicle tracking system. I found 
>>> several js libraries like google maps api, leaflet, gmaps.js, openstreet, 
>>> mapbox and too many more like that.
>>> Would you recommend any library? Sugestions to work with web2py and maps 
>>> (gis)?
>>> Thank you and sorry for my english.
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Massimiliano
>>  
>

-- 
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/d/optout.


[web2py] Using a graph database with web2py

2015-01-21 Thread Y
Hello

Has anybody ever used a graph database with web2py. Is this possible?

Cheers

-- 
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/d/optout.


[web2py] web2py admin access with HTTPS, loopback 127.0.0.4

2015-01-21 Thread rim bulls
Hello!

I'm stuck, please help! :)

Trying to setup web2py on FreeBSD jail, so no 127.0.0.1 is available in 
jail. Using Apache with SSL, mod_proxy, self signed SSL certs.

Execute web2py: "python web2py.py -i localhost -p 7000 -a jyhag", web2py is 
listening on 127.0.0.4 (that's loopback address for jail). Apache 
configured as described in web2py book.
I am connecting to "https://FQDN/admin"; and get "Admin is disabled because 
insecure channel". 
If I set web2py listen to real IP, same situation.

Can I get some hint, please?

Thanks in advance!
Rimm

-- 
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/d/optout.


Re: [web2py] Ubuntu: python-web2py 1.99.7-1

2015-01-21 Thread Y
Thank you.

Am Dienstag, 20. Januar 2015 16:36:57 UTC+1 schrieb José L.:
>
> Ubuntu takes this package from Debian. I will update the package in Debian 
> soon, with version 2.9.12  (or maybe .13 if some problems from this list 
> are confirmed).
> Then, you can ask Ubuntu to pull it from Debian.
> Regards.
>
> 2015-01-19 14:23 GMT+01:00 Y >:
>
>> Hello 
>>
>> There only seems to be available a very old version of web2py in the 
>> Ubuntu Software-Center. Could you update it?
>>
>> Kind regards
>>
>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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/d/optout.


[web2py] Re: Using whoosh for in-built wiki

2015-01-21 Thread Ben Lawrence
I guess this is a repeat of 
https://groups.google.com/d/msg/web2py/jD50nsb0hXs/r6Wm4Wu2IrIJ

-- 
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/d/optout.


[web2py] Re: Mixing pydal with web2py - how to manage the non-web2py setup

2015-01-21 Thread Tom Stratton
Thank you again - I did not put that together after the first email. I 
realize now that I should have realized what you were saying would solve my 
problem.

Really appreciate your help.

Tom

On Monday, January 19, 2015 at 11:32:15 PM UTC-8, Niphlod wrote:
>
>
>
> On Monday, January 19, 2015 at 6:23:24 PM UTC+1, Tom Stratton wrote:
>>
>> Hi - Thanks for the response.
>>
>> I did find the documentation and set migrate=False and was able to get it 
>> working.
>>
>> However, the follow up question is, what to do if I do want to change the 
>> tables? EG: What if I want to add a new field.
>>
>
> I'll quote myself
>
>
> *The "grey" consinst in you defining a model for all existing tables (i.e. 
> migrating an app TO web2py, with a yet-existing database) and start "fresh" 
> by setting migrate=True and fake_migrate_all=True, with the latter turned 
> on just for a single request. In that single request, web2py will re-create 
> .table files from your current model. Later on, when you'll alter that 
> definition, it'll keep your database tables in sync with your model. *
>
>
>>>

-- 
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/d/optout.


[web2py] Connecting to external sqlite and reading tables

2015-01-21 Thread flom
Dear all, 
I have a sqlite file test.sqlite, stored in /static/db/, and that contains 
a 'Name' table with fields title, number and def.

I have checked that file with sql_browser and the content is Ok.
I just mean to read only the table (never add/remove/edit)

I import the sqlite file in db.py with:
db_name = DAL('sqlite://test.sqlite',

folder='/home//www/web2py-R-2.9.11/applications/.../static/db/',
auto_import=True
) 

Then, as a test in index.html I do the following:

{{from gluon import current}}
{{db_name = current.globalenv['db_name']}}
{{query = db_name(db_name.Name.number=='1122')}}
{{count = query.count()}}
{{pass}}

There should be one row in total ... but I get the following error:
('DAL' object has no attribute 'Name')

-- 
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/d/optout.


[web2py] error in db admin

2015-01-21 Thread Dmitry Ermolaev


I use auto_import:

db = DAL("mysql://...", 

folder='applications/shop/databases',

pool_size=3,

auto_import=True,

migrate_enabled = SETS.migrate_enabled,

migrate=SETS.migrate,

fake_migrate=SETS.fake_migrate,

check_reserved=['all'],

)
when open db in appadmin - error


127.0.0.1.2015-01-21.19-36-43.bcbf410b-d686-422d-8b5a-91d2eea067de
 name 'step' is not definedVersionweb2py™Version 
2.9.5-trunk+timestamp.2014.03.29.21.54.41PythonPython 2.7.6: 
C:\Python27\python.exe (prefix: C:\Python27)Traceback

1.
2.
3.
4.
5.
6.
7.

Traceback (most recent call last):
  File "C:\web2py-m\gluon\restricted.py", line 220, in restricted
exec ccode in environment
  File "C:/web2py-m/applications/bs3b/views/appadmin.html" 
, line 178, 
in 
{{=ram['keys']}}
NameError: name 'step' is not defined

Error snapshot [image: help] 


(name 'step' is not defined)

inspect attributes
Frames
   
   - 
   
   *File C:\web2py-m\gluon\restricted.py in restricted at line 220* code 
   arguments variables
   - 
   
   *File C:\web2py-m\applications\bs3b\views\appadmin.html in  at 
   line 178* code arguments variables
   Function argument list
   
   ()
   Code listing
   
   169.
   170.
   171.
   172.
   173.
   174.
   175.
   176.
   177.
   178.
   
   179.
   180.
   181.
   182.
   183.
   184.
   185.
   186.
   187.
   188.
   
   response.write(T('"update" is an optional expression like 
"field1=\'newvalue\'". You cannot update or delete the results of a JOIN'))
   response.write('\n\n', escape=False)
   response.write(T("%s selected", nrows))
   response.write('\n', escape=False)
   if start>0:
   response.write(A(T('previous %s rows') % 
step,_href=URL('select',args=request.args[0],vars=dict(start=start-step)),_class="btn"))
   pass
   response.write('\n', escape=False)
   if stop\n   
', escape=False)
   linkto = lambda f, t, r: URL('update', args=[request.args[0], r, f]) 
if f else "#"
   response.write('\n   ', escape=False)
   upload=URL('download',args=request.args[0])
   response.write('\n   ', escape=False)
   
response.write(SQLTABLE(rows,linkto,upload,orderby=True,_class='sortable'))
   response.write('\n   \n', escape=False)
   
   Variablesramundefined
   
Contex

-- 
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/d/optout.


[web2py] Grid order for reference fields

2015-01-21 Thread Gael Princivalle
Hello all.

In my grid if the user click on head columns for reference fields the order 
is made by row id and not by the row format.

My db:
db.define_table('l1_categories',
Field('name'),
format = '%(name)s')

db.define_table('l2_categories',
Field('l1_category', 'reference l1_categories'),
Field('name'))

My grid:
query = db.l2_categories
grid = SQLFORM.grid(query=query, csv=False, links_in_grid=False, links=
None, searchable=True, editable=True, deletable=False, create=True, details=
False)

How can I give the possibility to the user when he click on the l1_category 
head column to order it by format ? If there is a solution I think it will 
also give the possibility to search with these words.

Thanks, regards.

-- 
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/d/optout.


[web2py] Re: Uploaded PDF viewing

2015-01-21 Thread nick name
Note, however, you potentially let anyone download any other user's file. 
If you do this, make sure you require signed URLs on the display controller

On Thursday, January 8, 2015 at 7:25:11 PM UTC-5, Rob Paire wrote:
>
> Hi Dominic, 
> I found the simplest way to serve PDF files is to save them in the static 
> directory, and then pass in the folder and the name of the file you want to 
> serve as url parameters. See sample code below.  I have also had good 
> success building PDF's on the fly using the pyfpdf module which is include 
> in web2py. 
>
>

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


[web2py] Re: Broke my button :-(

2015-01-21 Thread Anthony
On Tuesday, January 20, 2015 at 10:45:53 PM UTC-5, Dave S wrote:
>
> As mentioned in another thread, I started using
>
>
> TAG.BUTTON('"label" _type="submit", _name="mybutton", _value=buttonvalue,
>  _onclick='ajax("stuff.load", ["val1","val2", 
> "val3"], "stuff_div")')
>
>
I don't know if these issues are related to your problem, but I notice an 
extra single quote at the beginning, and "stuff.load" is a relative URL, so 
it will simply be appended to the URL of the page (which may work fine if 
the page in question happens to be the default function for the controller 
and the function is not included in the URL).

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/d/optout.


[web2py] Mastering web2py DAL

2015-01-21 Thread António Ramos
Hello all
I suggest a new book (so few in web2py world)

Mastering web2py DAL

DAL Its so powerfull and a lot of people dont use it properly.
I see a lot of use cases and people discussing about


I think there should be a book about DAL
Only DAL , nothing else.

Please do it


Regards
António

-- 
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/d/optout.


[web2py] Re: SQLFORM - field_id - not work

2015-01-21 Thread Dmitry Ermolaev
id field in VIEW TABLE - is for view only - why I can't modufy view of id 
field?

вторник, 20 января 2015 г., 23:08:03 UTC+3 пользователь Niphlod написал:
>
> field_id MUST be a pkey, so an integer: there's no support for string-like 
> keys in grid, because it's used as an argument.
>
> On Tuesday, January 20, 2015 at 6:15:21 AM UTC+1, Dmitry Ermolaev wrote:
>>
>> I need that ID become URL on view info of this record - same as View field
>>
>> понедельник, 25 августа 2014 г., 14:56:25 UTC+3 пользователь Anthony 
>> написал:
>>>
>>> What do you expect it to do, and what is happening instead?
>>>
>>> On Monday, August 25, 2014 3:00:47 AM UTC-4, Dmitry Ermolaev wrote:

 SQLFORM.grid(db.pets,
 field_id = db.pets.url,



-- 
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/d/optout.