[web2py] Recent change to sqlhtml.py breaks S-Cubism's solidtable-plugin

2014-05-13 Thread Johann Spies
The removal of the line:


*table_field = re.compile('[\w_]+\.[\w_]+')*

from gluon/sqlhtml as shown in
https://code.google.com/p/web2py/source/detail?spec=svn77440b2f4ba3ca2ff9441ecd23b7df6e5f2ec4b9&r=d00dfc9c551f797b1bfdcec88928a0ae09a4a499

breaks plugin_solidtable.py.

Solution: either put it back in sqlhtml.py or

put int in plugin_solidtable.py and add "import re"  to that file.


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

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


[web2py] root_static - How does it works ?

2014-05-13 Thread Gael Princivalle
Hello all.

I'm just curious to know how is it possible to use root_static in a 
routes.py file.

I'saw things like that :
root_static = ['favicon.ico', 'robots.txt', 'sitemap.txt']

Where file must be placed into the static folder.
But for example favicon.ico is by default in the static/images folder, and 
this file is called by layout.html.
Do I have to duplicate favicon.ico in the static folder ?

Here is my actual routes.py:
routers = dict(
 BASE = dict(
domains = {
 "www.myfirstsite.it" : "myfirstapp",
 "www.mysecondsite.it": "mysecondapp",
 }
 ),
 myfirstapp = dict(languages=['en', 'it'], default_language='it'),
 mysecondapp = dict(languages=['en', 'it'], default_language='it')
)


How can I set  root_static for each app ?

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: ipython notebook and web2py

2014-05-13 Thread Johann Spies
Dear Anthony,


So, just start up a notebook, and at the top, run:
>
> %w2p myapp/mycontroller
>
> and you will get a full web2py environment with the models from myapp as
> well as the (optionally) specified controller (so you can run functions
> from that controller). Should be easy to add an optional command line flag
> to later add other controllers (without overwriting the full environment).
>
>
I am struggling to get this to work.

The following show that the environment works with normal ipython:

 > pwd
/home/js/web2py

> python web2py.py -M -S test
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2014
Version 2.9.5-trunk+timestamp.2014.05.09.15.41.38
Database drivers available: SQLite(sqlite2), SQLite(sqlite3),
MySQL(pymysql), MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000),
MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
Python 2.7.6 (default, Mar 22 2014, 15:40:47)
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help  -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:


In ipython-notebook I was trying to debug the process following the logic
in your web2py_magic.py:

In [4]:

line = 'test/default'

In [5]:

line = line.split('/')

In [6]:

line

Out[6]:

['test', 'default']

In [7]:

app = line[0]

In [8]:

controller = line[1] if len(line) > 1 else None

In [9]:

WEB2PY_PATH = os.path.join('/', 'home', 'js', 'web2py')



In [10]:

sys.path.append(WEB2PY_PATH)



In [11]:

environment = gluon.shell.env(app, import_models=True, c=controller,

dir=os.path.join(WEB2PY_PATH, 'applications', app))

An exception has occurred, use %tb to see the full traceback.
SystemExit: 1



Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/gluon/restricted.py", line 205,
in restricted
exec ccode in environment
  File "/home/js/web2py/applications/test/models/db.py", line 48, in 
auth.define_tables(username=False, signature=False)
TypeError: define_tables() got an unexpected keyword argument 'signature'

To exit: use 'exit', 'quit', or Ctrl-D.



I get the same exception when I try

%w2p
or
 %w2p test/default.

Lines 43-48 in db.py are

 43 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate$
 44 auth = Auth(db)$
 45 crud, service, plugins = Crud(db), Service(), PluginManager()$
 46 $
 47 ## create all tables needed by auth if not custom tables$
 48 auth.define_tables(username=False, signature=False)$

which was created by the admin app when I created the test app.


I could so far not figure out what is causing this.

When I try another app it complains about 'lazy_tables'

An exception has occurred, use %tb to see the full traceback.
SystemExit: 1



Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/gluon/restricted.py", line 205,
in restricted
exec ccode in environment
  File "/home/js/web2py/applications/nkb/models/0.py", line 18, in 
lazy_tables=True, bigint_id = True)
TypeError: __init__() got an unexpected keyword argument 'lazy_tables'

REgards
Johann
-- 

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

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


[web2py] How to intercept download request

2014-05-13 Thread Mandar Vaze
I want to audit the downloads - things like "which file was downloaded, by 
whom and when" etc - and then allow the download to proceed.

I looked at auth.settings.download_url - which is pointing to 
/app/default/download

So I put debugger (import ipdb;ipdb.set_trace()) in download() function in 
default controller.
But when I click on the file link to download - the execution *does not 
stop* in the debugger

I have several controllers - I assume for all the controllers - the 
download_url is same (since it is controlled via auth.settings)
But just to try - I added "download" function in my other controller as 
well (and put debugger) - still didn't help

What am I missing ?

-Mandar


-- 
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: list:reference

2014-05-13 Thread Mandar Vaze


On Tuesday, May 13, 2014 5:06:52 AM UTC+5:30, Michael Beller wrote:
>
> I haven't used 'list:reference' before, what are the advantages or use 
> cases for your approach rather than add a reference field such as 
> Field('daily', 'reference daily') on the post table?
>

Generic use case (I could think of)

db.define_table('parent',
Field('fname', 'string'),
Field('lname', 'string'),
format='%(fname)s %(lname)s'
)

db.define_table('child',
Field('fname', 'string'),
Field('lname', 'string'),
Field('parents', 'list:reference parent'),
format='%(fname)s %(lname)s'
)

So basically - child has two parents. 
using "reference parent" can be used to point to only one of the parents.
list:reference allows you to point to multiple parents

-Mandar

-- 
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: ipython notebook and web2py

2014-05-13 Thread Anthony
Is it possible you are running an old version of web2py that doesn't 
support those arguments. Based on the restricted.py line number shown in 
the traceback, it looks like you're on web2py 1.99 or earlier.

Anthony

