[web2py] Re: how to detect if any view exists

2017-10-05 Thread Anthony
On Thursday, October 5, 2017 at 7:21:58 PM UTC-4, Alex Glaros wrote: > can you give me a tip on checking file system? Google. ;-) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: how to detect if any view exists

2017-10-05 Thread 黄祥
*e.g. not tested* import os filename = os.path.join(request.folder, 'views', '%s', '%s.%s') % (request.controller, request.function, 'html') if not os.path.exists(filename): your_code_goes_here best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: how to detect if any view exists

2017-10-05 Thread Alex Glaros
can you give me a tip on checking file system? {{myCurrentPage=str(request.function) + '.html'}} I tried {{if URL('default', myCurrentPage):}} {{include 'default/menu_favorites.html'}} {{pass}} and {{if request.folder,'default', myCurrentPage:}} {{include

[web2py] Re: how to detect if any view exists

2017-10-05 Thread Anthony
Just check if the file exists on the filesystem. On Thursday, October 5, 2017 at 6:21:23 PM UTC-4, Alex Glaros wrote: > > I have a bookmark on every page that appears via layout.html {{include > 'default/menu_favorites.html'}} that reads a small table > > If am testing a new function that does

[web2py] how to detect if any view exists

2017-10-05 Thread Alex Glaros
I have a bookmark on every page that appears via layout.html {{include 'default/menu_favorites.html'}} that reads a small table If am testing a new function that does not yet have a view, it raises this error: 'Rows' object has no attribute 'fields' is there any conditional test to detect if

[web2py] Setup web2py on apache 2.4 along side with plex

2017-10-05 Thread Yoel Benitez Fonseca
Hi, I got all setup and running except that static files are denied by apache (2.4): this is my apache config: -- WSGIDaemonProcess web2py user=apache group=apache WSGIProcessGroup web2py WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py WSGIPassAuthorization On

[web2py] Re: OffTopic - Python help

2017-10-05 Thread Anthony
This code uses a decorator to turn a function into an instance of a special Pipe class. The Pipe class uses the Python "magic" method __ror__ to overload the bitwise OR operator (i.e, the | operator). The __or__ magic method determines the behavior of the | operator when the object with the

Re: [web2py] Re: OffTopic - Python help

2017-10-05 Thread António Ramos
Gotcha! Thank you... Sem vírus. www.avast.com <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> 2017-10-05

[web2py] Re: OffTopic - Python help

2017-10-05 Thread Val K
On Thursday, October 5, 2017 at 11:48:43 PM UTC+3, Ramos wrote: > > Reading this > https://github.com/JulienPalard/Pipe > > i tried this simple code > __ror__ is Right OR ( operator overloading ), so | > is equal Pipe_obj.__ror__(whatever) > > > import functools > > > class Pipe: > >

[web2py] OffTopic - Python help

2017-10-05 Thread António Ramos
Reading this https://github.com/JulienPalard/Pipe i tried this simple code import functools class Pipe: def __init__(self, function): self.function = function functools.update_wrapper(self, function) def __ror__(self, other): return self.function(other)

[web2py] MySql encryption using DAL

2017-10-05 Thread appjarbiz
Hello, I have a Web2py app I'm moving from a dedicated server to the cloud but I'm leaving my MySQL database on the original server. I am connecting to mysql via the DAL: db = DAL('mysql://username:passw...@db.example.com/', pool_size=8, migrate = migrate_dev, lazy_tables=True,

[web2py] How can I add a scrollbar to a web2py dropdown menu

2017-10-05 Thread Michael Dunga
In my application I have a drop-down menu consisting of the names of all countries and I have realized that menu items that fall outside of the width of the screen are not viewable -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

Re: [web2py] parse_as_rest represent

2017-10-05 Thread Carlos Cesar Caballero Díaz
Ok guys, I have solved it using:     def GET(*args, **vars):     patterns = 'auto'     parser = db.parse_as_rest(patterns, args, vars)     if parser.status == 200:     return dict(content=list(parser.response.render()))     else:     raise HTTP(parser.status,

[web2py] Re: Question regarding building dynamic queries

2017-10-05 Thread Anthony
> I tried the following > > query = db.orders.id_buyer == auth.user_id > query1 = query & (db.orders.status == status) > > On printing query1, it will print "False", while I want something like > > print db(query1).count() > > Right now, type command returns the following for query and query1.

[web2py] Re: Question regarding building dynamic queries

2017-10-05 Thread Sarbjit
On Wednesday, October 4, 2017 at 9:02:07 PM UTC-4, Leonel Câmara wrote: > > This is sort of a python question. > > Lets see exactly what this means > > query &= db.orders.status == status. > > This syntax is a python (not web2py or the DAL) shorthand for: > > query = query & (db.orders.status ==

Re: [web2py] Re: left join and common_filter

2017-10-05 Thread Marvi Benedet
Just tried now, and it works perfectly! really many thanks for the support!! Didn't know that db().select(...) construction is discouraged. Marvi 2017-10-02 16:21 GMT+02:00 Anthony : > On Monday, September 11, 2017 at 5:43:30 AM UTC-4, Marvix wrote: >> >> Found that was