[web2py] Re: Hide Admin application based on client IP

2013-08-23 Thread Massimo Di Pierro

You can in web2py but it better to do it via web server/os. Does this help?

http://httpd.apache.org/docs/2.0/mod/mod_access.html

On Thursday, 22 August 2013 23:25:26 UTC-5, zaschu wrote:
>
> I'm trying to secure my Admin application somewhat by making it invisible 
> outside of a specific IP range.  Is this possible to do either via Apache 
> or directly in web2py?
>
> Thanks!
> Zack
>

-- 

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


[web2py] auth.requires(True,requires_login=False) does not work

2013-08-23 Thread Larry Weinberg
It seems that the requires_login option for @auth.requires() does not work. 
 Should it?
Is there another way to make this work for restful calls?  I want to 
implement a token based REST authentication

I get an invalid arguments message.  
If I use Basic Authentication alone it works fine 


Here is my controller:

auth.settings.allow_basic_login = True

# THIS ONE DOES NOT WORKS
@auth.requires(somethingIKnowIsTrue==True, requires_login=False)
@request.restful()
def thisOneDoesNOTWork():
def GET():   
return dict(yo="you got it")
return locals()

# THIS ONE WORKS
@auth.requires_login()
@request.restful()
def thisOneWorks():
def GET():   
return dict(yo="you got it")
return locals()

-- 

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


Re: [web2py] Re: The good and bad about web2py!!!

2013-08-23 Thread Jason (spot) Brower
I also think the everything-already-imported issue that people complain
about is very fun.  Just import it if you feel funny without it. Suddenly
the world is a better place.
BR,
Jason Brower


On Sat, Aug 24, 2013 at 3:46 AM, Jason (spot) Brower wrote:

> He seemed to like it.  I think he is right about the need for better
> testing.  I would really want better tools in the admin interface to
> understand my app and how it's "feeling".
> I liked what he said here:
> Advantages of Web2py
>
> Web2py remains to be the best Python web development framework I’ve ever
> seen, easily beats django and turbogears in terms of the speed and
> simplicity of the development.
>
>
>
> On Fri, Aug 23, 2013 at 5:34 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Good resume Joe!!
>>
>> :)
>>
>> Richard
>>
>>
>> On Fri, Aug 23, 2013 at 2:11 AM, Joe Barnhart wrote:
>>
>>> I'll take the bait, even though the complaint is old.
>>>
>>> His main gripes are that he doesn't like the way web2py works.  That's
>>> fine, if he likes something else better go use it.  Nobody has to love
>>> web2py, it's not a one-size-fits-all kind of world.
>>>
>>> The other arguments range from uninformed to just plain silly.  Like
>>> faulting web2py because it has a DAL instead of an ORM.  It's not a
>>> "fault", it's a design decision.  If I wanted an ORM I'd use a platform
>>> that forced me to like Django.
>>>
>>> I've read a hundred critiques exactly like this one and they always come
>>> down to the same things -- using "exec" threatens the world as we know it,
>>> we import too much automatically, and we just aren't Django enough.
>>>
>>> Yawn.
>>>
>>> -- Joe
>>>
>>> On Wednesday, August 21, 2013 6:45:24 AM UTC-7, Ramos wrote:

 comments ?
 http://ahmedsoliman.com/2010/**07/29/the-good-and-bad-about-**web2py/

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

-- 

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


Re: [web2py] Re: The good and bad about web2py!!!

2013-08-23 Thread Jason (spot) Brower
He seemed to like it.  I think he is right about the need for better
testing.  I would really want better tools in the admin interface to
understand my app and how it's "feeling".
I liked what he said here:
Advantages of Web2py

Web2py remains to be the best Python web development framework I’ve ever
seen, easily beats django and turbogears in terms of the speed and
simplicity of the development.



On Fri, Aug 23, 2013 at 5:34 PM, Richard Vézina  wrote:

> Good resume Joe!!
>
> :)
>
> Richard
>
>
> On Fri, Aug 23, 2013 at 2:11 AM, Joe Barnhart wrote:
>
>> I'll take the bait, even though the complaint is old.
>>
>> His main gripes are that he doesn't like the way web2py works.  That's
>> fine, if he likes something else better go use it.  Nobody has to love
>> web2py, it's not a one-size-fits-all kind of world.
>>
>> The other arguments range from uninformed to just plain silly.  Like
>> faulting web2py because it has a DAL instead of an ORM.  It's not a
>> "fault", it's a design decision.  If I wanted an ORM I'd use a platform
>> that forced me to like Django.
>>
>> I've read a hundred critiques exactly like this one and they always come
>> down to the same things -- using "exec" threatens the world as we know it,
>> we import too much automatically, and we just aren't Django enough.
>>
>> Yawn.
>>
>> -- Joe
>>
>> On Wednesday, August 21, 2013 6:45:24 AM UTC-7, Ramos wrote:
>>>
>>> comments ?
>>> http://ahmedsoliman.com/2010/**07/29/the-good-and-bad-about-**web2py/
>>>
>>  --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

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


