[web2py] Re: How to get plain strings from simplejson.loads?

2014-02-10 Thread Horst Horst
Do you understand what the u means? (i.e. it means you have a unicode string) Sure. I've just tried to ask the question in the simplest way. But never mind, I've found an answer here:

[web2py] Re: How to get plain strings from simplejson.loads?

2014-02-10 Thread Tim Richardson
On Monday, 10 February 2014 19:51:37 UTC+11, Horst Horst wrote: Do you understand what the u means? (i.e. it means you have a unicode string) Sure. I've just tried to ask the question in the simplest way. But never mind, I've found an answer here: :) I'm curious; why is Unicode a

[web2py] Re: Strange artifact

2014-02-10 Thread Tim Richardson
Il giorno venerdì 7 febbraio 2014 05:16:10 UTC+1, horridohobbyist ha scritto: Really? Nobody knows? Nobody cares? I care, in proportion to the number of my visitors who use IE * the magnitude of the problem. This means I don't care very much. It seems that mobile is a much more

[web2py] recovering from crash

2014-02-10 Thread rif
Hi guys, If I lost the content of datatbases directory can I restore a web2py application having only the pg_dump of the application datatbase? -rif -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: recovering from crash

2014-02-10 Thread LightDot
Sure, shouldn't be complicated either, assuming your database definitions and the actual database structure is the same. Restore your database and it's contents, restore the web2py code and then all that is left is to rebuild the web2py's database metadata. Take a look at fake migrations in

[web2py] db sorting columns by international collations

2014-02-10 Thread Robin Manoli
Hey, I want to be able to sort some users according to different international standards. In mysql I can do this using the collate keyword: SELECT X FROM T ORDER BY X COLLATE *collation_name*; (examples: https://dev.mysql.com/doc/refman/5.0/en/charset-collation-effect.html) Is it possible to

[web2py] Re: How to get plain strings from simplejson.loads?

2014-02-10 Thread Horst Horst
I have a data structure with hundreds of plain strings nested in various lists and dicts. loads turns every single one into unicode, which is probably correct from its POV. But some of my strings hold encoded data which goes into my backend code, where some functions expect data encoded into

[web2py] Re: recovering from crash

2014-02-10 Thread rif
Thanks a lot LightDot, That was exaclty what I needed :) -rif luni, 10 februarie 2014, 12:56:38 UTC+2, LightDot a scris: Sure, shouldn't be complicated either, assuming your database definitions and the actual database structure is the same. Restore your database and it's contents,

[web2py] datetime column with milliseconds precision

2014-02-10 Thread Alex
Is it possible to update a datetime column with milliseconds precision? e.g. I have a field Field('invoice_date', 'datetime') and I'm updating the field: now = datetime.datetime.now() db(db.invoice.id == 743).update(invoice_date=now) the currren time contains milliseconds: 11:58:35.696000 In

[web2py] Best practice for a development environment together with a live environment

2014-02-10 Thread Robin Manoli
Hey, I'm working on developing projects that will have live releases. In other words, I want to be able to develop my app calmly on a dev version, and once I'm done with that I want to synchronize it with the live version which is open to the public. I'm using two separate mysql databases for

[web2py] Minimum Response Time Tuning

2014-02-10 Thread Mark Graves
Hey Everyone, I'm deploying a web-service app which will require sub second response times. The code is entirely written in python and the algorithm to compute the output takes approximately .3 seconds. Will web2py's overhead be too much to deliver the response time I need? Should I

