[web2py] Re: Reference SQLFORM creating duplicate entries, only for new user

2014-11-04 Thread Yi Liu
I think I figured out... The problem was how I select the record. I adapted this code from the book without understanding it thoroughly (chapter 3, the image blog section): db.auth_criteria.user_id.default = auth.user.id record = db.auth_criteria(db.auth_criteria.user_id.default) It was fine wi

[web2py] Re: generating an Excel file on the fly, and creating download link?

2014-11-04 Thread Spokes
Thanks, Massimo! I added the following line before the return statement of the "gimme()" function, and it works perfectly now: response.headers['Content-Type']= 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' On Tuesday, November 4, 2014 6:30:06 PM UTC-5, Massimo Di Pierro

[web2py] Re: Computed fields

2014-11-04 Thread Anthony Smith
Thank for that On Tuesday, 4 November 2014 10:45:30 UTC+11, Anthony Smith wrote: > > Hi > > I am stuck on the following, if no_of _items, dollars_items are not used > the total_sale_price is left blank I get the follow message > > compute=lambda r: r['no_of_items']*r['dollars_items']), > Ty

[web2py] Re: generating an Excel file on the fly, and creating download link?

2014-11-04 Thread Massimo Di Pierro
You need one action to return the data stream and one to create a link: def gimme(): poll_id = request.args(0,cast=int) import xlsxwriter import cStringIO stream = cStringIO.StringIO() ... workbook = xlsxwriter.Workbook(stream) worksheet = workbook.add_wo

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-04 Thread Russ King
Hi Quint Below is the trace - hope it hepls. Russ Traceback (most recent call last): File "C:\web2pysrcdev\web2py\gluon\restricted.py", line 224, in restricted exec ccode in environment File "C:\web2pysrcdev\web2py\applications\gaetest\controllers/default.py", line 128, in File

[web2py] Re: Asynchronous Background Processes

2014-11-04 Thread Niphlod
launching external processes in a web environment is discouraged at so many levels that basically you'll be left alone in the dark for any debugging: very weird things will happen using the multiprocess package in a threaded environment. Additional pains will be faced when web2py is run by apach

[web2py] generating an Excel file on the fly, and creating download link?

2014-11-04 Thread Spokes
I'd like to create an excel file, and create a link for it within a page, without writing the file to disk. I've been trying to do something like this : def create_excel_link(poll_id): import xlsxwriter import cStringIO stream = cStringIO.StringIO() ... workbook

[web2py] Re: represents function

2014-11-04 Thread Alex Glaros
didn't realize comments don't comment out {{}} - the whole thing works beautifully now Anthony thanks! Alex -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Is

Re: [web2py] Set "rname" for auth tables??

2014-11-04 Thread Richard Vézina
Did you try : db.define_table('auth_user, ..., rname='FP_AG_AUTH_USER) ? Richard On Mon, Nov 3, 2014 at 4:53 PM, Fernando Pacheco wrote: > How I can set the "rname" of each standard Auth tables? > > For example, I want table "auth_user" to be created in the database as > FP_AG_AUTH_USER. Howe

[web2py] Re: represents function

2014-11-04 Thread Anthony
Yes, that's because you've still got that in your view. -- 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 subscrib

[web2py] Re: represents function