On Tuesday, May 13, 2014 6:29:56 AM UTC-4, Johann Spies wrote:
>
> Dear Anthony,
>
>
> So, just start up a notebook, and at the top, run:
>>
>> %w2p myapp/mycontroller
>>
>> and you will get a full web2py environment with the models from myapp as 
>> well as the (optionally) specified controller (so you can run functions 
>> from that controller). Should be easy to add an optional command line flag 
>> to later add other controllers (without overwriting the full environment).
>>
>>
> I am struggling to get this to work. 
>
> The following show that the environment works with normal ipython:
>
>  > pwd
> /home/js/web2py
>
> > python web2py.py -M -S test
> web2py Web Framework
> Created by Massimo Di Pierro, Copyright 2007-2014
> Version 2.9.5-trunk+timestamp.2014.05.09.15.41.38
> Database drivers available: SQLite(sqlite2), SQLite(sqlite3), 
> MySQL(pymysql), MySQL(MySQLdb), PostgreSQL(psycopg2), PostgreSQL(pg8000), 
> MSSQL(pyodbc), DB2(pyodbc), Teradata(pyodbc), Ingres(pyodbc), IMAP(imaplib)
> Python 2.7.6 (default, Mar 22 2014, 15:40:47) 
> Type "copyright", "credits" or "license" for more information.
>
> IPython 1.2.1 -- An enhanced Interactive Python.
> ? -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help  -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
>
> In [1]: 
>
>
> In ipython-notebook I was trying to debug the process following the logic 
> in your web2py_magic.py:
>
> In [4]:
>  
> line = 'test/default' 
>
> In [5]:
>
> line = line.split('/')
>
> In [6]:
>
> line
>
> Out[6]:
>
> ['test', 'default']
>
> In [7]:
>
> app = line[0]
>
> In [8]:
>
> controller = line[1] if len(line) > 1 else None
>
> In [9]:
>  
> WEB2PY_PATH = os.path.join('/', 'home', 'js', 'web2py')
>
>  
>
> In [10]:
>  
> sys.path.append(WEB2PY_PATH)
>
>  
>
> In [11]:
>
> environment = gluon.shell.env(app, import_models=True, c=controller,
>
> dir=os.path.join(WEB2PY_PATH, 'applications', app))
>
> An exception has occurred, use %tb to see the full traceback.
> SystemExit: 1
>
>
>
> Traceback (most recent call last):
>   File "/usr/lib/pymodules/python2.7/gluon/restricted.py", line 205, in 
> restricted
> exec ccode in environment
>   File "/home/js/web2py/applications/test/models/db.py", line 48, in 
> auth.define_tables(username=False, signature=False)
> TypeError: define_tables() got an unexpected keyword argument 'signature'
>
> To exit: use 'exit', 'quit', or Ctrl-D.
>
>
>
> I get the same exception when I try
>
> %w2p 
> or
>  %w2p test/default.
>
> Lines 43-48 in db.py are
>
>  43 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate$
>  44 auth = Auth(db)$
>  45 crud, service, plugins = Crud(db), Service(), PluginManager()$
>  46 $
>  47 ## create all tables needed by auth if not custom tables$
>  48 auth.define_tables(username=False, signature=False)$
>
> which was created by the admin app when I created the test app.
>
>
> I could so far not figure out what is causing this.
>
> When I try another app it complains about 'lazy_tables' 
>
> An exception has occurred, use %tb to see the full traceback.
> SystemExit: 1
>
>
>
> Traceback (most recent call last):
>   File "/usr/lib/pymodules/python2.7/gluon/restricted.py", line 205, in 
> restricted
> exec ccode in environment
>   File "/home/js/web2py/applications/nkb/models/0.py", line 18, in 
> lazy_tables=True, bigint_id = True)
> TypeError: __init__() got an unexpected keyword argument 'lazy_tables'
>
> REgards
> Johann
> -- 
>
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

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


Re: [web2py] Re: appointment application doesn't work out of box

2014-05-13 Thread Richard Vézina
Don't know if it had been fixed, but there were a memory leak wiht
fullcalendar integration in appointment app... Search the list and email
from me about the issue and how to workaround.

Richard


On Sun, May 11, 2014 at 10:20 AM, jimbo  wrote:

> This looks nice and useful and has a booking system built in.
>
> https://github.com/mdipierro/web2py-appliances/tree/master/TinyWebsite
>
> http://www.tinywebsite.net/
>
>
> On Sunday, 20 April 2014 23:02:03 UTC+1, LoveWeb2py wrote:
>>
>> Hello,
>>
>> I'm trying to create a website for my Mom that she can use to book
>> appointments. She has a day spa and really could use something like the
>> appointment manager.
>>
>> I have a fresh copy of web2py installed (latest version) and a fresh
>> install of the appointment manager app.
>> I installed the app through the app manager and when I try to create an
>> appointment I get this error:
>>  too many values to unpack
>>
>> here is the traceback:
>> Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>>
>> Traceback (most recent call last):
>>   File "/home/web2py/spa/gluon/restricted.py", line 220, in restricted
>> exec ccode in environment
>>   File 
>> "/home/web2py/spa/applications/appointments/views/default/appointment_read.html",
>>  line 103, in 
>> ValueError: too many values to unpack
>>
>> and here is the highlighted line of code in appointment_read.html
>> for t,f in db.t_appointment._referenced_by:
>>
>> any thoughts why I might be getting this error?
>>
>  --
> 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: list:reference

2014-05-13 Thread Anthony
That bug was fixed almost two years ago, so it's definitely not still in 
trunk only. Could be a different bug. Please show all of your code as well 
as the full traceback.

Anthony

On Monday, May 12, 2014 11:27:10 PM UTC-4, Jesse Ferguson wrote:
>
>
> https://groups.google.com/forum/#!searchin/web2py/list$3Areference/web2py/pXBj0EhX3iA/vamglS5txQsJ
>
> seems this may be a bug in web2py... Does anyone know if this bugfix is 
> still only in trunk or if it has been put into stable?
>

-- 
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] Recent change to sqlhtml.py breaks S-Cubism's solidtable-plugin

2014-05-13 Thread Michele Comitini
Is that constant is part of web2py public API?
AFAIK it should be reported as a bug of solidtable.

The lesson for us is to prefix things not to be exposed with the usual '__'.

mic



2014-05-13 11:41 GMT+02:00 Johann Spies :

> The removal of the line:
>
>
> *table_field = re.compile('[\w_]+\.[\w_]+')*
>
> from gluon/sqlhtml as shown in
> https://code.google.com/p/web2py/source/detail?spec=svn77440b2f4ba3ca2ff9441ecd23b7df6e5f2ec4b9&r=d00dfc9c551f797b1bfdcec88928a0ae09a4a499
>
> breaks plugin_solidtable.py.
>
> Solution: either put it back in sqlhtml.py or
>
> put int in plugin_solidtable.py and add "import re"  to that file.
>
>
> Regards
> Johann
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/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] Re: ipython notebook and web2py

2014-05-13 Thread Johann Spies
On 13 May 2014 15:44, Anthony  wrote:

> Is it possible you are running an old version of web2py that doesn't
> support those arguments. Based on the restricted.py line number shown in
> the traceback, it looks like you're on web2py 1.99 or earlier.
>

Version 2.9.5-trunk+timestamp.2014.05.09.15.41.38


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

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


Re: [web2py] Re: ipython notebook and web2py

2014-05-13 Thread Johann Spies
Anthony, you are very sharp.

Looking at the traceback I saw that it used files in
/us/lib/pymodules/python2.7/gluon of which I do not know the origin.

I deleted that directory and the problem was solved.

Thanks a lot.

Regards
Johann


On 13 May 2014 16:27, Johann Spies  wrote:

>
>
>
> On 13 May 2014 15:44, Anthony  wrote:
>
>> Is it possible you are running an old version of web2py that doesn't
>> support those arguments. Based on the restricted.py line number shown in
>> the traceback, it looks like you're on web2py 1.99 or earlier.
>>
>
> Version 2.9.5-trunk+timestamp.2014.05.09.15.41.38
>
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>



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

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


Re: [web2py] Re: ipython notebook and web2py

2014-05-13 Thread Anthony
Did you install web2py from PyPi at some point in the past? It looks like 
you have a version of the gluon modules in 
/usr/lib/pymodules/python2.7/gluon. Your traceback includes:


File "/usr/lib/pymodules/python2.7/gluon/restricted.py", line 205, in restricted
exec ccode in environment


That particular line in restricted.py hasn't been at line number 205 since 
web2py 1.99.7 (it is now at line number 220).

I think the problem is that because the web2py_magic.py simply appends the 
web2py path to sys.path, it is looking in 
/usr/lib/pymodules/python2.7/gluon before it looks in the path of your 
current version of web2py and therefore running the old version of gluon. 
In web2py_magic.py, maybe change sys.path.append(WEB2PY_PATH) to 
sys.path.insert(1, WEB2PY_PATH). You could also simply remove the old 
web2py gluon folder, use virtualenv, etc.

Anthony

On Tuesday, May 13, 2014 10:27:23 AM UTC-4, Johann Spies wrote:
>
>
>
>
> Is it possible you are running an old version of web2py that doesn't 
> support those arguments. Based on the restricted.py line number shown in 
> the traceback, it looks like you're on web2py 1.99 or earlier.
>
> Version 2.9.5-trunk+timestamp.2014.05.09.15.41.38
>  
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

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


Re: [web2py] Re: ipython notebook and web2py

2014-05-13 Thread Anthony
Looks like our posts crossed. Glad you got it figured out.

Anthony

On Tuesday, May 13, 2014 10:49:09 AM UTC-4, Johann Spies wrote:
>
> Anthony, you are very sharp.  
>
> Looking at the traceback I saw that it used files in 
> /us/lib/pymodules/python2.7/gluon of which I do not know the origin.
>
> I deleted that directory and the problem was solved.
>
> Thanks a lot.
>
> Regards
> Johann
>
>
> On 13 May 2014 16:27, Johann Spies  wrote:
>
>>
>>
>>
>>
>> Is it possible you are running an old version of web2py that doesn't 
>> support those arguments. Based on the restricted.py line number shown in 
>> the traceback, it looks like you're on web2py 1.99 or earlier.
>>
>> Version 2.9.5-trunk+timestamp.2014.05.09.15.41.38
>>  
>>
>> -- 
>> Because experiencing your loyal love is better than life itself, 
>> my lips will praise you.  (Psalm 63:3)
>>  
>
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

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


[web2py] .with_alias() and SQLFORM.grid

2014-05-13 Thread Richard
Hello,

I try to allow the search widget to search in represented fields (that are 
see as integer by the grid)... I try to make use of .with_alias() and left 
join for that, but had many error... 

Is this even possible ?

SQLFORM.grid(...,
left=db.myjointable.on(db.myjointable.id == db.mygridtable.myjointable_id)
fields=[..., db.myjointable.field_represent.with_alias('new_field_name')]
...)


Thanks

Richard

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


Re: [web2py] Recent change to sqlhtml.py breaks S-Cubism's solidtable-plugin

2014-05-13 Thread Quint
What is web2py's public api?
Is it everything that does not start with "_"?

-- 
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 have app work with existing database?

2014-05-13 Thread 'Michael Gheith' via web2py-users
I have an existing Oracle database, it's pretty big.  There are lots of 
tables and records in it.  I want to create a new web2py application that 
will work with this existing database.  Is there a way I can easily have a 
web2py app talk to this database, or do I have to manually specify all the 
database tables and fields in db.py?  Essentially I want to work with the 
DAL to make queries and what not.  Any guidance would be much appreciated!

-- 
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] Recent change to sqlhtml.py breaks S-Cubism's solidtable-plugin

2014-05-13 Thread Anthony
On Tuesday, May 13, 2014 12:12:41 PM UTC-4, Quint wrote:
>
> What is web2py's public api?
> Is it everything that does not start with "_"?


Perhaps Massimo can better answer, but the public API is not simply 
everything that doesn't start with "_" (there are plenty of functions, 
classes, and constants that are intended for internal use that do not start 
with "_"). In terms of what is expected to remain backward compatible, it 
is probably everything that is documented in the reference manual.

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: How to have app work with existing database?

2014-05-13 Thread Anthony
You can use this script to auto-generate web2py models based on an existing 
database: 
https://github.com/web2py/web2py/blob/master/scripts/extract_oracle_models.py. 
Check the output, as it may not be perfect.

Anthony

On Tuesday, May 13, 2014 12:15:00 PM UTC-4, Michael Gheith wrote:
>
> I have an existing Oracle database, it's pretty big.  There are lots of 
> tables and records in it.  I want to create a new web2py application that 
> will work with this existing database.  Is there a way I can easily have a 
> web2py app talk to this database, or do I have to manually specify all the 
> database tables and fields in db.py?  Essentially I want to work with the 
> DAL to make queries and what not.  Any guidance would be much appreciated!
>

-- 
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 have app work with existing database?

2014-05-13 Thread 'Michael Gheith' via web2py-users
This looks promising, thanks for the prompt response Anthony!  Let me try 
it out.  Also, I saw your speech online in regards to the Chicago web2py 
2014 conference.  I found it to be inspiring :)

Kindest of regards,
Michael Joseph Gheith

On Tuesday, May 13, 2014 11:30:42 AM UTC-5, Anthony wrote:
>
> You can use this script to auto-generate web2py models based on an 
> existing database: 
> https://github.com/web2py/web2py/blob/master/scripts/extract_oracle_models.py.
>  
> Check the output, as it may not be perfect.
>
> Anthony
>
> On Tuesday, May 13, 2014 12:15:00 PM UTC-4, Michael Gheith wrote:
>>
>> I have an existing Oracle database, it's pretty big.  There are lots of 
>> tables and records in it.  I want to create a new web2py application that 
>> will work with this existing database.  Is there a way I can easily have a 
>> web2py app talk to this database, or do I have to manually specify all the 
>> database tables and fields in db.py?  Essentially I want to work with the 
>> DAL to make queries and what not.  Any guidance would be much appreciated!
>>
>

-- 
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 Conference - Angular Talk by Amber

2014-05-13 Thread António Ramos
*( i use [[ ]] to code angular data inside views)*

It was very informative but this code example

myApp.controller('empCtrl', ['$scope','$http',function($scope,$http) {
$scope.empresas = {{=XML(list)}};

}]);

only works inside a script tag, inside a web2py view, because of the XML
helper.

I would like to separate my angular code in a separate js file to keep code
more organized.
Any ideas ?

Second issue, ng-repeat inside a web2py view . I coded the link url to
documents in my web2py controller
*view*



*[[emp.empresa]] *

