Re: [web2py] Re: Not working for versions >2.2.1

2013-04-28 Thread Carlo Bazzo
thank you Antony, now everything makes sense. carlo Il 28/04/2013 20.43, Anthony ha scritto: Actually, it only appeared to be working prior to 2.2.1. What happened with prior versions is that you inadvertently turned off your CSRF protection. In earlier versions, session.clear() would complet

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread 黄祥
pardon me, for not tell obviously about the code that i want to achieve my objective : i want to have a grand total of items (sum) that have been in shopping cart's session, check is the item have a promotion price or not, if have a promotion price (promotion_price > 0) use promotion price of it

Re: [web2py] Re: Error Pages via AutoRoutes

2013-04-28 Thread Massimo Di Pierro
Nailed! It is slowly coming back now @Nickolay, you say "we've lost the ability". Are you saying something changed in web2py that broke it? Which version did you upgrade from/to? Or are you saying that you switched to using autoroutes and routes_errors do not work? In this case can you post

[web2py] Re: Anyone used WHOOSH as search engine with web2py?

2013-04-28 Thread Massimo Di Pierro
This is all I have on the topic: https://gist.github.com/mdipierro/5479683 On Sunday, 28 April 2013 22:42:45 UTC-5, Brian Erickson wrote: > > Hi Select, I'm resurrecting this topic to hopefully get a clue on how to > implement this. Any help appreciated. > I got the Whoosh source, unpacked and

Re: [web2py] Re: Error Pages via AutoRoutes

2013-04-28 Thread Jonathan Lundell
On 28 Apr 2013, at 9:12 PM, Massimo Di Pierro wrote: > Your english is fine. I just had forgotten about autoroutes.py. I forgot who > wrote it. Perhaps I did. Not sure. I look into this asap. You wrote it in October 2010 ;-) > > On Sunday, 28 April 2013 18:27:55 UTC-5, Nikolay wrote: > Hi, >

[web2py] Re: Anyone used WHOOSH as search engine with web2py?