2014-11-04 Thread Alex Glaros
error is: 'str' object has no attribute 'first_name' HTML {{extend 'layout.html'}} {{=A(commentsHeader.objectDisplayName)}} {{for objectComment in objectComments.render():}} {{=objectComment.created_on}} {{=objectComment.created_by}} {{=MARKMIN(objectComment.superObject

[web2py] Re: Set "rname" for auth tables

2014-11-04 Thread Leonel Câmara
You can define the tables yourself with the rname before calling auth.define_tables. -- 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: represents function

2014-11-04 Thread Anthony
As noted earlier, in the represent function, replace all of the row.auth_user.* with row.*. Anthony On Tuesday, November 4, 2014 4:03:53 PM UTC-5, Alex Glaros wrote: > > HTML > {{extend 'layout.html'}} > > {{=A(commentsHeader.objectDisplayName)}} > > {{for objectComment in objectComments.re

[web2py] Re: Computed fields

2014-11-04 Thread Niphlod
+1. if your calculation needs 3 fields to be something "numeric", you can't ask web2py (or python) to compute something that can't be calculated (you can't do, e.g. 2.1*None*4 and expect a result). Your code should check the existence of the values (at the very least) with something like if r['

[web2py] Re: represents function

2014-11-04 Thread Alex Glaros
HTML {{extend 'layout.html'}} {{=A(commentsHeader.objectDisplayName)}} {{for objectComment in objectComments.render():}} {{=objectComment.created_on}} {{=objectComment.created_by}} {{=MARKMIN(objectComment.superObjectComment)}} {{pass}} {{=form}} CONTROLLER @auth

[web2py] Re: How does web2py uses the auth_tables, while authenticating using ldap (cn).

2014-11-04 Thread Niphlod
web2py doesn't write to ldap. ldap auth has a meaning just for sidestepping the registration process and password renewal. Also, the group table is needed to avoid querying over and over ldap for group membership . If you pass "manage_groups" as True, at every login web2py will fetch the member

[web2py] Re: represents function

2014-11-04 Thread Anthony
This is getting hard to follow because some previous corrections we've made appear to have been reverted. Please show the complete code as it stands right now. On Tuesday, November 4, 2014 2:14:19 PM UTC-5, Alex Glaros wrote: > > what could be causing this error when the render statement is adde

[web2py] Re: Computed fields

2014-11-04 Thread Derek
you are going wrong by computing it when you can't actually compute it. On Monday, November 3, 2014 4:45:30 PM UTC-7, Anthony Smith wrote: > > Hi > > I am stuck on the following, if no_of _items, dollars_items are not used > the total_sale_price is left blank I get the follow message > > com

Re: [web2py] Minor typo in online book

2014-11-04 Thread Spokes
Thanks - done! On Tuesday, November 4, 2014 1:36:57 PM UTC-5, Richard wrote: > > You can log in github et submit a PR after having correct the typo : > https://github.com/mdipierro/web2py-book > > :) > > Richard > > On Tue, Nov 4, 2014 at 11:32 AM, Spokes > > wrote: > >> In the grid section of t

[web2py] Re: duplicate column name error

2014-11-04 Thread Massimo Di Pierro
No. You never need to remove code. You need to erase the content of web2py/applications//databases/* On Monday, 3 November 2014 09:36:25 UTC-6, Ramashish Gaurav wrote: > > Thanks for addressing this issue. > > Actually this is the second time I am coding this reddit clone app and > this time I

[web2py] How does web2py uses the auth_tables, while authenticating using ldap (cn).

2014-11-04 Thread Dennis Jacobs
Hi Guys, I'm having some trouble with understanding how the Auth-module actualy works with ldap. The thing i'm actually trying to do is to create a user (in the best case using the register-form/function), both in ldap and in web2py. After some research i've discovered that web2py requires the

[web2py] Set "rname" for auth tables??

2014-11-04 Thread Fernando Pacheco
How I can set the "rname" of each standard Auth tables? For example, I want table "auth_user" to be created in the database as FP_AG_AUTH_USER. However, I wish to continue using db.auth_user to reference that table. Thank you very much. Best regards. Fernando. -- Resources: - http://web2py.co

[web2py] Set "rname" for auth tables

2014-11-04 Thread Fernando Pacheco
How can I set "rname" for every Auth table (auth_user, auth_group, etc)?. For example, I want that "auth_user" be mapped as FP_IG_AUTH_USER table in database, but I still want access to that table as db.auth_user. Thank you. Best regards. Fernando. -- Resources: - http://web2py.com - http://

[web2py] Computed fields

2014-11-04 Thread Anthony Smith
Hi I am stuck on the following, if no_of _items, dollars_items are not used the total_sale_price is left blank I get the follow message compute=lambda r: r['no_of_items']*r['dollars_items']), TypeError: unsupported operand type(s) for *: 'NoneType' and 'NoneType' If I leave the no_by weight

[web2py] Re: Asynchronous Background Processes

2014-11-04 Thread Josh L
Unfortunately after lots of experimentation I wasn't able to get the multiprocessing module to work with web2py. What I did find however was that I could use subprocess.check_output to launch a Python script containing the multiprocessing module and a pool of workers, and I can get data to the

[web2py] Re: Geraldo Reports 4.0

2014-11-04 Thread Anthony Smith
hi did you have any sucess with this ? On Friday, 3 December 2010 00:22:58 UTC+11, rochacbruno wrote: > > Is there someone using Geraldo Reports 4.0 with web2py? > > http://www.geraldoreports.org/blog/releasing-04/ > > sometime ago someone created a tutorial > http://www.geraldoreports.org/docs

[web2py] Re: represents function

2014-11-04 Thread Alex Glaros
what could be causing this error when the render statement is added? ('LazySet' object has no attribute 'first_name') File "C:/alex/web2py/web2py/web2py/applications/ES1/controllers/default.py" , line 921, in person_represent

[web2py] Re: represents function

2014-11-04 Thread Anthony
{{for objectComment in objectComments.render():}} On Tuesday, November 4, 2014 12:34:50 PM UTC-5, Alex Glaros wrote: > > so to make it work, would I add the render() statement somewhere, where? > > or can I make a join in the controller to include the required auth_user > fields? E.g., > objec

Re: [web2py] Minor typo in online book

2014-11-04 Thread Richard Vézina
You can log in github et submit a PR after having correct the typo : https://github.com/mdipierro/web2py-book :) Richard On Tue, Nov 4, 2014 at 11:32 AM, Spokes wrote: > In the grid section of the forms chapter > , > i

[web2py] Reference SQLFORM creating duplicate entries, only for new user

2014-11-04 Thread Yi Liu
Hi, I am updating my app and encountered this new database problem: Basically, my code defines a "criteria" table that refer to auth_user.id so that each user can set his criteria, or update it. Old code worked fine: db.define_table('auth_criteria', Field

[web2py] Re: represents function

2014-11-04 Thread Alex Glaros
so to make it work, would I add the render() statement somewhere, where? or can I make a join in the controller to include the required auth_user fields? E.g., objectComments = db((db.SuperObjectComment.superObjectID == request.get_vars.filter).select()) & (db.SuperObjectComment.created_by ==

[web2py] Minor typo in online book

2014-11-04 Thread Spokes
In the grid section of the forms chapter , it says, "links = [dict(header='Virtual Field 1',body=lamba row:row.vfield),...]" - of course, "lamba" should be "lambda". No big deal, but can cause a glitch if copying from t

[web2py] Re: Javascript layout

2014-11-04 Thread Richard D
@Anthony, Thank you, from your answer I concluded that it must be possible to use jqwidgets. Loading jquery explicitely, the load completed and ajax did it's job. Not fully ready but a big step in the right direction :) Richard D On Saturday, November 1, 2014 8:51:55 PM UTC+1, Richard D wrot

[web2py] Re: Javascript layout

2014-11-04 Thread Anthony
Looks like the Ajax call isn't getting made. Check the browser developer tools to see what's going on. Is there any Ajax call or JS error in the console? Perhaps you don't have web2py.js loaded or there is some conflict between jqwidgets and web2py.js. Is it possible jQuery has been loaded twic

[web2py] Re: Javascript layout

2014-11-04 Thread Richard D
Leonel, Anthony, thank you for the explanation, i'll be more specific. I try to use jqwidgets ( http://www.jqwidgets.com/) on web2py because we want a more desktop like app with all the benefits web2py has. We also looked at and tested Kendo UI but that is is too much Angular.js oriented. The

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-04 Thread Quint
I suspect we need to add something like this in google.py. But I cannot test anything at the moment so maybe you can try this? def filter(self, query, tableobj, prop, op, value): # NDB uses "_key" in stead of "__key__" if prop == "__key__": prop = "_key" return self.GAE_FILTER_OPTIONS[op](que

[web2py] Re: GAE NDB is there a problem with using belongs on an id field?

2014-11-04 Thread Quint
There was something else I wanted to check. But I need the stack trace first. Could you post it? On Sunday, November 2, 2014 12:18:50 AM UTC+1, Russ King wrote: > > I have established at least a work-around to this issue by updating > google.py file in adapters and creating a new class to use

Re: [web2py] Re: How to implement PostgreSQL "ts_rank" function for full text search?

2014-11-04 Thread Johann Spies
> maybe it's possible to manually extend the Query class somehow? or do I > have to use executesql instead? > > I use executesql increasingly as DAL sometimes causes delaying side-effects especially in combination with large tables (and I have one of more than 1 000 000 000 records). If you use ex

Re: [web2py] Re: How to implement PostgreSQL "ts_rank" function for full text search?

2014-11-04 Thread Alex
is there anything new regarding this topic? I'd like to do full text search in Postgres using DAL: http://www.postgresql.org/docs/current/static/textsearch-tables.html maybe it's possible to manually extend the Query class somehow? or do I have to use executesql instead? Alex -- Resources: -

[web2py] Re: Javascript layout

2014-11-04 Thread Anthony
I think we need to see some code and an example of what you are looking for and what you are seeing instead. -- 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) -

[web2py] Re: represents function

2014-11-04 Thread Anthony
Yes, but your code is no longer calling .render(). -- 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

[web2py] web2py: RESTful API returns "invalid arguments" for any POST request with JSON body

2014-11-04 Thread Tomáš Slobodník
Hi everyone, I run into the following problem when implementing RESTful API. I have this function in my controller: @request.restful() def prop(): response.view = 'generic.json' session.forget(response) def POST(**vars): return dict() return locals() When I use cURL with

[web2py] Re: Javascript layout

2014-11-04 Thread Leonel Câmara
No one is answering because the question doesn't make much sense. There's no such thing as a javascript layout. If you intend to generate the HTML mainly by using javascript you can make a very stripped down layout.html basically just including the scripts and css files you will need, and maybe

[web2py] Re: Support for MS Access?

2014-11-04 Thread Leonel Câmara
No it's not a dict if you do it that way. However if you do it like this: compile_obj = re.compile(r """DRIVER=\{(?P[^}]+)\};SERVER=(?P[\d\.]+);DBQ=(?P[^;]+);UID=(?P[^;]+);PWD=(?P.+)""" ) match_obj = compile_obj.search("""DRIVER={Microsoft Access Driver (*.mdb)};SERVER=192.168.1.182;DBQ=c:\\v3.md

Re: [web2py]

2014-11-04 Thread Michele Comitini
If you ask here it's obvious we will say yes. Since the web2py developers are investing a lot of time and brain power to make it the most productive web framework around for everyone's benefit. Mind that what you learn and what you are able to do, is what gives you future, not the framework you u

[web2py] Re: Support for MS Access?

2014-11-04 Thread ksotiris
thank you for your help Leonel !!! Is very closed that i need. >m = REGEX_URI.match(ruri) ('Microsoft Access Driver (*.mdb)', '192.168.1.182', 'c:\\v3.old.mdb', 'admin', 'incas') is not a dict and if use the m('db') i get the same list >m('db') ('Microsoft Access Driver (*.mdb)', '192.168

Re: [web2py] Re: web2py postgres sort by

2014-11-04 Thread Michele Comitini
Just to be sure try the _select: print db(db.teachers.t_name!='None')._select(db.teachers.t_name, orderby=db.teachers.t_name, distinct=True) You will should see same result using the resulting statement under psql. Now the problem seems your database. The collation is wrong, since it's for US:

[web2py] Re: Javascript layout

2014-11-04 Thread Richard D
Dear All, After some days no reply came to my question. Why is this the case? Is the question wrong, I tried to formulate it in general for the sake of usefullness to others. Richard D On Saturday, November 1, 2014 8:51:55 PM UTC+1, Richard D wrote: > > Hi, > > I want to use a javascript layou

[web2py] Re: no basic auth via wget because current.request.env.http_authorization is none

2014-11-04 Thread Niphlod
how do you call wget ? On Monday, November 3, 2014 11:51:34 PM UTC+1, Falko Delarue wrote: > > wget and the browser http://email:p...@mysite.com > > On Monday, November 3, 2014 4:24:15 PM UTC+1, Niphlod wrote: >> >> how are you trying to access the function (wget, curl, some cmdline >> script, et

[web2py] Re: web2py postgres sort by

2014-11-04 Thread Niphlod
this is more suited to a postgresql forum than a web2py's one On Tuesday, November 4, 2014 8:52:54 AM UTC+1, Yebach wrote: > > Hello > > I have a postgres db with encoding and collation settings > > CREATE DATABASE algit_osnovna_sola > WITH OWNER = postgres >ENCODING = 'UTF8' >

[web2py] Re: auth.settings.login_onaccept and request.vars_next

2014-11-04 Thread Annet
Hi Anthony, Thanks for you reply. You're right the problem lay elsewhere. My application's authentication and authorization is node- and function driven, on failed authentication my application wasn't redirecting to user/login, when I set: auth.settings.on_failed_authentication = URL('default'