[web2py] Re: A jQuery question

2013-08-23 Thread josef ramzi
Good to know. Thank you, Niphlod.

On Friday, August 23, 2013 9:47:43 PM UTC+3, Niphlod wrote:
>
> we are python framework developers. We know about html and js, but it's a 
> hazard to modify by our own such a gigantic lib. 
>
> As long as it's the same version embedded in your app there will be no 
> problem at all.
>
> On Friday, August 23, 2013 3:50:52 PM UTC+2, josef ramzi wrote:
>>
>> Hi everyone.
>> I was wondering if the jQuery library been modified in Web2py (perhaps 
>> for compatibility reasons) or can I import the library (same version) from 
>> another location?
>>
>> Thanks.
>>
>

-- 

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


[web2py] Re: need help to improve download of dynamic images (nginx)

2013-08-23 Thread Niphlod
megalol :-P

BTW, the X-Accel-Redirect is a nice trick. I'll see if we can introduce it 
in later versions.

On Friday, August 23, 2013 9:18:34 PM UTC+2, Adi wrote:
>
> Thanks Niphlod for your help,
> Seems a connection to a legacy database was a culprit for a real slow 
> down...
>
>
> On Thursday, August 22, 2013 4:31:22 PM UTC-4, Niphlod wrote:
>>
>> uhm. download() lets web2py stream the file instead of nginx. 
>> fast_download() too, it just skips the part that handles the authorization 
>> logic and adds correct cache headers, but this will lead to faster loading 
>> of pages from the 2nd time the user accesses the page: it won't change a 
>> thing in the 1st request.
>>
>> Why don't you just put those images in "static/something" ?
>>
>> The other very smart thing to do is using http://wiki.nginx.org/X-accel. 
>> This basically enables nginx to "intercept" an empty page with some 
>> special headers (so web2py does it without even accessing the file) and 
>> take care of serving the file instead of your application. This will 
>> probably speed up your 1st request (and releaves some pressure from the 
>> web2py process), but the hard-limit of bandwith will of course remain 
>> there, no matter what.
>>
>> Your fast download will then kinda look like 
>> def fast_download():
>> 
>> filename = os.path.join(request.folder,'uploads',request.args(0))
>> response.headers['X-Accel-Redirect'] = os.path.join(request.folder, 
>> 'uploads', document.file)
>>  return ''
>>
>>
>>
>> On Thursday, August 22, 2013 10:06:34 PM UTC+2, Adi wrote:
>>>
>>>
>>>
>>> Hello everyone.
>>>
>>> Am trying to populate a page with around 20 dynamic images from the 
>>> upload folder, but they get rendered extremely slow, even as thumbnails. 
>>> Tried using a suggest approach from the forum "fast_download()", but 
>>> without luck in my case. 
>>>
>>> Anyone has a suggestion, what should I be looking at, and how to improve 
>>> the speed of loading dynamic images? 
>>>
>>> Platform: clean ubuntu node with web2py and nginx (no caching setup, 1Gb 
>>> of ram). Nothing else is running on it.
>>>
>>> Performed following three tests:
>>>
>>> Regular download():
>>> Compressed images (through PIL, with extension .thumbnail): 
>>> http://www.webpagetest.org/result/130822_1F_WAD/ (500Kb in 25 sec)
>>> Regular size images: http://www.webpagetest.org/result/130822_5K_ZSX/(3Mb 
>>> in 26 sec)
>>>
>>> Fast_Download() with regular size images:
>>> http://www.webpagetest.org/result/130822_C3_1008/ (3Mb in 28 sec)
>>>
>>> Tried to implement caching in nginx site config, but that disabled 
>>> images completely, and I couldn't get it to work:
>>>
>>> #location ~* ^.+\.(jpg|jpeg|gif)$ {
>>> #   root /home/www-data/web2py/applications/;
>>> #   access_log   off;
>>> #   expires  30d;
>>> #}
>>>
>>> or 
>>>
>>> #location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
>>>  #access_log off;
>>>  #log_not_found off;
>>>  #expires 180d;
>>>  #}
>>>
>>> Fast download used: 
>>> def fast_download():
>>> session.forget(response)
>>> cache.action(time_expire=604800)(lambda: 0)()
>>>
>>> # very basic security (only allow fast_download on 
>>> your_table.upload_field):
>>> if not request.args(0).startswith("product.image"):
>>> return download()
>>>
>>> filename = os.path.join(request.folder,'uploads',request.args(0))
>>>
>>> return response.stream(open(filename,'rb'))
>>>
>>>
>>> Segment of the code that displays the images:
>>>
>>> 
>>> {{if p.image:}}
>>> 
>>> {{
>>> #big_regex = re.compile('|'.join(map(re.escape, 
>>> IMAGE_EXTENSIONS)))
>>> #tmb_image = big_regex.sub(INDEX_TMB, p.image)
>>> }}
>>> >> alt="{{=product_name}}" href="{{=product_link}}" 
>>> height="180px" width="160px"/>
>>> 
>>> 
>>> {{pass}}
>>> 
>>>
>>>
>>>
>>>
>>>  
>>>
>>