[web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread thiago_pnobre
Anyone? -- 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 Groups web2py-users group. To

[web2py] Multiple SOLIDFORMs from table rows

2014-02-10 Thread Mike Constabel
Hi, I try to generate multiple SOLIDFORMS from table rows. Simple example in pseudo code: x = db(y.z).select() for d in x: form=CAT(form, SOLIDFORM(d)) return dict(form=form) This works for me: Model: #simplified, the tables are much longer in real db.define_table(foo_analysis_type,

[web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread Anthony
You'll have to show some code. By default, web2py does not redirect anywhere when login fails -- it just reloads the login page. Anthony On Sunday, February 9, 2014 1:51:04 PM UTC-5, thiago...@comp.ufla.br wrote: The problem is that I have a page for the login form, that only can redirect

[web2py] Re: Minimum Response Time Tuning

2014-02-10 Thread Massimo Di Pierro
Hello Mark, you say the code takes 0.3 seconds. Is this the algorithm or the overhead that you are trying to eliminate. If that is the algorithm, rewriting in a different framework will not help you. If that is the overhead, that is definitively too much. Probably you are executing something

[web2py] web2py, virtual domains and routes.py

2014-02-10 Thread Mauro Allegrini
Hi all I'm trying to use virtual domains and a single web2py instance with multiple apps, My host is pythonanywhere.com. They have been kind but unable to help me on this and suggested me to ask here. I've created PA domains, I've set up CNAME in my DNS and copied wsgi file to make them all

Re: [web2py] Re: Minimum Response Time Tuning

2014-02-10 Thread Mark Graves
Thanks Massimo, This is the algorithm. If the web2py overhead is 5-10ms, I can probably will stick with it. Thanks for the suggestions! Mark On Mon, Feb 10, 2014 at 8:44 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Hello Mark, you say the code takes 0.3 seconds. Is this the

Re: [web2py] Best practice for a development environment together with a live environment

2014-02-10 Thread Vinicius Assef
Probably you're talking about continuous delivery, right? But you'll always need a deploy process, to face database versioning and external libraries install or web/rdbms server restarts. Synchronizing on the fly is a risky process and I wouldn't recommend you doing so. On Mon, Feb 10, 2014 at

Re: [web2py] Multiple SOLIDFORMs from table rows

2014-02-10 Thread Vinicius Assef
Maybe I missed something, but what is a SOLIDFORM? On Mon, Feb 10, 2014 at 6:12 AM, Mike Constabel lis...@constabel.net wrote: Hi, I try to generate multiple SOLIDFORMS from table rows. Simple example in pseudo code: x = db(y.z).select() for d in x: form=CAT(form, SOLIDFORM(d)) return

Re: [web2py] web2py, virtual domains and routes.py

2014-02-10 Thread Jonathan Lundell
On 10 Feb 2014, at 6:51 AM, Mauro Allegrini mauro.allegr...@gmail.com wrote: Hi all I'm trying to use virtual domains and a single web2py instance with multiple apps, My host is pythonanywhere.com. They have been kind but unable to help me on this and suggested me to ask here. I've

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread Cliff Kachinske
I have used rsync to update models, controllers, views, modules and so on. For database updates I create a separate script and test, test, test it. I don't use the DAL. Sometimes I write SQL, sometimes python using the database driver. Going forward it will probably just be SQL. On a

[web2py] Re: Multiple SOLIDFORMs from table rows

2014-02-10 Thread Cliff Kachinske
Have you tried it without the showid arg? On Monday, February 10, 2014 3:12:36 AM UTC-5, Mike Constabel wrote: Hi, I try to generate multiple SOLIDFORMS from table rows. Simple example in pseudo code: x = db(y.z).select() for d in x: form=CAT(form, SOLIDFORM(d)) return

[web2py] Reaching pages by a descriptive pagename

2014-02-10 Thread BlueShadow
Hi I would love if I could reach my Articles not only by this type of URL: www.mydomain.com/Article?id=112 but also by this type of URL: www.mydomain.com/Article:Title-of-the-Article (or something similar I just want to have the Title of that Article in the URL). Is there an easy way to do

[web2py] Re: Reaching pages by a descriptive pagename

2014-02-10 Thread LightDot
What you're looking for is called a slug. Web2py makes it really easy, since it already has a validator that can create a slug: http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=is_slug Last time I implemented this was for a concert site, creating a slug from the concert

[web2py] Re: Reaching pages by a descriptive pagename

2014-02-10 Thread Anthony
How about something like /Article/Title-of-the-Article? In that case, just look in request.args(0) for the article slug and use that to query the db. If it's possible for multiple articles to have the same title (or at least the same slug), then you could include the ID as an arg as well:

[web2py] Re: web2py and prepared statements

2014-02-10 Thread Niphlod
correct, it doesn't. On Monday, February 10, 2014 3:59:22 AM UTC+1, Jayadevan M wrote: Web2py/psycopg2 does not use prepared statements. Right? On Monday, February 10, 2014 1:41:03 AM UTC+5:30, Niphlod wrote: no, it doesn't. On Sunday, February 9, 2014 8:39:26 AM UTC+1, Jayadevan M

[web2py] Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Andrey K
Dear web2py users, I would like to add dynamically fields to SQLFORM.factory defined in the model in client side by jQuery and then get the added fields values back to db (by if form.accepted) via the standard form submit ,embedded in SQLFORM.factory . It does not seems to work on the server

[web2py] Re: Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Anthony
form.vars will include only fields defined in the form object (things you do on the client will not affect the form object on the server). The extra variables will be available in request.post_vars, so you could include logic to check request.post_vars and add fields to SQLFORM.factory based on

Re: [web2py] Re: Reaching pages by a descriptive pagename

2014-02-10 Thread Kevin Bethke
So my controller function would look something like this? def Article(): idstring=request.args(0) /*seperate id out of /112/-Title-of-Article*/ row=db(db.Article.id==id).select() return dict(Article=row[0]) -- Resources: - http://web2py.com - http://web2py.com/book

Re: [web2py] Re: Reaching pages by a descriptive pagename

2014-02-10 Thread Anthony
Yes, with some additional logic to handle the legacy URLs, make sure request.args(0) is an integer, etc. On Monday, February 10, 2014 12:04:22 PM UTC-5, BlueShadow wrote: So my controller function would look something like this? def Article(): idstring=request.args(0) /*seperate

Re: [web2py] Re: web2py multiple records in 1 form or in wizard

2014-02-10 Thread Richard Vézina
I didn't mean users... I mean 2 differents person that use the same session would lead to only one person order... I am not 100% sure, but I had issue in the pass passing value to form.vars like this the controller not taking value inputed in the form... That occure with request.vars.VAR, if you

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread Tim Richardson
I use git; I think the situation you describe is why version control systems exist. git is nice for lots of reasons; one of them is that you don't need any git 'server' software if your development is on the same machine, and if you do need servers, there are great internet options which you

Re: [web2py] Re: web2py multiple records in 1 form or in wizard

2014-02-10 Thread Anthony
I'm not sure exactly what you're talking about, but specifically in this case, there should be no difference between setting the field default before form creation vs. setting form.vars after form creation (this is unrelated to whether there is a possibility of overwriting something in the

[web2py] Re: only one session/login per user?

2014-02-10 Thread Dave S
On Saturday, February 8, 2014 3:49:45 PM UTC-8, DeanK wrote: Thanks Anthony. I think I like the sound of your last suggestion. I'm going to try that one out. Speaking as a naive developer, the cpu/io intensive remark suggests to me that the onlogin hook be used to queue a job for a worker

[web2py] Re: Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Andrey K
Thanks Anthony for your quick reply! I am not sure that I have understand you though. Do you mean I can get values from aggregated form in default.py as shown below, if so I still don't get the added values. Should l 'mark' them some how so they get into post_vars? If you mean other way, could

[web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread Tim Richardson
in your controller, you can access the global variable auth. You can ask auth.is_logged_in() is True if the user is logged in, for example. auth.user returns a Row telling you who is logged in. http://web2py.com/books/default/chapter/29/09/access-control#Authorization -- Resources: -

[web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread thiago_pnobre
Ok, no problem. Obs.: perfil = profile, autenticacao = authentication On db.py I have this login settings: ## login settings auth.settings.login_url = URL('autenticacao', 'index') auth.settings.logout_next = URL('autenticacao', 'index') auth.settings.logged_url = URL('default', 'perfil')

[web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread thiago_pnobre
I attached the db.py file and the controllers used on the problem, as you requested. Em domingo, 9 de fevereiro de 2014 16h51min04s UTC-2, thiago...@comp.ufla.br escreveu: The problem is that I have a page for the login form, that only can redirect to the home page if the login is valid.

[web2py] Validators problems

2014-02-10 Thread ninni . iovino
external_data = gluon.contrib.simplejson.loads(json_data) db.auth_user.username.requires = IS_IN_DB(db,'auth_user.username',error_message=T('Username già in uso')) db.auth_user.username.requires = IS_NOT_EMPTY(error_message=T(Il campo username non può essere vuoto...)) . ret =

Re: [web2py] Multiple SOLIDFORMs from table rows

2014-02-10 Thread Mike Constabel
Hi, Am Montag, 10. Februar 2014 16:05:49 UTC+1 schrieb viniciusban: Maybe I missed something, but what is a SOLIDFORM? Sorry, forget to mention it. SOLIDFORM is an extended SQLFORM http://dev.s-cubism.com/plugin_solidform -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Multiple SOLIDFORMs from table rows

2014-02-10 Thread Mike Constabel
Am Montag, 10. Februar 2014 16:21:57 UTC+1 schrieb Cliff Kachinske: Have you tried it without the showid arg? Yes, same error. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Multiple SOLIDFORMs from table rows

2014-02-10 Thread Mike Constabel
Yes. same error. Am Montag, 10. Februar 2014 16:21:57 UTC+1 schrieb Cliff Kachinske: Have you tried it without the showid arg? On Monday, February 10, 2014 3:12:36 AM UTC-5, Mike Constabel wrote: Hi, I try to generate multiple SOLIDFORMS from table rows. Simple example in pseudo code:

Re: [web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread Thiago Nobre
I already know auth.is_logged_in(), but unfortunately when the user enter like visitor, he's not logged in, he just entered at the site without a login. I need something like a login_onreject, because the visitor actually don't sign up. =/ 2014-02-10 17:22 GMT-02:00 Tim Richardson

[web2py] Re: Validators problems

2014-02-10 Thread Niphlod
you're redefining the validator for the same field. If you need both, use requires as a list of validators. BTW: why don't you just use is_in_db ? is it because of the error message ? On Monday, February 10, 2014 6:10:41 PM UTC+1, ninni@gmail.com wrote: external_data =

[web2py] how to embed an image (or another solution) ?

2014-02-10 Thread Stef Mientki
hello, maybe I'm totally on the wrong path, but this is my script for the moment: - users can upload pictures. Uploads seems to be allowed only in myapp/uploads - I want to show these images, but images to be shown are only allowed in myapp/static - so I have to show images from

[web2py] Re: only one session/login per user?

2014-02-10 Thread Anthony
Speaking as a naive developer, the cpu/io intensive remark suggests to me that the onlogin hook be used to queue a job for a worker thread that would carry out the hunt-and-flush mission. Or would that be the wrong hammer for this torque screw? Sounds reasonable, though I would test to

[web2py] Re: Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Anthony
Are you sure you're client side code is working? Check the browser developer tools to see what variables are being sent to the server with the POST request. Any post variables should end up in request.post_vars. Anthony On Monday, February 10, 2014 2:14:57 PM UTC-5, Andrey K wrote: Thanks

Re: [web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread Anthony
Can you be more clear about what is happening? Are you saying if someone goes to the login page and enters incorrect credentials, they are being redirected to the index page? Auth shouldn't be doing that by default. Can you show your code? On Monday, February 10, 2014 2:33:11 PM UTC-5, Thiago

[web2py] Re: Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Cliff Kachinske
On Monday, February 10, 2014 11:42:34 AM UTC-5, Andrey K wrote: Dear web2py users, I would like to add dynamically fields to SQLFORM.factory defined in the model in client side by jQuery and then get the added fields values back to db (by if form.accepted) via the standard form submit

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread pang
I just started using mercurial with bookmarks, it's supposed to be very much like git. It's something great! I work on the trunk head, but when I spot a bug, I update to stable, fix it, then update to trunk and merge it. The bug is fixed in both versions, but I only had to type once. It even

Re: [web2py] Re: How to prevent web2py redirect if login is not valid?

2014-02-10 Thread Thiago Nobre
Yeah, it's exactly what going on and I don't know why. I attached the db.py file and the controllers used on the problem, as you requested. 2014-02-10 19:58 GMT-02:00 Anthony abasta...@gmail.com: Can you be more clear about what is happening? Are you saying if someone goes to the login page

[web2py] how to make dictionary key a link

2014-02-10 Thread Austin Taylor
Hello, I'm displaying a dictionary using def results(): return dict(message=BEAUTIFY(session.dictionaryRequest)) Three of my keys have link values that I'd like the user to be able to click on. Is there a short way to do this? -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Form custom widget to grow/shrink multiple list:string input fields in parallel?

2014-02-10 Thread Horst Horst
I have a table with multiple list:string fields, like db.define_table(problem, # ... many other fields Field(a, list:string), Field(b, list:string), Field(c, list:string), # ... many other fields ) SQLFORM renders nice widgets for each of the fields with little + and - buttons. Now,

[web2py] Re: how to make dictionary key a link

2014-02-10 Thread Austin Taylor
I actually meant the value of the dictionary key: For example, a{'abc':'http://learnyourabcs.com'} a{'link':'http://thisisalink.com'} a{'user':'bob'} a{'norm':'anothervalue'} On Monday, February 10, 2014 6:00:54 PM UTC-5, Austin Taylor wrote: Hello, I'm displaying a dictionary using def

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread Dave S
On Monday, February 10, 2014 2:24:14 PM UTC-8, pa...@cancamusa.net wrote: I just started using mercurial with bookmarks, it's supposed to be very much like git. It's something great! I work on the trunk head, but when I spot a bug, I update to stable, fix it, then update to trunk and merge

[web2py] Re: how to make dictionary key a link

2014-02-10 Thread Anthony
I don't think BEAUTIFY offers any way to manipulate the values automatically. You can manipulate the keys by passing in a keyfilter argument, which is a callable that takes a key and returns a possibly transformed version of it (or None, in which case, that key is excluded from the output).

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread 黄祥
please use version control (git, mercury for your code) and then backup it up to another media as well (nas, tape) or you could store it in online backup like (dropbox, google drive) if it's your own project, i don't think so in your company allowed it to do so. i'm usually make a folders

Re: [web2py] represent on grid that link to another grid

2014-02-10 Thread 黄祥
thank you so much for your pointers, richard. best regards, stifan -- 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

[web2py] Re: Best practice for a development environment together with a live environment

2014-02-10 Thread 黄祥
sorry forgot to tell, i'm use configuration management (e.g. puppet, etc) for push the script to the machine (staging and production). so only the developer and system analyst can commit it (development and testing), and for promote to another environment is their own superior access. best

[web2py] Space in table/field name

2014-02-10 Thread Morten
Hey I'm new to python ad web2py I receive the following error everytime i try to retrieve a table or a field with space in it: type 'exceptions.SyntaxError' invalid table or field name: I only have read access and therefore I cannot change the name of field or table. Can this be resolved?

[web2py] Autodelete, uploadseparate: implementing in production.

2014-02-10 Thread Jason Brower
I want to add autodelete and uploadseparate in production but I have some worries. I doubt the files are moved in production, and the database field don't update. But I wanted to post here to make sure with you guys. Does uploadseparate move files or have issues with existing data? Second is the

[web2py] Permissions for files

2014-02-10 Thread Jayadevan M
When I work in the development environment (virtualbox centos) and then move the application to production server, I always run into permission issues. The extracted (from tar) files will have userid and grouid as some numbers, or root. Eventually I do a chown -R nginx to all files under

[web2py] Latest thinking -- Bootstrap vs. Foundation?

2014-02-10 Thread weheh
I'd just made up my mind to migrate to Bootstrap when a colleague said, Foundation. Checking the latest web2py doc, it points to Bootstrap. Would a few experienced users mind chiming in about which they prefer with web2py, Bootstrap or Foundation? Any gotchas wither way? Both look like they'll

[web2py] Re: Inject HTML in SQLFORM.factory field from client side(js or jQuery)

2014-02-10 Thread Andrey K
You were right Anthony - I have forgotten 'name' variable in HTML input node, I was appending. After adding it - it gave me my post variable via request.post_vars with no problem. You are the mannn! Thanks a lot of your kind and quick support. It is amazing how your answers make a

[web2py] possible bug with IS_TIME() midnight in 12 hour format?

2014-02-10 Thread User
I have an input field on a form where users can enter a time in 12-hour format. Entering 12:00AM on this form seems to be getting interpreted as 12PM (debugging I can see the python time object is datetime.time(12, 0). Calling the validator directly in the web2py shell gives: rtn =