2013-04-28 Thread Brian Erickson
Hi Select, I'm resurrecting this topic to hopefully get a clue on how to implement this. Any help appreciated. I got the Whoosh source, unpacked and put just the folder 'whoosh' into site-applications. I created the files you provided search.py and search/index.html. On visiting seach.html web2p

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread Massimo Di Pierro
The syntax error is grand_total=sum(db.product(id).promotion_price*qty else: db.product(id).unit_price*qty for id, qty in session.order.items() if db.product(id).promotion_price ) should be grand_total=sum(db.product(id).promotion_price*qty for id, qty in session.order.items() if db.product(

Re: [web2py] Re: Error Pages via AutoRoutes

2013-04-28 Thread Massimo Di Pierro
Your english is fine. I just had forgotten about autoroutes.py. I forgot who wrote it. Perhaps I did. Not sure. I look into this asap. On Sunday, 28 April 2013 18:27:55 UTC-5, Nikolay wrote: > > Hi, > > Massimo. My english is not so good, sorry for this. But, Jonathan is > correct. I use this fi

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread 黄祥
a, i'm sorry, i'm just tested 'one single query' only when promotion_price > 0, when i set promotion price = 0, both query is return 0. when i use one query per item it returns an error : Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. Traceback (most recent call last): File "/home/stifank/Desktop/we

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread 黄祥
thanks again, both is work, i've tested it. grand_total=sum(item.promotion_price*session.order[item.id] for item in *db(db.product.id.belongs(*session.order.keys())&(db.product.promotion_price>0)).select(db.product.id,db.product.promotion_price)) > > -- --- You received this message because y

[web2py] Re: ORM (?) : A Revisit, NOT a Rebuttal

2013-04-28 Thread Anthony
Another past effort: https://code.google.com/p/web2pyorm/ On Sunday, April 28, 2013 8:59:40 PM UTC-4, Anthony wrote: > > I think you're arguing against a bit of a straw man here. Past resistance > to the idea of an ORM has usually been in the context of suggestions for an > ORM *instead of* a DA

[web2py] Re: ORM (?) : A Revisit, NOT a Rebuttal

2013-04-28 Thread Anthony
I think you're arguing against a bit of a straw man here. Past resistance to the idea of an ORM has usually been in the context of suggestions for an ORM *instead of* a DAL, not as an additional abstraction on top of the DAL for particular use cases. As Massimo noted, there have already been som

[web2py] Re: newby authorization question - need example

2013-04-28 Thread Alex Glaros
It's now in slices: http://www.web2pyslices.com/slice/show/1622/how-to-authorize-users-editing-records-only-for-records-that-were-created-by-tho Thanks again Anthony and Steve, Alex On Sunday, April 28, 2013 11:37:27 AM UTC-7, Anthony wrote: > > Yeah, might not be a bad idea to show an explicit

Re: [web2py] Re: Error Pages via AutoRoutes

2013-04-28 Thread Nikolay
Hi, Massimo. My english is not so good, sorry for this. But, Jonathan is correct. I use this file as routes.py. But if I add onerror, it does not work and I get "invalid controller" instead of error page. On static routes I use code above and it work fine. https://web2py.googlecode.com/hg/scri

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread Massimo Di Pierro
No problem. On second thought, even better: grand_total=sum(item.promotion_price*session.order[item.id] for item in *db(db.product.id.belongs(*session.order.keys())&(db.product.promotion_price>0)).select(db.product.id,db.product.promotion_price)) On Sunday, 28 April 2013 14:01:21 UTC-5, 黄祥 wr

[web2py] Re: Multiple databases

2013-04-28 Thread LJ
@Niphlod, yes, that is what i was trying but had some difficulty initially. finally figured it out now :) thanks On Monday, April 29, 2013 12:17:02 AM UTC+5:30, Niphlod wrote: > > you then need a common place to store the company code associated for > every user (e.g. "a_variable"): instead of u

[web2py] Re: Pack all in GAE

2013-04-28 Thread Antonio Jesús Alba Boza
Thank you so much for your reply, Massimo. I will, greetings. El domingo, 28 de abril de 2013 16:38:35 UTC+2, Massimo Di Pierro escribió: > > There is no way to get data out using web2py only because of the datastore > limitations. > You have to use this to get the data out: > https://developers

[web2py] Re: ORM (?) : A Revisit, NOT a Rebuttal

2013-04-28 Thread Niphlod
On Sunday, April 28, 2013 8:41:46 PM UTC+2, Arnon Marcus wrote: > > > And where did you see a lack in functionality using DAL callbacks ? >> >> > > I am not that familiar with them, honestly. > As I said - It may seem as though I am saying that web2py currently > can-not accomplish this - what

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread 黄祥
thank you so much for your detail explanation, massimo grand_total=sum(item.promotion_price*session.order[item.id] for item in *db(db.product.id.belongs(*session.order.keys())&(db.product.promotion_price>0)).select()) > > (one single query) > > -- --- You received this message because you are

[web2py] Re: Multiple databases

2013-04-28 Thread Niphlod
you then need a common place to store the company code associated for every user (e.g. "a_variable"): instead of using map.get(request.args(0)) you'd then need to do map.get("a_variable"). The key point of the implementation at that point (if you don't want to have the auth_* tables in a common

Re: [web2py] Re: Not working for versions >2.2.1

2013-04-28 Thread Anthony
Actually, it only appeared to be working prior to 2.2.1. What happened with prior versions is that you inadvertently turned off your CSRF protection. In earlier versions, session.clear() would completely clear the session, so you ended up passing an empty session to form.accepts(). Because the

[web2py] Re: ORM (?) : A Revisit, NOT a Rebuttal

2013-04-28 Thread Arnon Marcus
> And where did you see a lack in functionality using DAL callbacks ? > > I am not that familiar with them, honestly. As I said - It may seem as though I am saying that web2py currently can-not accomplish this - what htis actually means, is that "I don't know of ways in which web2py can acco

[web2py] Re: Gluon outside web2py

2013-04-28 Thread Niphlod
as introduced by Massimo I'd go for managing it through callbacks. web2py.com/books/default/chapter/29/06#before-and-after-callbacks On Sunday, April 28, 2013 8:25:24 PM UTC+2, Simon Carr wrote: > > Massimo, > > A User creates a task and wants to assign multiple other users to the task > in orde

[web2py] Re: newby authorization question - need example

2013-04-28 Thread Anthony
Yeah, might not be a bad idea to show an explicit example like this in a slice. The book only includes a note about making editable, deletable, and details callables instead of booleans. Anthony On Sunday, April 28, 2013 2:28:18 PM UTC-4, Alex Glaros wrote: > > Thanks so much Anthony, it works

[web2py] Re: newby authorization question - need example

2013-04-28 Thread Alex Glaros
Thanks so much Anthony, it works great! Is this valuable enough for me to post to Slices? (I would also display the tables so that students can recreate the whole process). def search_shared_services(): is_owner = (lambda row: row.created_by == auth.user_id) if auth.user else False

[web2py] Re: Schedule task with variable as argument

2013-04-28 Thread D.
You're right - since it was a constant anyway I could just place the variable inside the task itself :-) Thank you for your help! Am Sonntag, 28. April 2013 20:11:39 UTC+2 schrieb Niphlod: > > If you're using the appadmin form you need to know what's the value of it, > so you can pass it explic

[web2py] Re: Multiple databases

2013-04-28 Thread LJ
Thanks for the reply Massimo. But this will require different URLs for each company right? I want a common URL where they get a login screen and they enter Username, Password, Company code. The rest of the interactions will depend on the company code. On Saturday, April 27, 2013 10:23:52 AM U

[web2py] Re: Gluon outside web2py

2013-04-28 Thread Simon Carr
Massimo, A User creates a task and wants to assign multiple other users to the task in order to discharg it. The user will use a mult select list to choose users to assign to the task. She then clicks an "Assign Workers" button. The function for that button will read the selected user in the li

[web2py] Re: Schedule task with variable as argument

2013-04-28 Thread Niphlod
If you're using the appadmin form you need to know what's the value of it, so you can pass it explicitely, e.g. ["2"]. I'm assuming the setting is global (i.e. is fixed for your app) so why don't you just use it inside your task ? e.g. in models you have settings.case_root = 2 . def dosometh

[web2py] Re: newby authorization question - need example

2013-04-28 Thread Anthony
> def search_shared_services(): > if (request.args(-3) in ['edit', 'delete'] and db[request.args(-2 > )](request.args(-1)).created_by != auth.user_id): > grid = SQLFORM.smartgrid(db.SharedService, linked_tables=[ > 'SharedServicePartnerIntersection'], maxtextlength={ > 'Shar

[web2py] Re: Schedule task with variable as argument

2013-04-28 Thread D.
the value of settings.case_root -- --- 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://group

[web2py] Re: Schedule task with variable as argument

2013-04-28 Thread Niphlod
the problem is: what do you need to pass ? the value of settings.case_root or the string "settings.case_root" ? On Sunday, April 28, 2013 7:43:37 PM UTC+2, D. wrote: > > > > Am Sonntag, 28. April 2013 19:11:17 UTC+2 schrieb Niphlod: >> >> args and vars accept strings that are json representation

[web2py] Re: ORM (?) : A Revisit, NOT a Rebuttal

2013-04-28 Thread Niphlod
On Sunday, April 28, 2013 1:00:17 AM UTC+2, Arnon Marcus wrote: > > > even with an ORM your code wouldn't be as neat as you might think. > > > Well, SQLA has this cool feature called "relationships", which basically > lets you define bidirectional relationships between ORM classes. After > yo

[web2py] Re: Schedule task with variable as argument

2013-04-28 Thread D.
Am Sonntag, 28. April 2013 19:11:17 UTC+2 schrieb Niphlod: > > args and vars accept strings that are json representation of a list (args) > or a dictionary (vars). > You can pass whatever you need under the condition that is json-encoded. > If you're trying to pass a variable, then you must eval

Re: [web2py] Pypy 2.0 beta2 - is there anyone testing this with web2py?

2013-04-28 Thread Niphlod
current trunk passes all tests on pypy 1.9. https://travis-ci.org/web2py/web2py/jobs/6692704 On Sunday, April 28, 2013 5:17:07 AM UTC+2, Evan Phelps wrote: > > I also get the error but from a different line in dal.py. Could you send > me your patch so that I can see if I'm experiencing the same

[web2py] Re: Schedule task with variable as argument

2013-04-28 Thread Niphlod
args and vars accept strings that are json representation of a list (args) or a dictionary (vars). You can pass whatever you need under the condition that is json-encoded. If you're trying to pass a variable, then you must evaluate it before queueing the task, or your task must "extract" the vari

Re: [web2py] Re: Error Pages via AutoRoutes

2013-04-28 Thread Jonathan Lundell
On 28 Apr 2013, at 7:43 AM, Massimo Di Pierro wrote: > What's "autoroutes"? scripts/autoroutes.py > > On Sunday, 28 April 2013 09:07:22 UTC-5, Nikolay wrote: > Hi, > > We're currently using autoroutes in place of static routes. It seems we've > lost the ability to define a custom error pages

[web2py] Schedule task with variable as argument

2013-04-28 Thread D.
I'm trying to schedule a task using appadmin. This works fine as long as I'm not passing in any arguments or as long as the arguments are static: i.e. ["/srv"] --> works ok If I want to use a variable instead I get an error: i.e. [settings.case_root] --> form-error: invalid json What's to corr

[web2py] Re: Simple usage of session.myvariable not working properly on production

2013-04-28 Thread Lisandro
Thanks Massimo for your inmediate answer! I checked what you said, and there was browser-cookie problem in deed... I was using Chromium, and don't know why I didn't try with Firefox, I should've done that before asking here, my bad. Anyway, I deleted the cookie that Chromium was storing for my

[web2py] Re: Error Pages via AutoRoutes

2013-04-28 Thread Massimo Di Pierro
What's "autoroutes"? On Sunday, 28 April 2013 09:07:22 UTC-5, Nikolay wrote: > > Hi, > > We're currently using autoroutes in place of static routes. It seems we've > lost the ability to define a custom error pages using the code below. Does > anyone have a workaround? > > Thanks! > > routes_oner

[web2py] Re: Gluon outside web2py

2013-04-28 Thread Massimo Di Pierro
You probably want to use something like db.task._after_insert.append(lambda fields,id: ..) But I cannot say more without a better understanding of your workflow. Can you provide a more complete use-case? On Sunday, 28 April 2013 03:44:44 UTC-5, Simon Carr wrote: > > Hi All, > > It's been a w

[web2py] Re: Pack all in GAE

2013-04-28 Thread Massimo Di Pierro
There is no way to get data out using web2py only because of the datastore limitations. You have to use this to get the data out: https://developers.google.com/appengine/docs/python/tools/uploadingdata then use a script to put the data in your local db. On Sunday, 28 April 2013 03:07:55 UTC-5, An

[web2py] Re: conditional sum() row table in controller

2013-04-28 Thread Massimo Di Pierro
This works but would be very inefficient grand_total=sum(db.product(id).promotion_price*qty else: db.product(id).unit_price*qty for id, qty in session.order.items() if db.product(id).promotion_price) (one query per item) *Instead* grand_total=sum(item.promotion_price*session.order[item.id] fo

[web2py] Error Pages via AutoRoutes

2013-04-28 Thread Nikolay
Hi, We're currently using autoroutes in place of static routes. It seems we've lost the ability to define a custom error pages using the code below. Does anyone have a workaround? Thanks! routes_onerror = [ ('init/400', '/init/default/login'), ('init/*', '/init/static/fail.html'), ('*/40

[web2py] Pack all in GAE

2013-04-28 Thread Antonio Jesús Alba Boza
Hi all, I was trying to migrate a web2py application from a windows local server to a virtual ubuntu environment. Certainly, it worked perfectly without problems. Now, I like to migrate other application from Google App Engine to this ubuntu server, and I had hopes to use w2p pack also, but, log

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-04-28 Thread Jurgis Pralgauskis
by the way -- would it be possible to pack at least one ttf with web2py, and in normalize_text , when it notices unicode, automatically add (and set) default ttf font (if such is not set) to render ok ? On Sun, Apr 28, 2013 at 12:18 PM, Jurgis Pralgauskis < jurgis.pralgaus...@gmail.com> wrote:

Re: [web2py] pyfPDF templates and unicode element values?

2013-04-28 Thread Jurgis Pralgauskis
I used template.py invoice example, but in invoice.csv I tried to change all 'Arial' --> 'DejaVu' f.parse_csv(infile="_invoice.csv", delimiter=";", decimal_sep=",") f.pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True) f.pdf.add_font('DejaVu', 'B', 'DejaVuSans-Bold.ttf', uni=True) an

[web2py] Re: newby authorization question - need example

2013-04-28 Thread Alex Glaros
Anthony, could you please tweak this a bit? It works fine when no one is logged in as there are no edit/delete capabilities in the resulting rows. but when any user is logged on, every row in the table has edit/delete capability regardless of what user created the record. def search_shared_se

[web2py] Re: Help with testing new app

2013-04-28 Thread Simon Carr
I would suggest that when the slide show is downloaded it opens in a new tab. When I finished reading I was tempted to close the window to return to the app. I would also suggest a short description on each information request screen to help the user with what is being requested. on the continu

Re: [web2py] Solved -- Problems with special characters and pyfpdf

2013-04-28 Thread Jurgis Pralgauskis
SOLVED - the problem was that I needed to reload web2py -- for changed html.py to make effect ;) one more issue that after write_html(..) it "forgets" the previously set font (should be at least mentioned in docs.. :) https://code.google.com/p/pyfpdf/issues/detail?id=54#c2 On Sat, Apr 27, 20

[web2py] Re: Help with testing new app

2013-04-28 Thread Tim Michelsen
> Comments/suggestions? The whole introduction could be bit more clear: "Social Reporting Solution for Faculty, Students, and other University Employees with Integrated E-Portolio " What are the key functionality and pupose your are helping with?" -- --- You received this message because you

[web2py] Gluon outside web2py

2013-04-28 Thread Simon Carr
Hi All, It's been a while since I have posted on here, but have just started a new project with Python and PyQt4. Because of my positive experience with web2py in the past I wanted to make use of Gluon for the DAL in my app. So I have two table that I want a many to many relationship with. use

[web2py] Re: Pypy 2.0 beta2 - is there anyone testing this with web2py?

2013-04-28 Thread Arnon Marcus
http://stackoverflow.com/questions/8960747/stackless-in-pypy-and-pypy-greenlet-differences http://doc.pypy.org/en/latest/stackless.html -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emai