-- 

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


[web2py] Re: SQLFORM.grid slow with just 12,500 records???

2013-08-23 Thread Niphlod
perfect ... even then, 40 seconds to fetch 20 records seem a little too 
much.
Are all the "links" between tables defined correctly ? Unless big screwups 
with the underlying data, you shouldn't need ALL those lefts if indeed 
you need those, at least

supplier.id = series.suppliercode
colorgroup.id = series.colorgroup
color.id = product.color
material.id = series.material
tileuse.id = series.tileuse
finish.id = product.finish
cut.id = product.cut
series.id = product.series

should be "covered" by an index. Given that tablename.id is a pk yet, 
there's no need for those, just for the ones on the right side. 

Start with the column that enables the link with the table holding most of 
the rows and measure the time difference.



On Friday, August 23, 2013 10:02:59 PM UTC+2, greenpoise wrote:
>
> Ok fixed it..the error was in my left statements
>
> thanks
>
> d
>
>

-- 

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


[web2py] Re: SQLFORM.grid slow with just 12,500 records???

2013-08-23 Thread greenpoise
Ok fixed it..the error was in my left statements




thanks

d


On Friday, August 23, 2013 11:54:45 AM UTC-7, greenpoise wrote:
>
> What do you mean by blaming web2py?  Did my post sounded like it?? sorry 
> if it did. Anyways, yes I did enabled the toolbar to see the queries and 
> these two are the most time consuming:
>
> SELECT  count(*) FROM product LEFT JOIN supplier ON (supplier.id = 
> series.suppliercode) LEFT JOIN colorgroup ON (colorgroup.id = 
> series.colorgroup) LEFT JOIN color ON (color.id = product.color) LEFT JOIN 
> material ON (material.id = series.material) LEFT JOIN tileuse ON (tileuse.id 
> = series.tileuse) LEFT JOIN finish ON (finish.id = product.finish) LEFT JOIN 
> cut ON (cut.id = product.cut) LEFT JOIN series ON (series.id = 
> product.series) WHERE (series.id IS NOT NULL);
>
> 40721.36ms
>
> SELECT  supplier.suppliercode, product.tilename, series.seriesname, 
> series.seriesdescription, product.finish, product.cut, product.size1, 
> product.size2, color.name, tileuse.abbreviation, product.price, product.cost, 
> series.id FROM product LEFT JOIN supplier ON (supplier.id = 
> series.suppliercode) LEFT JOIN colorgroup ON (colorgroup.id = 
> series.colorgroup) LEFT JOIN color ON (color.id = product.color) LEFT JOIN 
> material ON (material.id = series.material) LEFT JOIN tileuse ON (tileuse.id 
> = series.tileuse) LEFT JOIN finish ON (finish.id = product.finish) LEFT JOIN 
> cut ON (cut.id = product.cut) LEFT JOIN series ON (series.id = 
> product.series) WHERE (series.id IS NOT NULL) ORDER BY series.id, 
> supplier.id, product.id, color.id, tileuse.id LIMIT 20 OFFSET 0;
>
> 39848.31ms
> What should I be on the watch for?
>
>
>
>
> On Friday, August 23, 2013 11:45:35 AM UTC-7, Niphlod wrote:
>>
>> before blaming web2py, did you point your "virtual finger" to the 
>> database ?
>> Did you enable the toolbar to see queries and their relative timings ?
>>
>> On Friday, August 23, 2013 7:28:41 PM UTC+2, greenpoise wrote:
>>>
>>> What could be the culprit??? I have a few left joins but I mean most of 
>>> them are from auxiliary tables. 
>>>
>>

-- 

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


[web2py] Re: need help to improve download of dynamic images (nginx)

2013-08-23 Thread Adi
Thanks Niphlod for your help,
Seems a connection to a legacy database was a culprit for a real slow 
down...