*code*
def queryemp():
temp=[]
rows = db(db.empresa).select(db.empresa.empresa,db.empresa.id).as_list()
for x in rows:

rows[rows.index(x)]['url']=URL('default','showemp',user_signature=True,args=x['id'])
temp.append(x)
return dict(list=gluon.contrib.simplejson.dumps(temp))



I would like instead to do something like
 [[emp.empresa]]


but angular inside web2py brackets is not possible. I think...

Comments appreciated.

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] Replicate SQL Query WHERE NULL in Web2py

2014-05-13 Thread LoveWeb2py
Hello,

How could I replicate this SQL Query in a controller and display a grid?


Here is what I'm trying to accomplish:
http://stackoverflow.com/questions/15926348/left-join-to-display-records-not-in-right-table

Here is the query:
SELECT a.* FROM   ECRDTL_del AS a 
   LEFT JOIN ECRDTL_edit AS b 
  ON a.Ecrno = b.Ecrno AND 
 a.Cylno = b.CylnoWHERE  b.Ecrno IS NULL

I basically just want to show all records where the join doesn't match.

I've tried so many ways, but haven't been able to have success with the DAL 
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] Re: Replicate SQL Query WHERE NULL in Web2py

2014-05-13 Thread Niphlod
post the model. However, it's totally doable (and I use it a lot)

http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Left-outer-join

>>> db.define_table('master_table', Field('f_a')) #lefty table, i.e. the 
one with more records

>>> db.define_table('slave_table', Field('f_a')) #righty table, i.e. the 
one with less records

>>> db.master_table.insert(f_a='aaa')
1L
>>> db.master_table.insert(f_a='bbb')
2L
>>> db.slave_table.insert(f_a='aaa')
1L
# usually you'll try to fetch what is in "master" that isn't in "slave"
>>> db(db.slave_table.id == None)._select(db.master_table.ALL, left=db.
slave_table.on(db.master_table.f_a == db.slave_table.f_a))
'SELECT  master_table.id, master_table.f_a FROM master_table LEFT JOIN 
slave_table ON (master_table.f_a = slave_table.f_a) WHERE (slave_table.id 
IS NULL);'
>>> db(db.slave_table.id == None).select(db.master_table.ALL, left=db.
slave_table.on(db.master_table.f_a == db.slave_table.f_a)).as_list()
[{'id': 2L, 'f_a': 'bbb'}]




On Tuesday, May 13, 2014 7:29:36 PM UTC+2, LoveWeb2py wrote:
>
> Hello,
>
> How could I replicate this SQL Query in a controller and display a grid?
>
>
> Here is what I'm trying to accomplish:
> http://stackoverflow.com/questions/15926348/left-join-to-display-records-not-in-right-table
>
> Here is the query:
> SELECT a.* FROM   ECRDTL_del AS a 
>LEFT JOIN ECRDTL_edit AS b 
>   ON a.Ecrno = b.Ecrno AND 
>  a.Cylno = b.CylnoWHERE  b.Ecrno IS NULL
>
> I basically just want to show all records where the join doesn't match.
>
> I've tried so many ways, but haven't been able to have success with the DAL 
> 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] Re: How to intercept download request

2014-05-13 Thread Niphlod
don't know if it's a problem with the debugger but if you're using only on 
download() function all your "inspection" MUST be done in that function ^_^

On Tuesday, May 13, 2014 1:22:25 PM UTC+2, Mandar Vaze wrote:
>
> I want to audit the downloads - things like "which file was downloaded, by 
> whom and when" etc - and then allow the download to proceed.
>
> I looked at auth.settings.download_url - which is pointing to 
> /app/default/download
>
> So I put debugger (import ipdb;ipdb.set_trace()) in download() function in 
> default controller.
> But when I click on the file link to download - the execution *does not 
> stop* in the debugger
>
> I have several controllers - I assume for all the controllers - the 
> download_url is same (since it is controlled via auth.settings)
> But just to try - I added "download" function in my other controller as 
> well (and put debugger) - still didn't help
>
> What am I missing ?
>
> -Mandar
>
>
>

-- 
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: disable checkbox on selectable grid.

2014-05-13 Thread Niphlod
nope. Selectable takes a callback but not for show/not show the checkbox: 
it's a callable that takes as an input the ids and does something.

On Monday, May 12, 2014 11:44:31 PM UTC+2, TSmith wrote:
>
> Using SQLFORM.grid, I can set editable equal to a lambda function and 
> cause edit buttons to only appear for certain rows  
> for example:  editable= lambda row :  row.locked == 0,
>
> If I use a selectable function to add one check box per row, is there a 
> similar function so I could only have checkboxes enabled for certain 
> records?
>  
>  
>
>

-- 
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: list:reference

2014-05-13 Thread Jesse Ferguson
anthony copy Mandar's Code exactly and then jus go and add a few parents 
then try to add a child with two parents, you will encounter this error..
Traceback

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

Traceback (most recent call last):
  File "C:\Users\User\Desktop\web2py\gluon\restricted.py", line 220, in 
restricted
exec ccode in environment
  File "C:/Users/User/Desktop/web2py/applications/Test/views/appadmin.html" 
, line 189, 
in 

  File "C:\Users\User\Desktop\web2py\gluon\sqlhtml.py", line 3049, in __init__
r = represent(field, r or [], record)
  File "C:\Users\User\Desktop\web2py\gluon\sqlhtml.py", line 59, in represent
return f(value)
  File "C:\Users\User\Desktop\web2py\gluon\dal.py", line 7252, in list_ref_repr
return (refs and ', '.join(f(r,x.id) for x in refs) or '')
TypeError: sequence item 0: expected string, long found

Error snapshot [image: 
help]

(sequence item 0: expected string, long found)

-- 
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: list:reference

2014-05-13 Thread Jesse Ferguson


On Tuesday, May 13, 2014 12:52:24 PM UTC-7, Jesse Ferguson wrote:
>
> anthony copy Mandar's Code exactly and then jus go and add a few parents 
> then try to add a child with two parents, you will encounter this error..
> Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
>
> Traceback (most recent call last):
>   File "C:\Users\User\Desktop\web2py\gluon\restricted.py", line 220, in 
> restricted
> exec ccode in environment
>   File "C:/Users/User/Desktop/web2py/applications/Test/views/appadmin.html" 
> , line 
> 189, in 
> 
>   File "C:\Users\User\Desktop\web2py\gluon\sqlhtml.py", line 3049, in __init__
> r = represent(field, r or [], record)
>   File "C:\Users\User\Desktop\web2py\gluon\sqlhtml.py", line 59, in represent
> return f(value)
>   File "C:\Users\User\Desktop\web2py\gluon\dal.py", line 7252, in 
> list_ref_repr
> return (refs and ', '.join(f(r,x.id) for x in refs) or '')
> TypeError: sequence item 0: expected string, long found
>
> Error snapshot [image: 
> help]
>
> (sequence item 0: expected string, long found)
>



