[web2py] Web2py - Babel

2015-11-03 Thread Mirek Zvolský
Uses somebody Web2py with Flask-Babel or with Babel ? I think there is problem with Web2py translation system that the support for plural is poor because there are languages with 2 forms of plural. But maybe I misunderstand the translation system of Web2py ? -- Resources: - http://web2py.com -

[web2py] bootstrap3 formstyle checkboxes

2015-11-03 Thread Gary Cowell
Web2py version: >>> import gluon.widget >>> print gluon.widget.ProgramVersion Version 2.12.3-stable+timestamp.2015.08.19.00.18.03 When using bootstrap3_inline for forms, the checkbox lables are not correctly styled: This is my form code: form=SQLFORM.factory( Field('SystemName',

[web2py] Re: Web2py - Babel

2015-11-03 Thread 黄祥
pardon me, not sure, i follow what is your problem. in web2py scaffold welcome app, there is files in folder languages start with plural-*.py, i think you can add it in that file for example plural-en.py, and add the new words, that's not in that file. best regards, stifan On Tuesday, November

[web2py] Re: Has somebody used codenvy for web2py application deployment?

2015-11-03 Thread Gary Cowell
No, but could you not use pythonanywhere free app, and host mercurial (or, git, if you must) on bitbucket? Small projects on bitbucket can have up to five users. On Monday, 2 November 2015 16:55:02 UTC, at wrote: > > Hi, > > I was looking for a place where I can deploy a database driven web2py

Re: [web2py] Web2py - Babel

2015-11-03 Thread Vinicius Assef
This can help you: http://web2py.com/books/default/chapter/29/04/the-core#Pluralization-engine -- Vinicius Assef On 3 November 2015 at 07:42, Mirek Zvolský wrote: > Uses somebody Web2py with Flask-Babel or with Babel ? > I think there is problem with Web2py translation system that the support

[web2py] Re: Should this work in Web2py

2015-11-03 Thread Anthony Smith
Ok thanks for the help, much appreciated by newbie trying to learn On Tuesday, 3 November 2015 02:09:28 UTC+11, Niphlod wrote: > > it works but it's a rather inefficient way. first() and last() will need > to fetch every record of that table > > you'd better rewrite > > task = db(d

Re: [web2py] How to get my pdf-file to display from webserver

2015-11-03 Thread Massimiliano
Try this way to display your pdf: def yourcontroller() # generate pdf . . . import cStringIO data = open(filename,"rb").read() response.headers['Content-Type']='application/pdf' return response.stream(cStringIO.StringIO(data)) On Mon, Nov 2, 2015 at 4:29 PM, Karl Floria

[web2py] switching tabs in built in editor...

2015-11-03 Thread Edward Shave
Just wondering if there is a keyboard short-cut for switching tabs in built in editor? -- 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

[web2py] Re: Submissão Python Brasil 11

2015-11-03 Thread Matheus Cardoso
5K? Eu achei que tinha isso no mundo. :P Eu sempre achei que, no Brasil, o web2py é um framework de nicho. E esse nicho somos...Nós. :) O que eu vejo é a predominância da dicotomia Flask vs Django (um flameware em cada esquina), com o bottle e o pyramid aparecendo uma vez ou outra - e nada do w

[web2py] Way to query from a select object

2015-11-03 Thread Mark Billion
This seems ugly: foo = db(db.xxx.id==x.id).select() for a in foo: if a.primary_residence == True: nine_b_count = 1 .. Is there a way for me to select only the elements of foo that meet the secondary test. Something like foo.select(a.primary_residence == Tru

[web2py] Re: [web2py-users-brazil:8162] Re: Submissão Python Brasil 11

2015-11-03 Thread Ari Sobel
Interessante teu comentário @matheus Poderia explicar melhor: - o que vc chama de "framework de nicho" - e contextualizar para o 'universo web2py'; - o que quer dizer 'mas estão "incubando" o web2py nos seus projetos privados'; Eu, por exemplo, sou um desenvolvedor amador (aprendiz, p

Re: [web2py] Way to query from a select object

2015-11-03 Thread Massimiliano
What about? foo = db((db.xxx.id==x.id) & (db.xxx.primary_residence == True)).select() On Tue, Nov 3, 2015 at 2:53 PM, Mark Billion wrote: > This seems ugly: > foo = db(db.xxx.id==x.id).select() > for a in foo: > if a.primary_residence == True: > nine_b_count

Re: [web2py] Way to query from a select object

2015-11-03 Thread Massimiliano
You could also do something like: query = (db.xxx.id==x.id) mainset = db(query) subquery = (db.xxx. primary_residence == True) subset = mainset(subquery) rows = subset.select() take a look here

Re: [web2py] How to get my pdf-file to display from webserver

2015-11-03 Thread Karl Florian
Hi Massimiliano, it works thank you! However there are 2 things i do not like: 1) My PDF File is renamed to the same as my Controller function Name plus a number and *without the Extension .pdf*. Example:* printlanguages+cd123452* 2) After the *"return response.stream()"* my *submit button* t

Re: [web2py] bootstrap3 formstyle checkboxes

2015-11-03 Thread Richard Vézina
What is the expected behavior? On Tue, Nov 3, 2015 at 4:50 AM, Gary Cowell wrote: > Web2py version: > >>> import gluon.widget > >>> print gluon.widget.ProgramVersion > Version 2.12.3-stable+timestamp.2015.08.19.00.18.03 > > > When using bootstrap3_inline for forms, the checkbox lables are not >

[web2py] Re: test for integer in form

2015-11-03 Thread Alex Glaros
(1) is there way to have it as a requires clause only for the controllers that user's use? E.g.: db.auth_group.role.requires = not IS_INT_IN_RANGE(-sys.maxint -1, sys.maxint ) above doesn't raise errors but doesn't work (2) the sys syntax causes this error: global name 'sys' is not defined

[web2py] Re: Way to query from a select object

2015-11-03 Thread Anthony
Assuming there is some reason you can't move the additional query conditions to the database and you must do the filtering in Python (e.g., the query is complex or you need to filter the same set of rows in multiple ways), you can use the .find() method

[web2py] Re: Way to query from a select object

2015-11-03 Thread Mark Billion
Yep. Am using the same data over and over and over On Tuesday, November 3, 2015 at 11:51:53 AM UTC-5, Anthony wrote: > > Assuming there is some reason you can't move the additional query > conditions to the database and you must do the filtering in Python (e.g., > the query is complex or yo

[web2py] Re: test for integer in form

2015-11-03 Thread Dave S
On Tuesday, November 3, 2015 at 8:46:57 AM UTC-8, Alex Glaros wrote: > > (1) is there way to write it as a requires clause only for the > controllers that user's use? E.g.: > > db.auth_group.role.requires = not IS_INT_IN_RANGE(-sys.maxint -1, sys. > maxint) > > doesn't raise errors but doesn't

[web2py] is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Alex Glaros
I'd lilke to reuse a primary key that has been deleted For example, I'd like to take deleted auth_user.id == 1, and change the first_name and other field data in it for reuse. Same for other tables, for example, db.Organization.id ==1, would like to replace old org name with "Department of Moto

[web2py] Manage session.VARS best practices

2015-11-03 Thread Richard
Hello, Let say I put some data in session.var1 for reuse in case user want to download the content of the page with the help of buttons for the purpose which call the same function with one more prameter telling the controller function which file format the user expect... So you can check if f

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Anthony
I'm not sure there is any need to clean up individual sessions unless you are storing a large amount of data. On the other hand, you might want to clean up expired session files once in a while -- there is a script for that. Anthony On Tuesday, November 3, 2015 at 1:43:47 PM UTC-5, Richard wro

[web2py] Re: is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Jim S
If I understand your question properly, I think Record Versioning could do it. http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-versioning If you 'deleted' auth_user.id == 1, all that happens then is that the is_active field gets set to False. You could then

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Richard Vézina
There is large amount of that data that why I have this concern... Is cleaning the sessions/* files delete data put in session? Richard On Tue, Nov 3, 2015 at 1:59 PM, Anthony wrote: > I'm not sure there is any need to clean up individual sessions unless you > are storing a large amount of dat

Re: [web2py] Re: is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Richard Vézina
I think Alex concern is about if he can reuse ID 1 which seems he deleted and now would reuse it for storing other information... If I am correct, this is possible as long as the ID 1 is effectively empty and if there is no history attach the record (though, this is not so a problem neither depend

[web2py] Re: test for integer in form

2015-11-03 Thread Alex Glaros
import worked to elimitate error but requires logic doesn't take db.auth_group.role.requires not(IS_INT_IN_RANGE(-sys.maxint -1, sys.maxint)) not sure how to structure the syntax in the try: statement. x=role(IS_INT_IN_RANGE(-sys.maxint -1, sys.maxint) ? how about a requires clause that is so

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Anthony
On Tuesday, November 3, 2015 at 2:04:21 PM UTC-5, Richard wrote: > > There is large amount of that data that why I have this concern... > You might want to do some testing (i.e., checking response times and RAM usage) before bothering to manage session keys. Note, the session data for a given us

Re: [web2py] Re: is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Richard Vézina
Also, let say you have delete a bunch of record and you want to keep a sequential ID incrementation for some reason, nothing prevent you to update your backend sequence start parameter and rewind to the last ID surrogate number so next time you insert a record you will have consecutive ID... Doc f

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Richard Vézina
Thank you Anthony, I appreciate you input... I was concern about exactly that, I mean keep clean up the session each request has a cost... I will need to make a check, it would be logic that if the session keys to be are not present in session that the only overhead should be the clean up funciton

Re: [web2py] Re: is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Anthony
> > db(db.auth_user.id == 1).insert(...) > The .insert() method applies to tables, not Set objects. It would be: db.auth_user.insert(id=1, ...) Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.goo

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Anthony
Yes, simply making the check for the session keys to see if cleanup is needed should add minimal overhead. Likewise, if the deleting itself is infrequent (or if it tends to occur when you have other session changes that need to be written to the file anyway), then there shouldn't be much additi

[web2py] Re: virtual fields and lambda functions

2015-11-03 Thread Pierre
thanks Anthony Le lundi 2 novembre 2015 19:35:27 UTC+1, Anthony a écrit : > > It's row.tablename.fieldname, and yes, in virtual field functions, you > must use both the tablename and fieldname (same as when a Row comes from a > join of multiple tables). > > Anthony > > On Monday, November 2, 20

Re: [web2py] Re: is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Alex Glaros
it worked! wow... thanks guys! 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 Issues) --- You received this message because you are subscribed to the Google G

Re: [web2py] How to get my pdf-file to display from webserver

2015-11-03 Thread Karl Florian
I think i found my own solution. Wo ever has the same Problem, try this!!! import webbrowser webbrowser.open_new(r'file://C:\path\to\file.pdf') It works just the way i Need it. Am Dienstag, 3. November 2015 16:38:06 UTC+1 schrieb Karl Florian: > > Hi Massimiliano, > it works th

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Richard Vézina
The data are not the same or I can make this assomption since they can change each time the controller function it calls... The controller take parameters into vars and make db query and render a resulting table... There is numerous differents parameters and the requested data are by nature changin

Re: [web2py] Re: is there any way to resurrect a past deleted primary key?

2015-11-03 Thread Richard Vézina
Oups! On Tue, Nov 3, 2015 at 3:15 PM, Alex Glaros wrote: > it worked! wow... thanks guys! > > 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 Issu

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Anthony
> > Am I right in my understanding that session.keys get write into session > file only once when it get define for a given request and in the next > request if the session.key1 is still there (unchanged) it won't be re-write > to session file? > Writes to the session file are not granular --

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Richard Vézina
Thank you for clarification I really appreciate... Also about previous posted kind of pseudo code above this work better in case var1 is not yet defined : elif 'var1' in session: del(session.var1) On Tue, Nov 3, 2015 at 4:41 PM, Anthony wrote: > Am I right in my understanding that sess

[web2py] Re: test for integer in form

2015-11-03 Thread Alex Glaros
This is wrong: how about a requires clause that is some kind of lambda that requires any non-numeric? Is that possible?how about a requires clause that is some kind of lambda that requires any non-numeric? Is that possible? db. auth_group.role.requires=role contains ('a', 'b', 'c', etc) becau

Re: [web2py] Manage session.VARS best practices

2015-11-03 Thread Anthony
On Tuesday, November 3, 2015 at 5:12:32 PM UTC-5, Richard wrote: > > Thank you for clarification I really appreciate... > > Also about previous posted kind of pseudo code above this work better in > case var1 is not yet defined : > > elif 'var1' in session: > del(session.var1) > Sure, or

Re: [web2py] How to get my pdf-file to display from webserver

2015-11-03 Thread Dave S
On Tuesday, November 3, 2015 at 1:26:26 PM UTC-8, Karl Florian wrote: > > I think i found my own solution. > Wo ever has the same Problem, try this!!! > > import webbrowser > webbrowser.open_new(r'file://C:\path\to\file.pdf') > > > It works just the way i Need it. > > I'm glad it wo

Re: [web2py] How to get my pdf-file to display from webserver

2015-11-03 Thread Karl Florian
No it didn't work on the web. local Linux and Windows worked fine. *I am using str(os.path.join(request.folder, 'tex', 'languages.tex')) to set the path to my files.* I am using Massimiliano's code to start my pdf's. But i still have the 2 Problems i mentioned before. Am Dienstag, 3. November 2

Re: [web2py] How to get my pdf-file to display from webserver

2015-11-03 Thread Dave S
On Tuesday, November 3, 2015 at 3:30:59 PM UTC-8, Karl Florian wrote: > > No it didn't work on the web. > local Linux and Windows worked fine. > *I am using str(os.path.join(request.folder, 'tex', 'languages.tex')) to > set the path to my files.* > > I am using Massimiliano's code to start my pd

[web2py] Re: list:reference does not apply notnull=True

2015-11-03 Thread 黄祥
just confirmation : is this right (the example : multiple = (1, x) ) ? e.g. when try to use x in above example it return an error NameError: global name 'x' is not defined db.define_table('test0', Field('test1', 'list:reference test1'), format = '%(test1)s') db.test0.test1.requires = IS_IN_DB(db

[web2py] Re: list:reference does not apply notnull=True

2015-11-03 Thread Anthony
multiple = (1, db.test1.id) The second value of the tuple should be an integer representing the maximum number of allowed values. It cannot be a Field object, and I'm not sure what you are trying to achieve with that. Anthony On Tuesday, November 3, 2015 at 7:59:07 PM UTC-5, 黄祥 wrote: > > just

[web2py] Re: list:reference does not apply notnull=True

2015-11-03 Thread 黄祥
thank you so much for detail explanation, Anthony. what i want to achieve is maximum number of allowed values same like total counted record that store in reference table e.g. count_test1 = db(db.test1.id > 0).count() db.define_table('test0', Field('test1', 'list:reference test1'), format = '%(t

Re: [web2py] bootstrap3 formstyle checkboxes

2015-11-03 Thread Gary Cowell
That the labels for boolean fields are consistent in appearance with the labels for other classes of field. So, emboldened and on the left. On Tuesday, 3 November 2015 16:28:15 UTC, Richard wrote: > > What is the expected behavior? > > On Tue, Nov 3, 2015 at 4:50 AM, Gary Cowell > wrote: > >>