On Thursday, August 22, 2013 4:31:22 PM UTC-4, Niphlod wrote:
>
> uhm. download() lets web2py stream the file instead of nginx. 
> fast_download() too, it just skips the part that handles the authorization 
> logic and adds correct cache headers, but this will lead to faster loading 
> of pages from the 2nd time the user accesses the page: it won't change a 
> thing in the 1st request.
>
> Why don't you just put those images in "static/something" ?
>
> The other very smart thing to do is using http://wiki.nginx.org/X-accel . 
> This basically enables nginx to "intercept" an empty page with some special 
> headers (so web2py does it without even accessing the file) and take care 
> of serving the file instead of your application. This will probably speed 
> up your 1st request (and releaves some pressure from the web2py process), 
> but the hard-limit of bandwith will of course remain there, no matter what.
>
> Your fast download will then kinda look like 
> def fast_download():
> 
> filename = os.path.join(request.folder,'uploads',request.args(0))
> response.headers['X-Accel-Redirect'] = os.path.join(request.folder, 
> 'uploads', document.file)
>  return ''
>
>
>
> On Thursday, August 22, 2013 10:06:34 PM UTC+2, Adi wrote:
>>
>>
>>
>> Hello everyone.
>>
>> Am trying to populate a page with around 20 dynamic images from the 
>> upload folder, but they get rendered extremely slow, even as thumbnails. 
>> Tried using a suggest approach from the forum "fast_download()", but 
>> without luck in my case. 
>>
>> Anyone has a suggestion, what should I be looking at, and how to improve 
>> the speed of loading dynamic images? 
>>
>> Platform: clean ubuntu node with web2py and nginx (no caching setup, 1Gb 
>> of ram). Nothing else is running on it.
>>
>> Performed following three tests:
>>
>> Regular download():
>> Compressed images (through PIL, with extension .thumbnail): 
>> http://www.webpagetest.org/result/130822_1F_WAD/ (500Kb in 25 sec)
>> Regular size images: http://www.webpagetest.org/result/130822_5K_ZSX/(3Mb in 
>> 26 sec)
>>
>> Fast_Download() with regular size images:
>> http://www.webpagetest.org/result/130822_C3_1008/ (3Mb in 28 sec)
>>
>> Tried to implement caching in nginx site config, but that disabled images 
>> completely, and I couldn't get it to work:
>>
>> #location ~* ^.+\.(jpg|jpeg|gif)$ {
>> #   root /home/www-data/web2py/applications/;
>> #   access_log   off;
>> #   expires  30d;
>> #}
>>
>> or 
>>
>> #location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
>>  #access_log off;
>>  #log_not_found off;
>>  #expires 180d;
>>  #}
>>
>> Fast download used: 
>> def fast_download():
>> session.forget(response)
>> cache.action(time_expire=604800)(lambda: 0)()
>>
>> # very basic security (only allow fast_download on 
>> your_table.upload_field):
>> if not request.args(0).startswith("product.image"):
>> return download()
>>
>> filename = os.path.join(request.folder,'uploads',request.args(0))
>>
>> return response.stream(open(filename,'rb'))
>>
>>
>> Segment of the code that displays the images:
>>
>> 
>> {{if p.image:}}
>> 
>> {{
>> #big_regex = re.compile('|'.join(map(re.escape, 
>> IMAGE_EXTENSIONS)))
>> #tmb_image = big_regex.sub(INDEX_TMB, p.image)
>> }}
>> > alt="{{=product_name}}" href="{{=product_link}}" 
>> height="180px" width="160px"/>
>> 
>> 
>> {{pass}}
>> 
>>
>>
>>
>>
>>  
>>
>

-- 

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


[web2py] Re: SQLFORM.grid slow with just 12,500 records???

2013-08-23 Thread greenpoise
What do you mean by blaming web2py?  Did my post sounded like it?? sorry if 
it did. Anyways, yes I did enabled the toolbar to see the queries and these 
two are the most time consuming:

SELECT  count(*) FROM product LEFT JOIN supplier ON (supplier.id = 
series.suppliercode) LEFT JOIN colorgroup ON (colorgroup.id = 
series.colorgroup) LEFT JOIN color ON (color.id = product.color) LEFT JOIN 
material ON (material.id = series.material) LEFT JOIN tileuse ON (tileuse.id = 
series.tileuse) LEFT JOIN finish ON (finish.id = product.finish) LEFT JOIN cut 
ON (cut.id = product.cut) LEFT JOIN series ON (series.id = product.series) 
WHERE (series.id IS NOT NULL);

40721.36ms

SELECT  supplier.suppliercode, product.tilename, series.seriesname, 
series.seriesdescription, product.finish, product.cut, product.size1, 
product.size2, color.name, tileuse.abbreviation, product.price, product.cost, 
series.id FROM product LEFT JOIN supplier ON (supplier.id = 
series.suppliercode) LEFT JOIN colorgroup ON (colorgroup.id = 
series.colorgroup) LEFT JOIN color ON (color.id = product.color) LEFT JOIN 
material ON (material.id = series.material) LEFT JOIN tileuse ON (tileuse.id = 
series.tileuse) LEFT JOIN finish ON (finish.id = product.finish) LEFT JOIN cut 
ON (cut.id = product.cut) LEFT JOIN series ON (series.id = product.series) 
WHERE (series.id IS NOT NULL) ORDER BY series.id, supplier.id, product.id, 
color.id, tileuse.id LIMIT 20 OFFSET 0;

39848.31ms
What should I be on the watch for?




On Friday, August 23, 2013 11:45:35 AM UTC-7, Niphlod wrote:
>
> before blaming web2py, did you point your "virtual finger" to the database 
> ?
> Did you enable the toolbar to see queries and their relative timings ?
>
> On Friday, August 23, 2013 7:28:41 PM UTC+2, greenpoise wrote:
>>
>> What could be the culprit??? I have a few left joins but I mean most of 
>> them are from auxiliary tables. 
>>
>