I actually did not add in one apparently *crucial* part,  format='%(fname)s 
%(lname)s'It does in fact work if you have the format. My question now 
is Why does it fail if you don't format the table!?!

-- 
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: Page with a grid and then a form in a loaded component

2014-05-13 Thread Jim S
Please accept my apologies for a horribly un-detailed message.  I have this 
working again, but for the life of me don't know what I changed that got it 
to go again.

But, it is again working, so, thanks for reading, but no further work is 
necessary.

-Jim

On Tuesday, May 13, 2014 8:58:53 AM UTC-5, Jim S wrote:
>
> I have a page that looks like the attached screen shot.
>
> The Freight Rates tab has a loaded component that contains a form.
>
> There is also a form above the tabs and the Submit button for that form is 
> below the tabs.
>
> When I click on Submit, the upper form is processed (all the data is 
> written as expected) but then it navigates to the loaded component.  After 
> the submit, the freight_rates.load page is displayed next, not the index 
> page that should be loaded based on a typical grid.
>
> I have the exact (yeah, right) same scenario working in other areas of my 
> app, but can't seem to figure out why it isn't working this time.
>
> For example, the form seen in contacts.png works just fine.
>
> Any ideas off the top of your head?
>
> I'm trying to get some time this morning to dummy up a little app to show 
> my issue in as little code as possible.
>
> -Jim
>
>

-- 
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: Page with a grid and then a form in a loaded component

2014-05-13 Thread Dave S


On Tuesday, May 13, 2014 6:13:20 PM UTC-7, Jim S wrote:
>
> Please accept my apologies for a horribly un-detailed message.  I have 
> this working again, but for the life of me don't know what I changed that 
> got it to go again.
>
> But, it is again working, so, thanks for reading, but no further work is 
> necessary.
>

Full moon is tomorrow, but congrats!

/dps
 

>
> -Jim
>
> On Tuesday, May 13, 2014 8:58:53 AM UTC-5, Jim S wrote:
>>
>> I have a page that looks like the attached screen shot.
>>
>> The Freight Rates tab has a loaded component that contains a form.
>>
>> There is also a form above the tabs and the Submit button for that form 
>> is below the tabs.
>>
>> When I click on Submit, the upper form is processed (all the data is 
>> written as expected) but then it navigates to the loaded component.  After 
>> the submit, the freight_rates.load page is displayed next, not the index 
>> page that should be loaded based on a typical grid.
>>
>> I have the exact (yeah, right) same scenario working in other areas of my 
>> app, but can't seem to figure out why it isn't working this time.
>>
>> For example, the form seen in contacts.png works just fine.
>>
>> Any ideas off the top of your head?
>>
>> I'm trying to get some time this morning to dummy up a little app to show 
>> my issue in as little code as possible.
>>
>> -Jim
>>
>>

-- 
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 do I filter relationship in SQLForm?

2014-05-13 Thread Fabiano Almeida
Hi all!

I have this relationship:

db.define_table('tipos',
Field('descricao'))

db.define_table('user_ponto',
Field('user_id',db.auth_user, notnull=True, default=me,
readable=False, writable=False),
Field('dia','datetime', default=request.now,
readable=False, writable=False),
Field('tipo', db.tipos, notnull=True, label='Descrição'),
Field('obs','text',label='Notas'))
db.user_ponto.tipo.requires = IS_IN_DB(db,'tipos.id','%(descricao)s')

How do I filter relationship in SQLForm?
How do I filter options of combobox of user_ponto.tipo field in SQLForm?

Exemple:
if test:
SQLForm(db.user_ponto) # show only tipos.id==1
else
SQLForm(db.user_ponto) # show only tipos.id>1

Thankful,

Fabiano.

-- 
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] Batch upload of media?

2014-05-13 Thread Tim Price
Hi Bruno,

I've been playing around with fileuploader, but I'm having some basic 
problems adapting it to my system. 

Specifically, whatever I do, I can't get it to work once I've swapped out 
the table and field names, even though I do it systematically in both 
model, controller, and view. Once I do that, the page produced looks just 
fine, but all uploads I attempt to make return "Failed". That is, the load 
meter counts up, but the files (in this case images) do not post to the db.

Am I missing something here?

Any help would be appreciated.

Thanks.

On Saturday, August 11, 2012 12:56:07 AM UTC+2, rochacbruno wrote:
>
>
>
>
> https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.fileuploader.w2p
>
>
> https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.upload.w2p
>
>
> https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.monitoring_upload.w2p
>
>
>
> On Fri, Aug 10, 2012 at 7:43 PM, lyn2py >wrote:
>
>> Hi,
>>
>> I want to give the user the option to perform a batch upload of their 
>> image files and/or video files.
>>
>> How should I go about that in web2py?
>> Must video and image uploads be performed separately?
>>
>> 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: SQLFORM URL duplicate validation

2014-05-13 Thread Sihui Huang
Here's the 
solution!
 
Thanks!


On Sunday, May 11, 2014 11:53:55 PM UTC-5, Sihui Huang wrote:
>
> I want to forbid users being able to submit duplicate urls into the 
> database.
>
> Right now my approach is:
> db.url.URL.requires=[IS_URL(error_message='URL Error'),
>  IS_NOT_IN_DB(db, 'url.URL',error_message='Dupilcated 
> URL')]
>
> It covers the case for with "http" and without "http". 
> For example, if www.123.com is already in database, then user could not 
> submit http://www.123.com.
> But this approach does NOT cover the case with "https", i.e. the user 
> still could submit https://www.123.com.
>
> Is there anyway to prevent such duplication?
>
> I think eliminating the "http"/"https" ,if any, in urls before calling 
> SQLFORM().process(). In such way, the urls in database are all without 
> "http"/"https". But I don't know how to edit user input before calling 
> SQLFORM().process().
>
> Right now my code is 
> url_form=SQLFORM(db.url).process()
>
> Any ideas?
>
> 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] AppAdmin Link

2014-05-13 Thread Tom Russell
I have in my default.py this code for a button to call appadmin:

{{=A(T("App Admin"), _href=URL('appadmin', scheme='https'), _class='btn',
 _style='margin-top: 1em;')}}

But when I click on the button it defaults to /default/appadmin instead of 
just appadmin. How do I set this properly?

Also, is there a decorator to hide this button if a user is not in a 
certain group?

Thanks,

Tom

-- 
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: Making minor changes to auth.navbar()

2014-05-13 Thread Sébastien Loix
Hello Lewis,
I am having the same issue. Could you tell us where did you put the code 
for the navbar?
Thanks!
Sebastian

El viernes, 20 de julio de 2012 10:35:25 UTC+2, Matt Newton escribió:
>
> Is there a simple way to make changes to the auth.navbar() helper object?
>
> For example, the default for a logged in user is:
>
> "Welcome {First Name} 
> Logout|
>  
> Profile|
>  
> Password"
>
> I would like to change it to:
>
> '{Email} | Logout | Profile | Password
>
> but I'm not sure how to request the information I want when it's masked by 
> the helper object.
>
> Thanks for your help.
>

-- 
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: Appadmin error - 'Column "auth membership"."id" not found (SQL TABLE)'

2014-05-13 Thread Stefan van den Eertwegh
They are generated by web2py. It's strange it has something to do with the 
IDs...

Op dinsdag 13 mei 2014 00:20:38 UTC+2 schreef Dave S:
>
>
>
> On Sunday, May 11, 2014 8:05:15 AM UTC-7, Stefan van den Eertwegh wrote:
>>
>> Hi all,
>>
>> I have a web2py project and a sqlite database and every table  shows this 
>> error: 'Column "auth membership"."id" not found (SQL TABLE)'
>> Ofcourse every table its own error.
>>
>> Does anyone know the solution?
>>
>
> Not me, but a question does occur to me:
>
> How were the tables in your database created?  From within web2py, or 
> imported from somewhere else?
>
> /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] SQLite Data

