[web2py] Re: expanding files

2014-02-16 Thread sasogeek
if I can use expand_one to do so, I don't know how... please help On Monday, 17 February 2014 07:39:42 UTC, sasogeek wrote: > > is there a function like expand_one that allows you to display (.txt .docx > .pptx .pdf) files? > -- Resources: - http://web2py.com - http://web2py.com/book (Documenta

[web2py] Re: expanding files

2014-02-16 Thread sasogeek
if I can use expand_one to do so, I don't know how... please help On Monday, 17 February 2014 07:39:42 UTC, sasogeek wrote: > > is there a function like expand_one that allows you to display (.txt .docx > .pptx .pdf) files? > -- Resources: - http://web2py.com - http://web2py.com/book (Documenta

[web2py] expanding files

2014-02-16 Thread sasogeek
is there a function like expand_one that allows you to display (.txt .docx .pptx .pdf) files? -- 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 receive

[web2py] Re: Web2py instead of MS Access?

2014-02-16 Thread Massimo Di Pierro
Anthony's example is great. Anyway, I would recommend replacing this: def index(): return dict(grid=SQLFORM.grid(db.person, user_signature=False)) with this: @auth.requires_login() def index(): return dict(grid=SQLFORM.smartgrid(db.person)) user_signature=False will expose all data to u

[web2py] Re: logout error

2014-02-16 Thread ajith c t
Hi Massimo, there is one more thing, it seems that the redirect problem is not only with my login function. Every function where I use a redirect call from my controller results in a error page with a log as 303 error. File "/srv/trustvouch-fe/applications/app/controllers/default.py", line 480,

[web2py] Insert on related tables by code

2014-02-16 Thread Luca Guerrieri
Goodmorning, i:m trying to fill a table record by code. All the basic test went good,but now i'm trying to fill a table that has a field wich is a foreign key of another. luca field ('name', db.person) whrn i try to fill i catch an error . . in which way i can compose my instruction for do it? t

[web2py] Re: logout error

2014-02-16 Thread ajith c t
Sorry Massimo, I commented both the requires_login() and requires_permission() for both dashboard() and my index() functions, still the error is same. 2014-02-17 06:12:42,411 - ERROR - app - Traceback (most recent call last): File "/srv/trustvouch-fe/applications/app/controllers/default.py",

Re: [web2py] Re: REF: Join query help!

2014-02-16 Thread Teddy Nyambe
Hi, To makes things easier I have resolved to use db.executesql() it gives a bit more flexibility were dal object model maybe a bit complex. Thanx for your help thus far! On 14 Feb 2014 21:10, "Teddy Nyambe" wrote: > Apologies if I was not clear, when you do a cross join as in the example > you

[web2py] Proper jQuery syntax in a component.load to refer an element in the containing HTML file?

2014-02-16 Thread A36_Marty
I have an index.html page that loads two elements: 1) A select list, id='account_select' 2) A component (open_positions.load) In the component (open_positions.load), I have a

[web2py] Re: postgres beginner questions: passwords, peer authentication, dev/production

2014-02-16 Thread Tim Richardson
I think I will just create postgre roles per app and worry less about this. On Monday, 17 February 2014 08:20:05 UTC+11, Tim Richardson wrote: > > postgres has peer authentication. > If I have mapped OS user www-data to a postgres role, and if apache runs > as www-data, can I use peer authentic

[web2py] Re: how to get globals like "request" available in my own modules ?

2014-02-16 Thread Anthony
Note, instead of this method, you can now use gluon.current. Anthony On Sunday, February 16, 2014 6:32:13 PM UTC-5, Julio F. Schwarzbeck wrote: > > > > > I assume that if you will use modules they'll probably be implemented in > some kind of class, I'd personally do something similar to this..

[web2py] Re: how to get globals like "request" available in my own modules ?

2014-02-16 Thread Julio F Schwarzbeck
I assume that if you will use modules they'll probably be implemented in some kind of class, I'd personally do something similar to this.. # mymodule.py class ModuleHelper(object): """ Sample Helper for common methods. """ def __init__(self, environment): self.request =

[web2py] Re: how to get globals like "request" available in my own modules ?

2014-02-16 Thread Anthony
http://web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules On Sunday, February 16, 2014 4:55:06 PM UTC-5, aapaap wrote: > > hello, > > how to get globals like "request" available in my own modules ? > > thanks, > Stef > -- Resources: - http://web2py.com - ht

Re: [web2py] pass values in "state" parameter oauth

2014-02-16 Thread Michele Comitini
inside the user() action in controllers/default.py you can add: if request.vars.state: auth_provider = cgi.parse_qs(request.vars.state)['auth_provider'][0] then you can do what you need with auth_provider 2014-02-16 12:13 GMT+01:00 ssuresh : > I am using google oauth login as expl