-- 

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


[web2py] Re: A jQuery question

2013-08-23 Thread Niphlod
we are python framework developers. We know about html and js, but it's a 
hazard to modify by our own such a gigantic lib. 

As long as it's the same version embedded in your app there will be no 
problem at all.

On Friday, August 23, 2013 3:50:52 PM UTC+2, josef ramzi wrote:
>
> Hi everyone.
> I was wondering if the jQuery library been modified in Web2py (perhaps for 
> compatibility reasons) or can I import the library (same version) from 
> another location?
>
> Thanks.
>

-- 

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


[web2py] Re: SQLFORM.grid slow with just 12,500 records???

2013-08-23 Thread Niphlod
before blaming web2py, did you point your "virtual finger" to the database ?
Did you enable the toolbar to see queries and their relative timings ?

On Friday, August 23, 2013 7:28:41 PM UTC+2, greenpoise wrote:
>
> What could be the culprit??? I have a few left joins but I mean most of 
> them are from auxiliary tables. 
>

-- 

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


[web2py] Re: Help creating RESTful webservice

2013-08-23 Thread Niphlod
seems that you're using the binary version. May I ask why do you need to 
reimport pyodbc on your own ?
Why not just using db = DAL("mssql:// etc etc etc ") ?

On Friday, August 23, 2013 8:09:45 PM UTC+2, GregD wrote:
>
> Hi,
>
> We're new to Web2py and starting to use it more and more to meet 
> customer's demand for Web Apps.  Currently, we need to create a few forms 
> to retrieve info from production database system.
>
> Our environment is as follows:
> Windows Server 2008 R2
> SQL Server 2012 Standard
> IIS 7.0
>
> We've downloaded web2py and have forms created.  However, we are having 
> issues connecting to existing SQL Server database.  Our DAL is as follows:
>
> import pyodbc
> from gluon.dal import MSSQLAdapter
> if not (MSSQLAdapter.driver):
>   MSSQLAdapter.driver = pyodbc
> db = pyodbc.connect("DRIVER={SQL 
> SERVER};SERVER=localhost\sqlexpress2012;DATABASE=Customer;UID=sa;PWD=***")
>
> We've defined the tables as follows:
>
> db.define_table('Locals', 
> Field('id', 'int'),
> Field('Name', 'str'),
> Field('Logo', 'buffer'),
> Field('ActiveFlag', 'bool' ),
> Field('RowVersion', 'datetime.datetime'),
> Field('Address1', 'str'),
> Field('Address2', 'str'),
> Field('City', 'str'),
> Field('State', 'str'),
> Field('Zip', 'str'),
> Field('Phone', 'str'),
> Field('PrimaryContact', 'str'),
> Field('SecondaryContact', 'str'),
> Field('FaxTitle', 'str'),
> Field('TestingName', 'str'),
> Field('RecieveParts', 'str'),
> primarykey=[id],
> migrate=False)
>
> however, when we attempt to connect to database from admin page we get ...
>
> Traceback (most recent call last):
>   File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 212, in 
> restricted
>   File "C:/web2py/applications/Reciprocity/models/db.py" 
> , line 
> 61, in 
> AttributeError: 'pyodbc.Connection' object has no attribute 'define_table'
>
> It appears there is no define_table method in pyodbc, is that correct?  If 
> so, how should we model exsiting SQL Server tables using pyodbc?
>
>

-- 

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


[web2py] how to bring out db table

2013-08-23 Thread zakaria danone

Hello the world
i'm new in web2py 
i have created my db in db.py but i can't access it directly in my app 
eccept if i go to db.py
pls can't sombody guide i want to view derectly de db and the record on my 
site Thanks

-- 

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


[web2py] web2py on GoDaddy shared hosting

2013-08-23 Thread ranjith
Hi,

I am new to web2py. I have a shared hosting account in Godaddy. Will I be 
able to deploy my web2py app in GoDaddy??

-- 

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


[web2py] Hide Admin application based on client IP

2013-08-23 Thread zaschu
I'm trying to secure my Admin application somewhat by making it invisible 
outside of a specific IP range.  Is this possible to do either via Apache 
or directly in web2py?

Thanks!
Zack

-- 

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


Re: [web2py] production site hosting

2013-08-23 Thread ranjith
Yes. I too have the confusion here. None of the webfraction servers in 
India. My target users are in India(Mainly Tamil Nadu). Even is it good to 
go towards WebFraction?

On Tuesday, 20 December 2011 20:29:00 UTC+5:30, Chandrakant Kumar wrote:
>
> I prefer shared hosts over VPS. My only concern with webfaction is the  
> location of servers. servers are located in Texas & Amsterdam, while my  
> target user base in India.
>
> On Tue, 20 Dec 2011 20:24:03 +0530, Ross Peoples 
> > 
>  
> wrote:
>
> > There's a sticky on this somewhere, but webfaction is always recommended.
> > There is also Google App Engine. If you would like a VPS-like host  
> > instead,
> > then Rackspace, VPS.NET and Amazon EC2 are also options.
>
>
>