2014-05-13 Thread Tom Russell
I used csvstudio to process data to the existing sqlite db in web2py. It 
all went very well and now the data is there. The dates however for a date 
column only show up with the word None. Is there something else I am 
missing for the date not to be showing correctly or at all?

Thanks,

Tom

-- 
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: Web2py isn't loading my custom css file

2014-05-13 Thread ari northage-orr
Thanks Massimo! 

For some reason it started randomly working the next time I went to work on 
it, so I'm not really sure what was going on. I'll keep in mind inspecting 
the element with chrome for next time I have an issue like this however. 

Thanks again! 
-Ari

On Saturday, May 10, 2014 10:17:00 AM UTC-5, Massimo Di Pierro wrote:
>
> Use Chrome and inspect the tag that is not styled. Probably there is a 
> conflict about your style and bootstrap.css.
>
> On Friday, 9 May 2014 12:38:59 UTC-5, ari northage-orr wrote:
>>
>> Hey Everyone,
>>
>> So I'm working on a website for a few friends who make music together and 
>> I have a custom css file I'm trying to add and for some reason web2py isn't 
>> loading it, or at least the styles in the file are not being applied. Here 
>> are the details:
>>
>> The file is called wholeteam.css
>>
>> my layout.html where I tell it to import my css file looks like this:
>>
>>  
>>   {{
>>   response.files.insert(0,URL('static','css/web2py.css'))
>>   response.files.insert(1,URL('static','css/bootstrap.min.css'))
>>   
>> response.files.insert(2,URL('static','css/bootstrap-responsive.min.css'))
>>   response.files.insert(3,URL('static','css/web2py_bootstrap.css'))
>>   response.files.insert(4,URL('static','css/wholeteam.css'))
>>   }}
>>
>>   {{include 'web2py_ajax.html'}}
>>
>> rest of layout.html is here
>>
>>
>> my wholeteam.css file looks like:
>>
>> .member-frame{
>> border: 3px solid #FF;
>> background: blue;
>> width: auto;
>> height: auto;
>> }
>>
>> I then try and apply the styles to a div in my views/the_team.html: 
>>
>> {{extend 'layout.html'}}
>> The WholeTeam Crew
>>
>> {{for member in members:}}
>> 
>> {{=member.name}}
>> 
>> {{=member.bio}}
>> 
>> {{pass}}
>>
>> For some reason the styles are not being applied. Does anyone know why 
>> this might be happening? Admittedly I'm pretty new to CSS and HTML5 so it 
>> could be a simple mistake I'm making out of ignorance. 
>> I've inserted an image below so you can see what the page looks like when 
>> I load it, any help would be greatly appreciated.
>>
>> Thanks,
>> -Ari 
>>
>>
>> 
>>
>>
>>
>>
>>
>>
>>

-- 
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] parameterized router BASE breaks appadmin redirection

2014-05-13 Thread cowbert
When BASE is specified in a parameterized router, and an unauthenticated 
session tries to go to the appadmin URL, the admin login controller fails 
to prepend BASE to the value of the hidden form input element 'send', 
causing redirection after authentication to redirect to the wrong URL (the 
one without BASE). The session authentication is successful though, so 
going to the appadmin URL after this will work.

routes.py is the same as routes.parametric.example.py except that

BASE = '/web2py'

Going to:
https://host/web2py/admin/default/design/welcome

results in a redirection to:

https://host/web2py/admin/default/index?send=%2Fadmin%2Fdefault%2Fdesign%2Fwelcome

when send should really =%2Fweb2py%2Fadmin%2Fdefault%2Fdesign%2Fwelcome

This is on 2.9.5-stable+timestamp.2014.03.16.02.35.39 with firefox 29. The 
server does use a proxy to do the webserving, but the rewrite rule is just  
http[s]*://host/web2py/(.*) -> http://127.0.0.1:8080/$1 and the reverse 
maps http://127.0.0.1:8080/(.*) back to http(s)://host/web2py/$1

Is this a bug? Or is some setup wrong? (Everything else seems to be working 
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] form element select add options

2014-05-13 Thread Trend Codax


 Hey guys, 
I have a form, a SQL Form. I'm adding an element, a select element. But how 
can i add Options to this element?


 form = SQLFORM(dba.account_directory)
my_extra_element = TR(LABEL('Country'), SELECT(_name='country'))
form[0].insert(-1,my_extra_element)


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: form element select add options

2014-05-13 Thread Massimo Di Pierro
You are trying to do the wrong thing. Where do the original options come 
from? 


On Monday, 12 May 2014 16:58:04 UTC-5, Trend Codax wrote:
>
>  Hey guys, 
> I have a form, a SQL Form. I'm adding an element, a select element. But 
> how can i add Options to this element?
>
>
>  form = SQLFORM(dba.account_directory)
> my_extra_element = TR(LABEL('Country'), SELECT(_name='country'))
> form[0].insert(-1,my_extra_element)
>
>
> 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] web2py conference - online talks

2014-05-13 Thread Massimo Di Pierro
I have been using angular.js a lot but I find the controller pattern to be 
too constraining. for example I cannot use promises outside the scope of a 
controller. I also find that while easy for simple example is get easily 
out of hands and I find myself having to revert to jQuery for lots of 
stuff. Consider for example the case of opening/closing a panel when a 
button is clicked. One can do this with angular but if you wish to add any 
animation to the panel, you have to use jQuery.