[web2py] how to get globals like "request" available in my own modules ?

2014-02-16 Thread Stef Mientki
hello, how to get globals like "request" available in my own modules ? thanks, Stef -- 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 me

[web2py] Re: is there a way to detect x-frames ?

2014-02-16 Thread Stef Mientki
found something that seems to work (after some modifications) #http://chase-seibert.github.io/blog/2011/01/21/youtube-detecting-x-frame-optionsframebreaking-in-python.htm def Is_Framing_Allowed ( URL ) : import urllib2 req = urllib2.Request ( URL ) ##req.add_header ( "Referer", "http:

[web2py] Re: Web2py instead of MS Access?

2014-02-16 Thread jimbo
Anthony that is really good, very impressive and just what I want! From memory that so far actually seems to be both simpler and better than what MS Access would offer. A lot of people and companies could make good use of web2py as a database, Especially small businesses and charities etc. I ne

[web2py] postgres beginner questions: passwords, peer authentication, dev/production

2014-02-16 Thread Tim Richardson
postgres has peer authentication. If I have mapped OS user www-data to a postgres role, and if apache runs as www-data, can I use peer authentication in web2py and therefore not code a password in? It seems that the connection string is parsed for user and password. The main reason I want to av

[web2py] Question on linking fields

2014-02-16 Thread Greg Vaughan
Hi everyone... Linked tables like... db.define_table('calls', Field('business', 'string'), ... and db.define_table('leads', Field('business', 'reference calls'), ... with controller containing def calls(): form = SQLFORM(db.calls) if form.process().accepted: re

[web2py] Re: Another PEP8 sore

2014-02-16 Thread Massimo Di Pierro
PEP8 has limitations. "field is True" would never work because the "is" operator cannot be overloaded. Only the "==" can be overloaded. Massimo On Sunday, 16 February 2014 12:41:48 UTC-6, Julio F. Schwarzbeck wrote: > > Folks, > > take a look at this piece of code: > > topics = db((db.topic.

[web2py] View does not display datetime in format chosen in database.

2014-02-16 Thread HittingSmoke
I have the following in my model: Field('date', 'date', default=datetime.date.today(), requires = IS_DATE( format=('%B %-d, %Y')), writable=False,readable=False), ...and in the appadmin database entry form the date displays in the format I've chosen. However when db.mytable.date is called in

[web2py] Apply class to MARKMIN helper?

2014-02-16 Thread HittingSmoke
So with other helpers I can do things like P(db.table.field, _class="text-centered") to center the text in a paragraph tag generated by the P helper. Is there any way to do the same with the MARKMIN helper? I have {{=MARKMIN(post.caption)}} set for a photo blog app so I can easily style my pho

[web2py] Another PEP8 sore

2014-02-16 Thread Julio F Schwarzbeck
Folks, take a look at this piece of code: topics = db((db.topic.id == topic_id) & (db.topic.active == True)).select() PEP8 is breaknig with the following error: default.py:xxx:yy: E712 comparison to True should be 'if cond is True:' or 'if cond:' And of course changing (db.topic.active ==

Re: [web2py] Re: Is there a way to use parameters on --run (-R) ?

2014-02-16 Thread Tito Garrido
Thanks!!! On Sat, Feb 15, 2014 at 1:10 AM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > python web2py.py -S welcome -M -R tito.py -A param1 param2 > > > On Friday, 14 February 2014 16:35:15 UTC-6, Tito Garrido wrote: >> >> Hi Folks, >> >> Just a simple test... an external script: >>

[web2py] Re: Menus and Selected Tab

2014-02-16 Thread horridohobbyist
In the latest version of web2py, this solution no longer works. There's no "web2py-menu-active" class. Is it now standard policy for web2py apps not to have menu selections highlighted? Thanks. On Monday, 17 October 2011 15:00:38 UTC-4, Paolo Caruccio wrote: > > If you're using respone.menu to

Re: [web2py] Re: CAS provider and registration

2014-02-16 Thread Massimo Di Pierro
I am open to change this. Do you want to attempt a patch to address some of the issues? Massimo On Sunday, 16 February 2014 05:39:31 UTC-6, Alexei Vinidiktov wrote: > > The first issue is that the client app that uses a cas provider only > provides one option: to log in - in the top navigatio

Re: [web2py] Re: Fixed issue 1422 introduced a bug in generic rss views?

2014-02-16 Thread Alexei Vinidiktov
I'm having the same issue with rss in my InstantPress powered blog. I think it has the same roots. I also replaced the saxutils.py file with the patched one and nothing changed. On Tuesday, June 4, 2013 1:53:03 PM UTC+7, Loïc wrote: > > Hello all, > Am I the only one having issues with generic

[web2py] intermittent edit

2014-02-16 Thread Bruce Burkholder
I downloaded the latest web2py and I get intermittent ability to edit files. I am using a Raspberry Pi model B. I tried editing today and no can do. I can view the file but can not edit it. I tried Firefox, Google Chrome and IE but am not able to edit. Seems if I reboot my RPI and reconnect to

[web2py] autodelete failure!

2014-02-16 Thread Moh'd Iskander
I had the same problem of uploading image in SQLFORM.factory as in https://groups.google.com/forum/#!searchin/web2py/manual$20upload$20sqlform/web2py/Cw5ggpU6CIc/kS6fiRK8l7wJ mdipierro showed number of ways to solve it and his last solution worked for me. But now if I delete the record from the d

[web2py] Re: Custom login form - How to detect login failure?

2014-02-16 Thread Anthony
On Sunday, February 16, 2014 11:07:21 AM UTC-5, André Kablu wrote: > > Or you could automatically check for auth.user_id right after the > validation. > The problem is the auth.login() function does a redirect after failed login, so there's no opportunity to do anything after the auth.login() f

[web2py] Re: How to fix DAL, datetime error

2014-02-16 Thread A36_Marty
Thanks Niphlod. Deleting the database fixed it. I had encountered a few similar errors in the past where deleting the database fixed it. However, this is the first one I've come across where the app would still partially work and not fail immediately at startup. Sounds like SQLite may not eve

[web2py] Re: Custom login form - How to detect login failure?

2014-02-16 Thread André Kablu
Or you could automatically check for auth.user_id right after the validation. Em domingo, 16 de fevereiro de 2014 12h39min40s UTC-3, Anthony escreveu: > > I suppose you could do: > > if response.flash == auth.messages.invalid_login: > > Otherwise, you can create an auth.settings.login_onfail ca

[web2py] Re: Custom login form - How to detect login failure?

2014-02-16 Thread Anthony
I suppose you could do: if response.flash == auth.messages.invalid_login: Otherwise, you can create an auth.settings.login_onfail callback, which can then set a flag in the session indicating login has failed (or redirect somewhere). Anthony On Sunday, February 16, 2014 10:26:45 AM UTC-5, des

[web2py] Possible BUG using legacy tables

2014-02-16 Thread André Kablu
Here is what I have: I have a legacy db in mysql named cep, so I'd created two dbs in my application, one for the app and one for this legacy table: db = DAL('sqlite://storage.sqlite', pool_size=1, check_reserved=['all']) db_endereco = DAL('mysql://user:pass@localhost/cep') db_endereco.define_

[web2py] Re: Form format to match specific theme (bootsrtap)

2014-02-16 Thread desta
Perfect! I will give it a try! Thanks! On Saturday, February 15, 2014 9:23:39 PM UTC+2, Anthony wrote: > > No, you do not have to modify the framework. You can put your custom > function wherever you want (within your own code) -- you can put it in a > module and import it, or just define in a

[web2py] Re: Custom login form - How to detect login failure?

2014-02-16 Thread desta
Hey Anthony thanks for the reply. Yes I am using the auth.login() using a custom form. I am not using the flash message so if the user enters the wrong password the page just reloads without any indication of the login failure. Isn't there another way to find out if the login failed, so I can n

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
Oops. alright, thanks a lot. On Sunday, February 16, 2014 4:58:06 PM UTC+2, Anthony wrote: > > You didn't update your controller code -- request.args(0) should now be > request.vars.code. > > On Sunday, February 16, 2014 9:46:47 AM UTC-5, Avi A wrote: >> >> I mean that it displays the "searching.

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Anthony
You didn't update your controller code -- request.args(0) should now be request.vars.code. On Sunday, February 16, 2014 9:46:47 AM UTC-5, Avi A wrote: > > I mean that it displays the "searching" (the "else" part) and the > query doesn't find it: > > org_code_name = db(db.t_orgs.f_org_code ==

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
I mean that it displays the "searching" (the "else" part) and the query doesn't find it: org_code_name = db(db.t_orgs.f_org_code == request.args(0)).select(db.t_orgs.ALL) if org_code_name: ... else: return 'searching..' if the password is just "123"

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Anthony
Sorry, should be encodeURIComponent. What do you mean it doesn't find it? On Sunday, February 16, 2014 8:52:06 AM UTC-5, Avi A wrote: > > This almost works (no error): > encodeURIComponent (without the "d"). > But it doesn't find it > > On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrot

[web2py] Re: queries from tables

2014-02-16 Thread 黄祥
tried to simplyfied test the query in the shell but got no result (no error occured). e.g. In [4] : sum = db.purchase_detail.quantity.sum() print db().select(sum).first()[sum] In [5] : for row in db(db.product).select(): print row.name product0 product1 product2 In [6] : for row in db(db.purchas

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
This almost works (no error): encodeURIComponent (without the "d"). But it doesn't find it On Sunday, February 16, 2014 3:48:22 PM UTC+2, Avi A wrote: > > "ReferenceError: encodedURIComponent is not defined" > > How do I define it? Do I have to import something? > Thanks. > > > > > On Sunday,

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
"ReferenceError: encodedURIComponent is not defined" How do I define it? Do I have to import something? Thanks. On Sunday, February 16, 2014 3:05:04 PM UTC+2, Avi A wrote: > > great, thanks . > > On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: >> >> and what you expected ? :-P >>

[web2py] Re: How to fix DAL, datetime error

2014-02-16 Thread Niphlod
did you alter the field definition ? SQLite has a big issue when dealing with columns whose type is altered. as a proof of concept, try deleting your database and let web2py recreate it, you shouldn't incur again in any problem. On Sunday, February 16, 2014 6:06:25 AM UTC+1, A36_Marty wrote: >

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
great, thanks . On Sunday, February 16, 2014 3:03:40 PM UTC+2, Niphlod wrote: > > and what you expected ? :-P > you built your function to post to an url like > > /base_url/ > whatever_is_inserted_in_the_form_without_encoding_or_sanitization > > Not every url is a valid one (try opening /base_url

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Niphlod
and what you expected ? :-P you built your function to post to an url like /base_url/whatever_is_inserted_in_the_form_without_encoding_or_sanitization Not every url is a valid one (try opening /base_url/ì^'0=")and its generally NOT safe doing what you're doing. User input in web applicatio

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Anthony
You are passing the password as a URL arg, and in web2py, URL args cannot include special characters. Instead, pass it as a query string variable: $.web2py.component(url + '?code=' + encodedURIComponent(org_code), 'org_form_target'); Anthony On Sunday, February 16, 2014 7:36:17 AM UTC-5, Avi A

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
All I see is:invalid request rendered on the #org_form_target #model db.define_table('t_orgs', Field('f_org_name', type='string', label=T('Organization Name')), Field('f_org_code', type='password', label=T('Organization pasword')), Field('org_api_key', length=64, typ

[web2py] Re: Special chars (like "!") on ajax form.

2014-02-16 Thread Anthony
What do you mean the form won't be accepted? Is it failing validation on the server when form.process() is called? Do you have an IS_STRONG validator defined? What is happening with the Ajax call in the browser? Please show some more code an explain exactly what is happening. On Sunday, Februar

[web2py] Re: CAS login doesn't seem to work in web2py 2.8.2

2014-02-16 Thread Alexei Vinidiktov
Filed a bug report https://code.google.com/p/web2py/issues/detail?id=1875&thanks=1875&ts=1392551348 On Sun, Feb 16, 2014 at 7:49 AM, Alexei Vinidiktov < alexei.vinidik...@gmail.com> wrote: > I think I've come across a bug, and a nasty one too. > > I'm trying to make my apps work with cas authent

Re: [web2py] Re: CAS provider and registration

2014-02-16 Thread Alexei Vinidiktov
The first issue is that the client app that uses a cas provider only provides one option: to log in - in the top navigation bar. I think some users would be at a loss as to how to register since there is no explicit link. The second and third issues are with the cas provider login page. After the

[web2py] pass values in "state" parameter oauth

2014-02-16 Thread ssuresh
I am using google oauth login as explained here https://groups.google.com/forum/#!msg/web2py/fjpbFxRAGJM/pxvoBJKk2UkJ.. I am trying to use the "state" parameter to pass some additional values to google. As I understand we should get the values back in the response from google. My authentication

[web2py] Special chars (like "!") on ajax form.

2014-02-16 Thread Avi A
Hi, I created a table with a password field. I got an ajax (web2py component) form where a user fill the password, and if it's OK, it does something. It works fine, but the problem is that if I use for example "!" in the password field , the form won't be accepted. Is there a solution for that?

[web2py] Re: logout error

2014-02-16 Thread Massimo Di Pierro
Sorry I mean here: @auth.requires_login() @auth.requires_permission(request.function) def dashboard(): you should NOT have both. Perhaps this was causing the problem? On Saturday, 15 February 2014 09:15:18 UTC-6, ajith c t wrote: > > Hi Massimo, > > Thanks for the reply, but sorry to s