-- 

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


[web2py] A jQuery question

2013-08-23 Thread josef ramzi
Hi everyone.
I was wondering if the jQuery library been modified in Web2py (perhaps for 
compatibility reasons) or can I import the library (same version) from 
another location?

Thanks.

-- 

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


[web2py] A jQuery question: has it been modified?

2013-08-23 Thread josef ramzi

Hi everyone.
I was wondering if the jQuery library was modified by the Web2py team 
(maybe for compatibility reasons), because if it is, this would make it 
preferable to import it from the static files, correct?

-- 

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


[web2py] Re: web2py | Email + IMAP | Help Wanted

2013-08-23 Thread Alan Etkin
> For every query and search, does the DAL adapter do all these steps?
> Read email box lists + Then Search for messages matching query + Separate 
> Fetch for
> each message

Well, actually, I think the mailbox list can be set in the model (so
it supposedly saves the list retrieval request).

> Do you have a schematic diagram of all the processes, transactions, read mail 
> box
> requests + responses, search requests + responses, mail fetch, etc.? If yes, 
> does not
> every http request cost a lot more time and bandwidth in and by itself?

I'm afraid I don't, so far. However, the code in IMAPAdapter is pretty
straight forward. I suppose you can make any research you need of the
workflow in the code itself (and ideally post it somewhere so it gets
documented).

> How can it be made faster with only using IMAP server, and not deploying any 
> local
> secondary backend DB?

Allow me to insist in a sqlite/wathever mails db for fast queries. We
could make the mail retrieval faster by requesting bulk messages. The
problem is that AFAIK imaplib mangles multiple message responses (at
least with gmail).

> Will it be faster if I use the python imaplib to First Search the UIDs of 
> emails, and then:
> use the DAL adapter to fetch the contents or headers of the respective UIDs?

Why not. For that particular case (i.e. requesting only the ids/uids
for a given query), we could make the .select() a lot faster since it
requires a single command (it does not need to retrieve any message
part).

> http://imapclient.readthedocs.org/en/latest/

I didn't know about it. Have you tried it? It could be a good
alternative for retrieving multiple messages.

-- 

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


[web2py] Re: tuple and list problem.

2013-08-23 Thread Annet
Finally figured it out: navlist=VCARDID_NAVLIST + tuple(form.vars.navID)

-- 

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


[web2py] Help creating RESTful webservice

2013-08-23 Thread GregD
Hi,

We're new to Web2py and starting to use it more and more to meet customer's 
demand for Web Apps.  Currently, we need to create a few forms to retrieve 
info from production database system.

Our environment is as follows:
Windows Server 2008 R2
SQL Server 2012 Standard
IIS 7.0

We've downloaded web2py and have forms created.  However, we are having 
issues connecting to existing SQL Server database.  Our DAL is as follows:

import pyodbc
from gluon.dal import MSSQLAdapter
if not (MSSQLAdapter.driver):
  MSSQLAdapter.driver = pyodbc
db = pyodbc.connect("DRIVER={SQL 
SERVER};SERVER=localhost\sqlexpress2012;DATABASE=Customer;UID=sa;PWD=***")

We've defined the tables as follows:

db.define_table('Locals', 
Field('id', 'int'),
Field('Name', 'str'),
Field('Logo', 'buffer'),
Field('ActiveFlag', 'bool' ),
Field('RowVersion', 'datetime.datetime'),
Field('Address1', 'str'),
Field('Address2', 'str'),
Field('City', 'str'),
Field('State', 'str'),
Field('Zip', 'str'),
Field('Phone', 'str'),
Field('PrimaryContact', 'str'),
Field('SecondaryContact', 'str'),
Field('FaxTitle', 'str'),
Field('TestingName', 'str'),
Field('RecieveParts', 'str'),
primarykey=[id],
migrate=False)

however, when we attempt to connect to database from admin page we get ...

Traceback (most recent call last):
  File "/home/mdipierro/make_web2py/web2py/gluon/restricted.py", line 212, in 
restricted
  File "C:/web2py/applications/Reciprocity/models/db.py" 
, line 
61, in 
AttributeError: 'pyodbc.Connection' object has no attribute 'define_table'

It appears there is no define_table method in pyodbc, is that correct?  If so, 
how should we model exsiting SQL Server tables using pyodbc?

-- 

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


[web2py] SQLFORM.grid slow with just 12,500 records???

2013-08-23 Thread greenpoise
What could be the culprit??? I have a few left joins but I mean most of 
them are from auxiliary tables. 

-- 

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


Re: [web2py] Re: response.view as a decorator

2013-08-23 Thread samuel bonill
thanks Anthony

@View('path/to/file')
def example():
 return locals()