On Monday, 12 May 2014 14:28:48 UTC-5, Michele Comitini wrote:
>
> How is angular.js compared to ractive.js inside web2py's ecosystem? 
> What is your opinion? 
>
> 2014-05-12 18:25 GMT+02:00 António Ramos : 
> > 
> > I´m just in favor of angular to improve and modernize user experience. 
> > In this matter router-ui seems very interesting also. 
> > Also ng animate for animations. 
> > 
> > I dont understand how you relate directly data out of sync with angular 
> and 
> > not with web2py. 
> > If new data on server, just publish it to the clients so all update 
> it.Its a 
> > web2py problem not angular. 
> > 
> > 
> > Regards 
> > António 
> > 
> > 
> > 2014-05-12 16:59 GMT+01:00 weheh : 
> > 
> >> Filtering and sorting can definitely save on http calls. Is there 
> anything 
> >> else you can think of where it's applicable without creating a synch 
> issue 
> >> in highly collaborative apps? 
> >> 
> >> 
> >> On Monday, May 12, 2014 11:37:07 PM UTC+8, Ramos wrote: 
> >>> 
> >>> I was not talking about hiding on click. I was thinking about 
> filtering 
> >>> with a live search box above the table. 
> >>> Angular Filters and directives are awesome and once you know them you 
> >>> cant stop thinking about them. 
> >>> 
> >>> I´m here to learn so feel free to pun me... 
> >>> 
> >>> :P 
> >>> 
> >>> 
> >>> 2014-05-12 16:25 GMT+01:00 weheh : 
> >>> 
>  @Ramos: of course, I understand that Amber's script was necessarily 
>  limited, but it did highlight an important gotcha with this kind of 
>  scripting when used with web2py. And if all I wanted to do was hide a 
> table 
>  entry on click, I wouldn't want to pay the penalty of loading 
> AngularJS to 
>  do that. $(".target").hide() works fine. So I'm still looking for the 
> angle 
>  where AngularJS fits (no pun intended, but happy to make the pun 
> anyway). 
>  ;-) 
>  
>  
>  On Monday, May 12, 2014 6:15:37 PM UTC+8, Ramos wrote: 
> > 
> > Amber was only focused in showing how easy it is to create a better 
> > experience for the user using Angular than simple javascript. 
> > Also a lot less code for us, developers. 
> > 
> > It was just a simple demo. Of course that if the app was real and to 
> be 
> > used by many, she could/should worry about keeping data in sync. 
> > And angular could fetch ajax data just like web2py components.I see 
> no 
> > diference here. Its only a matter of taste. 
> > 
> > I could as well say that using only web2py,if i have 1000 users and 
> > everytime i need to hide a row in a table i need an http call, my 
> server 
> > will die soon with all requests.. and for this angular is a perfect 
> fit. 
> > 
> > 
> > 
> > 
> > 2014-05-12 3:28 GMT+01:00 weheh : 
> >> 
> >> +1 regarding the AngulaJS talk with web2py by Amber Doctor. Kudos 
> to 
> >> Amber for a talk well given! 
> >> 
> >> I've been studying AngularJS a little and haven't written any code, 
> >> yet, but my web Spidey sense is giving off alarms. I think Amber's 
> talk 
> >> underscores a potential danger of client-side MVC. First, correct 
> me if I'm 
> >> wrong, but there's nothing in AngularJS that you can't already do 
> in web2y 
> >> using components. The difference is that Angular does it client 
> side without 
> >> needing to make an http call, so it potentially runs faster. And 
> AngularJS 
> >> seems to have a more compact way of doing things we do in jQuery 
> with 
> >> _onclick="blah blah blah" and other such 
> ajax("url",["target"],":eval"); or 
> >> web2py_component(...) stuff. 
> >> 
> >> The danger highlighted by Amber's example is that Angular makes it 
> >> much easier to create a client-side model that gets out of synch 
> with its 
> >> server-side web2py model. And keeping them in synch violates DRY 
> principles, 
> >> requiring the http calls that you would have had to do anyway if 
> you did a 
> >> web2py-component-only approach. 
> >> 
> >> For instance, if Amber's talk had been about a collaborative recipe 
> >> app and someone was updating the recipe database serverside while 
> somebody 
> >> else was perusing the db clientside, then it would be easy for the 
> >> clientside user to get an out of date recipe and stay ignorant of 
> that fact 
> >> for a very long time. That's because the local copy of the data is 
> fetched 
> 

[web2py] Re: Web2py Conference - Angular Talk by Amber

2014-05-13 Thread Massimo Di Pierro
Mind that it may be easier to replace web2py delimiters than angular 
delimiters:

response.delimiters = ('<%','%>')

On Tuesday, 13 May 2014 11:58:03 UTC-5, Ramos wrote:
>
> *( i use [[ ]] to code angular data inside views)*
>
> It was very informative but this code example
>
> myApp.controller('empCtrl', ['$scope','$http',function($scope,$http) {
> $scope.empresas = {{=XML(list)}};
> 
> }]);
>
> only works inside a script tag, inside a web2py view, because of the XML 
> helper.
>
> I would like to separate my angular code in a separate js file to keep 
> code more organized.
> Any ideas ?
>
> Second issue, ng-repeat inside a web2py view . I coded the link url to 
> documents in my web2py controller 
> *view*
> 
> 
>   
> *[[emp.empresa]] *   
>   
> *code*
> def queryemp():
> temp=[]
> rows = db(db.empresa).select(db.empresa.empresa,db.empresa.id
> ).as_list()
> for x in rows:
> 
> rows[rows.index(x)]['url']=URL('default','showemp',user_signature=True,args=x['id'])
> temp.append(x)
> return dict(list=gluon.contrib.simplejson.dumps(temp))
>
>
>
> I would like instead to do something like
>   href="{{=URL('default','showemp'*,args=[[emp.url]]*)}}">[[emp.empresa]]
>  
>   
>
> but angular inside web2py brackets is not possible. I think...
>
> Comments appreciated.
>
> 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.


Re: [web2py] web2py conference - online talks

2014-05-13 Thread Massimo Di Pierro
I am looking at jQuery.js + underscore.js + reactive.js and I find 
everything I ever looked for. Seems much more flexible than Angular.js and 
I cannot see what I would be missing. What would I be missing?
I just wish they shared the same namespace instead of $, _, Reactive.




