[web2py] Re: variable query

2015-01-27 Thread Anthony
If you are writing the SQL manually, you cannot have "db." in the table names, as that is Python code, not SQL. Anyway, this is probably not the best approach because IDs may not remain consecutive integers (e.g., if you delete a record). Instead, maybe it would be simpler to just select that l

[web2py] Re: variable query

2015-01-27 Thread Leonel Câmara
This one is simpler than it looks. Heres how you could get the even numbers from the last 11 rows in just one line: db((db.articulos.id % 2) == 0).select(orderby=~db.articulos.id, limitby=(0, 11)) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web

[web2py] Re: IMPORTANT - DO NOT POST ISSUE ON GOOGLE CODE

2015-01-27 Thread Matheus Cardoso
Really nice job. I particularly liked the issues division between the whole web2py and the dal. On Monday, January 26, 2015 at 12:08:15 PM UTC-3, Massimo Di Pierro wrote: > > We have a migration in process and we will be moving all the open issues > form googlecode to gihub (thanks Niphlod for h

[web2py] variable query

2015-01-27 Thread José Eloy
Hello! I need to build a variable query to select rows from a database. I need to get the last 11 records from my database, but only the even. This the code of the controller: # Muestra los últimos 11 artículos limite_articulos = 11 # Getting the max id of the table: maxID =

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Niphlod
it seems that you're rather "full" of issues and ideas but "empty" on the attempts side. -- 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 thi

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Richard Vézina
TDD may be easier with angularjs... I would say... Richard On Tue, Jan 27, 2015 at 5:05 PM, Richard Vézina wrote: > Yes, that is another issue... > > I am thinking more and more to learn Angularjs more then what I really > know or start using Ractive.js that seems have easier learning curve...

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Richard Vézina
Yes, that is another issue... I am thinking more and more to learn Angularjs more then what I really know or start using Ractive.js that seems have easier learning curve... web2py component is great, but I feel really limited in developping complex "form" like user interraction for complex data m

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Niphlod
testing html generation is one-now-more-than-ever-shrinking-part of testing an app. In this particular case, you won't have noticed a thing: the important bits were/are played by javascript interaction. On Tuesday, January 27, 2015 at 10:38:49 PM UTC+1, Richard wrote: > > I would test the fact

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Richard Vézina
I would test the fact that html generated work properly, I guess Selenium is the only way, but if I can interact with html object from python with someting like HTMLTestRunner ( http://tungwaiyip.info/software/HTMLTestRunner.html)... I never had time to think about test cases worth doing over gener

[web2py] Re: Groupby year on date field

2015-01-27 Thread Niphlod
the doc is rather incomplete. Either you want a set of distinct things, or you want to aggregate something over a group of distinct things. given that db.entries.date is a datetime field, the former is fetched with db(db.entries.id > 0).select(db.entries.date.year(), distinct=True) while the l

Re: [web2py] Re: IMPORTANT - DO NOT POST ISSUE ON GOOGLE CODE

2015-01-27 Thread Niphlod
it's a pretty big change already. Never say never but I don't see it in the near future because developers aren't that much and frankly the google-group is working really fine for our community. On Tuesday, January 27, 2015 at 5:36:19 PM UTC+1, Ramos wrote: > > Are you going to use github Gitter

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Derek
You are wrong. If you need to test your views, you would have to use some kind of testing tool like Selenium, of course. However, you should not be generating views within the controllers, they have separate functions. It makes no sense. Besides, what are you going to test, the generation of the

[web2py] Re: what's wrong with printing URL?

2015-01-27 Thread Leonel Câmara
Bootstrap also has that.rule you need to override it with: @media print { a:after { content: ""; } } -- 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) --- Y

[web2py] Re: what's wrong with printing URL?

2015-01-27 Thread Anthony
Did you force the CSS to be reloaded by the browser? If so, is it possible you have a similar CSS rule somewhere else? On Tuesday, January 27, 2015 at 3:13:24 PM UTC-5, Vladimir Makarov wrote: > > no way! > I excluded* a:after { content: " (" attr(href) ")"; **}* but nothing > happened. > > > On

[web2py] Re: what's wrong with printing URL?

2015-01-27 Thread Vladimir Makarov
no way! I excluded* a:after { content: " (" attr(href) ")"; **}* but nothing happened. On Tuesday, January 27, 2015 at 11:05:25 PM UTC+3, Anthony wrote: > > If you don't want the href printed, wouldn't you want to get rid of this > line: > > a:after { content: " (" attr(href) ")"; } > > Antho

[web2py] Re: About validators

2015-01-27 Thread Anthony
Make sure you check form.vars (after calling .process) rather than request.vars. Anthony On Tuesday, January 27, 2015 at 10:15:34 AM UTC-5, mweissen wrote: > > In the book I find:IS_LOWER > > This validator never returns an error. It just converts the value to lower > case. > > requires = IS_L

[web2py] Re: what's wrong with printing URL?

2015-01-27 Thread Anthony
If you don't want the href printed, wouldn't you want to get rid of this line: a:after { content: " (" attr(href) ")"; } Anthony On Tuesday, January 27, 2015 at 2:54:05 PM UTC-5, Vladimir Makarov wrote: > > Hey! > > So I have this piece of code in my view file: > *http://row.id>, > 'client':

[web2py] Re: request_reset_password not returning a form

2015-01-27 Thread Ian W. Scott
Thanks Cynthia. But I do have the right format in the keydata file. I'm also not sure that a problem in my email verification would produce my issue. It doesn't get as far as trying to send an email in my case, since no form is created. Cheers, Ian On Monday, January 26, 2015 at 6:04:28 PM UT

[web2py] what's wrong with printing URL?

2015-01-27 Thread Vladimir Makarov
Hey! So I have this piece of code in my view file: *{{=row.model}}* There is nothing special or magical but if I try to print the page ... ooopppss ...I see this result: *Some_model (/gemma/kkm/kkm? client=156&contract=596&kkm=107)* instead of *Some_model* Say how can I get rid of link paramet

[web2py] Re: Override update defaults?

2015-01-27 Thread Anthony
I think you can take two approaches. One option would be to conditionally set the update attribute depending on the request: Field('modified_on', 'datetime', update=request.now if request.function != 'admin_routine' else None, ...) The other approach is to pass in the current valu

Re: [web2py] Translate Controller names and Function names

2015-01-27 Thread Francisco Costa
On Tuesday, 27 January 2015 17:14:48 UTC, Carlos Costa wrote: > > Very interesting question. It must have some effect on SEO. > I have seen this post but it does not seem to solve exactly this > > https://groups.google.com/forum/#!searchin/web2py/translate$20url/web2py/3adXUSCGQQQ/TaKfRagHyvMJ >

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Richard Vézina
Also, consider tools like SQLFORM.grid(), it's generate everything... Richard On Tue, Jan 27, 2015 at 2:13 PM, Richard Vézina wrote: > Derek, > > I understand your point, but from the testing point of view, the only > option remaining for testing view is Selenium HQ which is slow, so if you > w

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Richard Vézina
Derek, I understand your point, but from the testing point of view, the only option remaining for testing view is Selenium HQ which is slow, so if you want to be able to test your controller that depend a lot of the view, what I can only see is to limit as much as possible the view to unpack web2p

Re: [web2py] Re: Question about web2py roadmap.

2015-01-27 Thread Richard Vézina
Joe, I don't understand the dichotomy of your question? I don't think web2py serve each others as much... Richard On Tue, Jan 27, 2015 at 12:17 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > I never thought about it in those terms. I think it serves web developers > by taking care

Re: [web2py] Is Web2py suitable for my project

2015-01-27 Thread Richard Vézina
I mean IPython notebook... On Tue, Jan 27, 2015 at 1:51 PM, Richard Vézina wrote: > Eric, > > Have you consider IPython? > > It is less appealing then the stack you are talking, but may be a fast > solution that can fill in some of you needs... > > Richard > > On Tue, Jan 27, 2015 at 10:57 AM, E

Re: [web2py] Is Web2py suitable for my project

2015-01-27 Thread Richard Vézina
Eric, Have you consider IPython? It is less appealing then the stack you are talking, but may be a fast solution that can fill in some of you needs... Richard On Tue, Jan 27, 2015 at 10:57 AM, Eric's Gmail wrote: > Richard, > > I think Bokeh and MPLD3 are quite specifically designed to provid

[web2py] Re: web2py 2.9.12 is OUT

2015-01-27 Thread Antonio Salazar
Since the upgrade, I'm getting this annoyance in the web editor. When I save a controller with a syntax error, the operation stalls at "saving now...". If I retry the save, I get the warning "file changed on disk" and have to merge it, losing the state of the editor. Is this a known bug? I'm u

Re: [web2py] Re: Dropdown lists

2015-01-27 Thread Omi Chiba
Thank you for your feedback! I found " onchange="jQuery('#model_name').empty();" this is unnecessary operation for my purpose so it's removed! On Tue, Jan 27, 2015 at 11:19 AM, Derek wrote: > What I mean by 'you are mixing your view with your controller' is that you > are using your controller

[web2py] pydal / postgres / jsonb

2015-01-27 Thread Kiran Subbaraman
Any plans for the the postgres adapter to support *jsonb* type, by default, and not the basic json type? The *jsonb* type seems to have a lot more capabilities going for it, than the basic json type: http://www.postgresql.org/docs/devel/static/datatype-json.html Indexing support, containment che

[web2py] Re: Dropdown lists

2015-01-27 Thread Derek
What I mean by 'you are mixing your view with your controller' is that you are using your controller to build HTML that will be used as-is. You should never create HTML in your controllers, leave that to the views. The whole point of MVC is that each part has a very specific purpose. Don't creat

[web2py] Re: Question about web2py roadmap.

2015-01-27 Thread Massimo Di Pierro
I never thought about it in those terms. I think it serves web developers by taking care of administrative issues for them. On Tuesday, 27 January 2015 11:14:06 UTC-6, JoeCodeswell wrote: > > Dear web2py-users, > > Here is my question about the roadmap goals for web2py development. > > Will the

[web2py] Re: Dropdown lists

2015-01-27 Thread Derek
Well, where do I start? It looks like you are a victim of copy and paste coding. Delete your two functions and start over again. That said, you are mixing your view with your controller, please don't do that. I would suggest you use this web2pyslice as a starting point. (yes, I wrote it) http:

Re: [web2py] Translate Controller names and Function names

2015-01-27 Thread Carlos Costa
Very interesting question. It must have some effect on SEO. I have seen this post but it does not seem to solve exactly this https://groups.google.com/forum/#!searchin/web2py/translate$20url/web2py/3adXUSCGQQQ/TaKfRagHyvMJ Although if you have a different URL for different content it will be index

[web2py] Re: Date format

2015-01-27 Thread Sh. Moiz M. Husain Bhai Nagpurwala
This worked for me: entry.Date.strftime("%A, %d %B %Y") On Tuesday, January 27, 2015 at 10:46:49 AM UTC+5:30, Sh. Moiz M. Husain Bhai Nagpurwala wrote: > > I want to Display date as *Tuesday, January 27, 2015* > > How to do that. > > Thanks. > -- Resources: - http://web2py.com - http://web2p

[web2py] Groupby year on date field

2015-01-27 Thread Sh. Moiz M. Husain Bhai Nagpurwala
I found this code in web2py documentation: for row in db().select( db.entries.ALL, orderby=~db.entirs.Date, groupby=db.entirs.Date): print row.name How to amend this code to select distinct years from a date field. Please help. -- Resources: - http://web2py.com - http

[web2py] Question about web2py roadmap.

2015-01-27 Thread JoeCodeswell
Dear web2py-users, Here is my question about the roadmap goals for web2py development. Will the goals for web2py development be oriented to serve Web Developers MORE THAN Website Administrators or vice versa? I personally think web2py should serve Web Developers MORE THAN Website Ad

Re: [web2py] Is Web2py suitable for my project

2015-01-27 Thread Eric's Gmail
Richard, I think Bokeh and MPLD3 are quite specifically designed to provide somewhat interactive scientific plots. Brython seems completely different. Eric - Eric > On Jan 27, 2015, at 9:52 AM, Richard Vézina > wrote: > > I will probably try, but not soon... > > I am really currious to k

[web2py] Re: Date format

2015-01-27 Thread Derek
db.mytable.datetime_field.represent = lambda value, row: value.strftime("format-here") (thanks Rocha http://stackoverflow.com/questions/12605934/formating-date-in-web2py-python) see here for the directives to use in 'format-here'... https://docs.python.org/2/library/datetime.html#strftime-s

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Derek
Honestly, I have never seen a need for this. Any time I visit a foreign language site, the URL mapping is in english. Chinese, Japanese, Russian, all seem to keep the URL pretty much the same regardless of the language. I can usually hunt my way around a foreign language website by the links.For

Re: [web2py] Re: IMPORTANT - DO NOT POST ISSUE ON GOOGLE CODE

2015-01-27 Thread António Ramos
Are you going to use github Gitter ? Thank you 2015-01-27 8:39 GMT+00:00 Massimiliano : > Remember to change the readme that reports ;-) : > > Issues? > > Report issues at http://code.google.com/p/web2py/issues/ > > On Tue, Jan 27, 2015 at 12:00 AM, Niphlod wrote: > >> migration completed. >>

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Leonel Câmara
This is a good question, maybe there should be more direct web2py support for it, as usability wise it's a nice feature. A wrapper is just a function that calls the other for you, like a decorator. In your case you could have something like this in your models. def TURL(**kwargs): if 'c' in

Re: [web2py] Is Web2py suitable for my project

2015-01-27 Thread Richard Vézina
I will probably try, but not soon... I am really currious to know how it works and can provide that kind of feature, maybe it is similar to Brython (http://www.brython.info/)... Richard On Mon, Jan 26, 2015 at 10:58 AM, Eric wrote: > Richard, > > If you try Bokeh and/or mpld3 please tell me ho

[web2py] Re: Record format and SQLFORM.factory

2015-01-27 Thread tim . nyborg
form = SQLFORM.factory( Field('Presupuesto', requires=IS_IN_DB(db, db.presupuesto, *db.presupuesto._format*)), submit_button='Continuar', table_name='presupuesto', ) On Monday, 26 January 2015 16:09:31 UTC, César Bustíos Benites wrote: > > Hello! I have a table called

Re: [web2py] Re: represents currency format

2015-01-27 Thread Niphlod
whoopsie, since you passed a lambda that takes *value, row* you should have passed *list.UnitPrice, list* On Tuesday, January 27, 2015 at 3:44:07 PM UTC+1, Omi Chiba wrote: > > I got this error... > (() takes exactly 2 arguments (1 > given)) > > Render also looks complicated to me so I will just

[web2py] Re: About validators

2015-01-27 Thread tim . nyborg
'but I get "abcDEF"' How did you get that? form=FORM(INPUT(_type="text", _name="n", requires=IS_LOWER())) if form.process().accepted: response.flash = form.vars.n The above spits out 'uppercase' when I entered 'UPPERCASE' On Tuesday, 27 January 2015 15:15:34 UTC, mweissen

[web2py] About validators

2015-01-27 Thread Martin Weissenboeck
In the book I find:IS_LOWER This validator never returns an error. It just converts the value to lower case. requires = IS_LOWER() Now I try a piece of code: form=FORM(INPUT(_type="text", _name="n", requires=IS_LOWER())) On input "abcDEF" I expected n=="abcdef", but I get "abcDEF" (not convert

[web2py] Override update defaults?

2015-01-27 Thread tim . nyborg
I'm really liking the ability to automatically timestamp when records are updated, but I'm wondering if there's a simple way of suppressing this behaviour when needed: I have these signature fields appended to a number of tables, automatically recording when users update records: signature_fiel

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Francisco Costa
Tx Jonathan, how would a wrapper for the URL() look like? -- 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 subscr

Re: [web2py] Re: represents currency format

2015-01-27 Thread Omi Chiba
I got this error... (() takes exactly 2 arguments (1 given)) Render also looks complicated to me so I will just use the JS Massimo suugested. Thank you both!! On Monday, January 26, 2015 at 6:01:08 PM UTC-6, Niphlod wrote: > > in the view, you have > > {{=list.UnitPrice}} > > use instead > >

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Jonathan Lundell
I think that Niphlod is probably right, though I might be inclined to stick with your programmatic logic rather than use pattern-based routing. And maybe write a wrapper for URL() so that all the logic is in the same place and driven off the same tables. On Tuesday, January 27, 2015 at 4:12:42

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Francisco Costa
unfortunately it seams you can't use both rewrite systems, and I have other apps using the Parameter-based system On Tuesday, 27 January 2015 14:05:26 UTC, Niphlod wrote: > > IMHO you're better suited for routes > . As > long a

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Niphlod
IMHO you're better suited for routes . As long at the mapping is fixed, it's exactly what they've been engineered for. I'd use the pattern-based system On Tuesday, January 27, 2015 at 2:51:31 PM UTC+1, Francisco Costa wrote: >

[web2py] Re: Translate Controller names and Function names

2015-01-27 Thread Francisco Costa
I have this in models till now: views_translate = { # Controllers Names 'default' : 'principal', 'principal' : 'default', 'articles' : 'artigo', 'artigo': 'articles', # Function Names 'index' : 'inicio', 'inicio': 'index', 'new' : 'novo',

[web2py] Translate Controller names and Function names

2015-01-27 Thread Francisco Costa
I'm using the Parameter-based rewrite system and I would like to find a strategy to **translate controller names and function names**. I have 2 domains and I use only one app for both, but I would like to have the

[web2py] Re: Date format

2015-01-27 Thread Leonel Câmara
Hey Sh. Moiz Python dates have a strftime method, you can just use that. See: https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.goog

Re: [web2py] Re: Checksum for download of web2py?

2015-01-27 Thread Michele Comitini
If possible I'd suggest to also use PGP signatures 2015-01-26 18:07 GMT+01:00 Benjamin : > Thank you very much for your answer, Mr Di Pierro. > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.goo

[web2py] Re: Google Cloud Storage libraries interaction web2py appengine

2015-01-27 Thread Jacinto Parga
Finally solved. The solution: https://groups.google.com/forum/#!topic/google-appengine-stackoverflow/JZX2Yh67ylI I had to include: apiclient, gflags, httplib2, oauth2client, uritemplate in *site-packages* folder Thanks El jueves, 22 de enero de 2015, 23:59:11 (UTC+1), Massimo Di Pierro escr

Re: [web2py] Re: IMPORTANT - DO NOT POST ISSUE ON GOOGLE CODE

2015-01-27 Thread Massimiliano
Remember to change the readme that reports ;-) : Issues? Report issues at http://code.google.com/p/web2py/issues/ On Tue, Jan 27, 2015 at 12:00 AM, Niphlod wrote: > migration completed. > > You can find in the original googlecode issue a last message by me linking > to the newly migrated issue

[web2py] SQLFORM.grid check if record in db

2015-01-27 Thread Yebach
Hello I have a SQLFORM.grid page Values for one filed (code) in add or edit view is filed with js code from values of two other fields. User can deactivate this "record" - it can not be deleted only status is set to e.g. 100 If user creates a new record that creates the same values for code f