implement this decorator is based on my personal taste


2013/8/22 Anthony 

>
> from gluon import current
>> response = current.response
>>
>> class View(object):
>>def __init__(self, path):
>> 
>> def __call__(self, fn):
>> def _call():
>>  response.view = self.path
>>
>
> No, don't do that. If you assign current.response to response at the top
> level in the module, it will not be updated on each request. Instead, in
> the _call() function, do current.response.view = self.path.
>
> Anyway, I agree with Niphod -- this seems like a completely gratuitous use
> of a decorator.
>
> Anthony
>
> --
>
> ---
> 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/ljp1IcabuSE/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/groups/opt_out.
>

-- 

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


Re: [web2py] Re: The good and bad about web2py!!!

2013-08-23 Thread Richard Vézina
Good resume Joe!!

:)

Richard


On Fri, Aug 23, 2013 at 2:11 AM, Joe Barnhart wrote:

> I'll take the bait, even though the complaint is old.
>
> His main gripes are that he doesn't like the way web2py works.  That's
> fine, if he likes something else better go use it.  Nobody has to love
> web2py, it's not a one-size-fits-all kind of world.
>
> The other arguments range from uninformed to just plain silly.  Like
> faulting web2py because it has a DAL instead of an ORM.  It's not a
> "fault", it's a design decision.  If I wanted an ORM I'd use a platform
> that forced me to like Django.
>
> I've read a hundred critiques exactly like this one and they always come
> down to the same things -- using "exec" threatens the world as we know it,
> we import too much automatically, and we just aren't Django enough.
>
> Yawn.
>
> -- Joe
>
> On Wednesday, August 21, 2013 6:45:24 AM UTC-7, Ramos wrote:
>>
>> comments ?
>> http://ahmedsoliman.com/2010/**07/29/the-good-and-bad-about-**web2py/
>>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

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


Re: [web2py] Re: Defining stored procedures

2013-08-23 Thread mcamel
Hi,

I've read this section on the manual several times (
http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#executesql),
 
but wasn't able to understand its meaning.

The reason is that the first three lines are missing, letting the text 
without the explanation of the purpose of 'fields' argument:

Added 2012-08-24 "fields" optional argument. If not None, the
> results cursor returned by the DB driver will be converted to a 
> DAL Rows object using the db._adapter.parse() method. This requires
>
 
 I think the manual needs to include the words "...will be converted to a 
DAL Rows object..." to clarify it.

¡Thank you, Anthony!.


> On Sunday, August 26, 2012 8:55:52 PM UTC-4, Andrew wrote:
>>
>> Thanks Anthony,   Wasn't aware of that one, and it looks quite useful.
>>
>>
>> On Monday, August 27, 2012 6:29:55 AM UTC+12, Anthony wrote:
>>>
>>> Often wondered about this too.  You would also have to call them with 
 executesql.
 So should the dal API support stored procedure , database macro 
 definitions and execution? 

 Would require work in each database adapter, but could we come up with 
 a single interface ?

>>> Do you mean for creating stored procedures, or calling them? To call 
>>> them, you can use db.executesql(). If you want the returned data to be 
>>> parsed into a DAL Rows object like a regular select() would be, you can now 
>>> specify a "fields" argument to executesql(). Here's the docstring 
>>> explaining its usage:
>>>
>>> Added 2012-08-24 "fields" optional argument. If not None, the
>>> results cursor returned by the DB driver will be converted to a
>>> DAL Rows object using the db._adapter.parse() method. This requires
>>> specifying the "fields" argument as a list of DAL Field objects
>>> that match the fields returned from the DB. The Field objects should
>>> be part of one or more Table objects defined on the DAL object.
>>> The "fields" list can include one or more DAL Table objects in addition
>>> to or instead of including Field objects, or it can be just a single
>>> table (not in a list). In that case, the Field objects will be
>>> extracted from the table(s).
>>>
>>> The field names will be extracted from the Field objects, or optionally,
>>> a list of field names can be provided (in tablename.fieldname format)
>>> via the "colnames" argument. Note, the fields and colnames must be in
>>> the same order as the fields in the results cursor returned from the DB.
>>>  
>>> Anthony
>>>
>>

-- 

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


[web2py] Re: tracking file downloads on database

2013-08-23 Thread Niphlod


On Friday, August 23, 2013 10:49:07 AM UTC+2, Marco Prosperi wrote:
>
>
> hello, I would like to track the number of user download of some files on 
> database. The approach I've thought about is:
> - when the user clicks on the filename link in the first view, myapp 
> redirects to a new page (a controller is called which register on the 
> database the new click) with 'your download should start shortly'
> - a dialog pops up to download the file
>
> The question is: how to pop up the download file automatically in the 
> second view?
>
> thanks in advance for hints,
>
> Marco
>

the only way to achieve that is by opening a window with javascript. 
web2py.js ships with a $.web2py.popup(theurltoopen) just for the occasion, 
but it's easy to do just window.open(url, 'name of the window'). The thing 
is: do you really need an intermediate page just to count download clicks ?