On Tuesday, 13 May 2014 23:40:58 UTC-5, Massimo Di Pierro wrote:
>
> I have been using angular.js a lot but I find the controller pattern to be 
> too constraining. for example I cannot use promises outside the scope of a 
> controller. I also find that while easy for simple example is get easily 
> out of hands and I find myself having to revert to jQuery for lots of 
> stuff. Consider for example the case of opening/closing a panel when a 
> button is clicked. One can do this with angular but if you wish to add any 
> animation to the panel, you have to use jQuery.
>
>
>
>
> On Monday, 12 May 2014 14:28:48 UTC-5, Michele Comitini wrote:
>>
>> How is angular.js compared to ractive.js inside web2py's ecosystem? 
>> What is your opinion? 
>>
>> 2014-05-12 18:25 GMT+02:00 António Ramos : 
>> > 
>> > I´m just in favor of angular to improve and modernize user experience. 
>> > In this matter router-ui seems very interesting also. 
>> > Also ng animate for animations. 
>> > 
>> > I dont understand how you relate directly data out of sync with angular 
>> and 
>> > not with web2py. 
>> > If new data on server, just publish it to the clients so all update 
>> it.Its a 
>> > web2py problem not angular. 
>> > 
>> > 
>> > Regards 
>> > António 
>> > 
>> > 
>> > 2014-05-12 16:59 GMT+01:00 weheh : 
>> > 
>> >> Filtering and sorting can definitely save on http calls. Is there 
>> anything 
>> >> else you can think of where it's applicable without creating a synch 
>> issue 
>> >> in highly collaborative apps? 
>> >> 
>> >> 
>> >> On Monday, May 12, 2014 11:37:07 PM UTC+8, Ramos wrote: 
>> >>> 
>> >>> I was not talking about hiding on click. I was thinking about 
>> filtering 
>> >>> with a live search box above the table. 
>> >>> Angular Filters and directives are awesome and once you know them you 
>> >>> cant stop thinking about them. 
>> >>> 
>> >>> I´m here to learn so feel free to pun me... 
>> >>> 
>> >>> :P 
>> >>> 
>> >>> 
>> >>> 2014-05-12 16:25 GMT+01:00 weheh : 
>> >>> 
>>  @Ramos: of course, I understand that Amber's script was necessarily 
>>  limited, but it did highlight an important gotcha with this kind of 
>>  scripting when used with web2py. And if all I wanted to do was hide 
>> a table 
>>  entry on click, I wouldn't want to pay the penalty of loading 
>> AngularJS to 
>>  do that. $(".target").hide() works fine. So I'm still looking for 
>> the angle 
>>  where AngularJS fits (no pun intended, but happy to make the pun 
>> anyway). 
>>  ;-) 
>>  
>>  
>>  On Monday, May 12, 2014 6:15:37 PM UTC+8, Ramos wrote: 
>> > 
>> > Amber was only focused in showing how easy it is to create a better 
>> > experience for the user using Angular than simple javascript. 
>> > Also a lot less code for us, developers. 
>> > 
>> > It was just a simple demo. Of course that if the app was real and 
>> to be 
>> > used by many, she could/should worry about keeping data in sync. 
>> > And angular could fetch ajax data just like web2py components.I see 
>> no 
>> > diference here. Its only a matter of taste. 
>> > 
>> > I could as well say that using only web2py,if i have 1000 users and 
>> > everytime i need to hide a row in a table i need an http call, my 
>> server 
>> > will die soon with all requests.. and for this angular is a perfect 
>> fit. 
>> > 
>> > 
>> > 
>> > 
>> > 2014-05-12 3:28 GMT+01:00 weheh : 
>> >> 
>> >> +1 regarding the AngulaJS talk with web2py by Amber Doctor. Kudos 
>> to 
>> >> Amber for a talk well given! 
>> >> 
>> >> I've been studying AngularJS a little and haven't written any 
>> code, 
>> >> yet, but my web Spidey sense is giving off alarms. I think Amber's 
>> talk 
>> >> underscores a potential danger of client-side MVC. First, correct 
>> me if I'm 
>> >> wrong, but there's nothing in AngularJS that you can't already do 
>> in web2y 
>> >> using components. The difference is that Angular does it client 
>> side without 
>> >> needing to make an http call, so it potentially runs faster. And 
>> AngularJS 
>> >> seems to have a more compact way of doing things we do in jQuery 
>> with 
>> >> _onclick="blah blah blah" and other such 
>> ajax("url",["target"],":eval"); or 
>> >> web2py_component(...) stuff. 
>> >> 
>> >> The danger highlighted by Amber's example is that Angular makes it 
>> >> much easier to create a client-side model that gets out of synch 
>> with its 
>> >> server-side web2py model. And keeping them in synch violates DRY 
>> principles, 
>> >> requiring the http calls that you would have had to do anyway if 
>> yo

[web2py] Re: How to intercept download request

2014-05-13 Thread Mandar Vaze
I don't think the debugger is the problem (yet)
If I put a "print" statement before "return response.download(request, db)" 
in default/download - that also doesn't work (Nothing gets printed on 
web2py console)

To clarify my question further :

1. Is it possible to intercept the download() call ?
2. If yes, then which is the correct place to intercept the download() call 
?
Is it app/default/download

OR

app/controller/download

-Mandar

On Wednesday, May 14, 2014 12:24:48 AM UTC+5:30, Niphlod wrote:
>
> don't know if it's a problem with the debugger but if you're using only on 
> download() function all your "inspection" MUST be done in that function ^_^
>
> On Tuesday, May 13, 2014 1:22:25 PM UTC+2, Mandar Vaze wrote:
>>
>> I want to audit the downloads - things like "which file was downloaded, 
>> by whom and when" etc - and then allow the download to proceed.
>>
>> I looked at auth.settings.download_url - which is pointing to 
>> /app/default/download
>>
>> So I put debugger (import ipdb;ipdb.set_trace()) in download() function 
>> in default controller.
>> But when I click on the file link to download - the execution *does not 
>> stop* in the debugger
>>
>> I have several controllers - I assume for all the controllers - the 
>> download_url is same (since it is controlled via auth.settings)
>> But just to try - I added "download" function in my other controller as 
>> well (and put debugger) - still didn't help
>>
>> What am I missing ?
>>
>> -Mandar
>>
>>
>>

-- 
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 intercept download request

2014-05-13 Thread Niphlod
let's ask another question then. Can you post a link generated by your app 
that "downloads" something ? just the part after the domain is enough.

On Wednesday, May 14, 2014 8:10:31 AM UTC+2, Mandar Vaze wrote:
>
> I don't think the debugger is the problem (yet)
> If I put a "print" statement before "return response.download(request, 
> db)" in default/download - that also doesn't work (Nothing gets printed on 
> web2py console)
>
> To clarify my question further :
>
> 1. Is it possible to intercept the download() call ?
> 2. If yes, then which is the correct place to intercept the download() 
> call ?
> Is it app/default/download
>
> OR
>
> app/controller/download
>
> -Mandar
>
> On Wednesday, May 14, 2014 12:24:48 AM UTC+5:30, Niphlod wrote:
>>
>> don't know if it's a problem with the debugger but if you're using only 
>> on download() function all your "inspection" MUST be done in that function 
>> ^_^
>>
>> On Tuesday, May 13, 2014 1:22:25 PM UTC+2, Mandar Vaze wrote:
>>>
>>> I want to audit the downloads - things like "which file was downloaded, 
>>> by whom and when" etc - and then allow the download to proceed.
>>>
>>> I looked at auth.settings.download_url - which is pointing to 
>>> /app/default/download
>>>
>>> So I put debugger (import ipdb;ipdb.set_trace()) in download() function 
>>> in default controller.
>>> But when I click on the file link to download - the execution *does not 
>>> stop* in the debugger
>>>
>>> I have several controllers - I assume for all the controllers - the 
>>> download_url is same (since it is controlled via auth.settings)
>>> But just to try - I added "download" function in my other controller as 
>>> well (and put debugger) - still didn't help
>>>
>>> What am I missing ?
>>>
>>> -Mandar
>>>
>>>
>>>

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