-- 

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


Re: [web2py] tracking file downloads on database

2013-08-23 Thread Vinicius Assef
Use response.stream()

On Fri, Aug 23, 2013 at 5:49 AM, Marco Prosperi
 wrote:
>
> hello, I would like to track the number of user download of some files on
> database. The approach I've thought about is:
> - when the user clicks on the filename link in the first view, myapp
> redirects to a new page (a controller is called which register on the
> database the new click) with 'your download should start shortly'
> - a dialog pops up to download the file
>
> The question is: how to pop up the download file automatically in the second
> view?
>
> thanks in advance for hints,
>
> Marco
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 

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


Re: [web2py] Re: form widget and validation

2013-08-23 Thread Manuele Pesenti
Il 22/08/13 16:03, Niphlod ha scritto:
> seems no. Dictform is quite handy to do basic stuff, but if you need
> more factory is the right tool.
you're right thanks :)

M.

-- 

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


[web2py] tracking file downloads on database

2013-08-23 Thread Marco Prosperi

hello, I would like to track the number of user download of some files on 
database. The approach I've thought about is:
- when the user clicks on the filename link in the first view, myapp 
redirects to a new page (a controller is called which register on the 
database the new click) with 'your download should start shortly'
- a dialog pops up to download the file

The question is: how to pop up the download file automatically in the 
second view?

thanks in advance for hints,

Marco

-- 

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


Re: [web2py] Re: bootstrap 3

2013-08-23 Thread Michele Comitini
IMHO I would be careful in adding support to presentation frameworks inside
main web2py distribution.
The scaffolding applications should be a projects on their own.
This way there could be different scaffolding apps targeting different
presentation frameworks to choose from.
The one scaffolding app distributed together with web2py would be selected
using a criteria of maturity or whatever.
I think web2py community now is large and mature enough and would benefit
from this separation.

mic


2013/8/22 Sebastián Tromer 

> According to *Paul Irish* 100% faster paint time with Bootstrap 3
>
> Source: http://www.youtube.com/watch?v=Z1IqzeA3XXg
>
> El jueves, 1 de agosto de 2013 04:04:49 UTC-3, Massimo Di Pierro escribió:
>
>> Why is 3 better than 2 other than the higher number? The buttons do not
>> look as nice.
>>
>> On Wednesday, 31 July 2013 10:56:39 UTC-5, VP wrote:
>>>
>>> not quite compatible with web2py yet.  Navbar are all messed up.
>>>  Possibly other things as well.
>>>
>>> I think no more span-12, span-10, etc.   new syntax is col-lg-12, etc.
>>>
>>>
>>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 

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


Re: [web2py] Re: IS_EMPTY_OR(IS_IN_DB(db,'plugin.id',...,multiple=(1,5))) back to []

2013-08-23 Thread Annet
Hi Richard,

Thanks for your reply. I'll give your solution a try.


Kind regards,

Annet

-- 

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


[web2py] Re: tuple and list problem.

2013-08-23 Thread Annet
Thanks for you reply.

if you want to end up with a tuple (as VCARDID_NAVLIST is), you can convert 
> the list:reference string with:
>
> navlist=VCARDID_NAVLIST + tuple(form.vars.navID[1:-1].split('|'))
>

I tried your solution, but got this error:

navlist=VCARDID_NAVLIST + tuple(form.vars.navID[1:-1].split('|'))
AttributeError: 'list' object has no attribute 'split'




This is the field definition in db.py:

Field('navID','list:reference 
nav',requires=IS_EMPTY_OR(IS_IN_DB(db(db.nav.id.belongs(MSITE_OPTIONS)),'nav.id','%(name)s',orderby='nav.id',multiple=(1,
 
5))),ondelete='RESTRICT'),


Kind regards,

Annet

-- 

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


[web2py] Re: bug in trunk with request.vars being turned into a list with a duplicated value???

2013-08-23 Thread Niphlod
that's what we are trying and discussing about: if the get(post)_vars 
should depend on GET and POST request method or if they are aliases for 
"parsed_query_string" (get_vars) and "parsed_body_string" (post_vars). 

The fact is, in the 90% of the cases they practically overlap. Most of the 
users are using request.vars unconditionally, so less and less code will 
eventually brake. But we need to make a decision and live with the 
consequences ^_^ (I'm hearing right now the next blogpost saying "web2py's 
shitty naming convention for variables...") 

On Thursday, August 22, 2013 11:55:58 PM UTC+2, Tim Richardson wrote:
>
>
> Here's the catch: in CGI there are multiple ways to submit params in a 
>> POST request:
>> - with the "query string"
>> - with body holding the "query string" (application/x-www-form-urlencoded)
>> - with body holding a mime format (multipart/form-data)
>>
>
> Thanks. I didn't know that: I thought query string and GET were in an 
> exclusive relationship.  
>

-- 

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