[web2py] Reporting server side calculation progress via ajax

2013-01-29 Thread Andriy
I have a time consuming server side calculation, which is triggered by edit-form submitting and can run up to several minutes (its a sports event data recalculation if rules are changed). During this time I want to receive messages via ajax from server and post them in a div for a progress visu

[web2py] Re: Reporting server side calculation progress via ajax

2013-01-29 Thread Andriy
I wrote a reply, but pressed "replay to author" by mistake. Now I do not know if it was PM or not and message is gone, this interface is confusing... The thing is, what Niphlod suggested works on localhost, but does not work on free pythonanywhere account. Server does not return 200OK for any r

[web2py] Re: Reporting server side calculation progress via ajax

2013-01-29 Thread Andriy
Ok, maybe I misunderstood this. Here is topic on pythonanywhere forum - https://www.pythonanywhere.com/forums/topic/432/ I will continue trying tomorrow. -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and s

[web2py] How to make "contains" case sensitive?

2013-02-03 Thread Andriy
db.define_table( 'event', ("info", 'list:string', default=[]) ) events=db(db.event.info.contains( ['red', 'blue'] )).select() - returns events if 'Red' or 'Blue' in event.info. But I need case sensitive cross search of two lists. In the book it says that .like has case_sensitive=True option. B

[web2py] Re: String interpreted as html code

2013-02-18 Thread Andriy
Use XML() helper - http://web2py.com/books/default/chapter/29/05#XML -- --- 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. F

[web2py] Block oversized uploads serverside

2013-02-18 Thread Andriy
I`m writing a forum with possibility of attachments and looking for a way to refuse over-sized uploads. Validator IS_LENGTH() checks for upload file size, but only after the whole file transfered to server. This may be a security issue, since several attackers can start to upload Gb files to se

[web2py] Re: Block oversized uploads serverside

2013-02-18 Thread Andriy
I just checked on server (and not localhost as I did before) and I must correct myself. File transfer goes though, but file never appears in uploads folder (which is a plus, but transfer itself is not safe). I`ll still open a ticket, may be you can do something to prevent file transfer. -- --

[web2py] Re: Block oversized uploads serverside

2013-02-19 Thread Andriy
Right now I`m trying to host on my own windows server. On Rocket and CherryPy I have problems with some pages not loading static images and "hanging" in Opera (other users report problems with Chrome, but at the same time I have no problems with IE or Firefox). I can not figure out whats the pr

Re: [web2py] Re: Block oversized uploads serverside

2013-02-19 Thread Andriy
Yes there are 10+ images, about 3-5 js and css files referenced. I`ve tried limit server connections in Opera settings to 1-2 max - didn`t help. I tried numthreads=500, max=700 for CherryPy - didn`t help. Don`t know how to set HTTP header "Connection: close" so far, may be in web2py controller

[web2py] Store and retrieve dictionary from database

2012-12-12 Thread Andriy
I`m sorry if this is naive question (I`m trying to make my first web application). I have a big dictionary with several levels of nested dictionaries and lists in it. DAL accepts this dictionary if I insert it in a Field of a Table (using sqlite3), but when I try to retrieve it back, I get long

[web2py] Re: Store and retrieve dictionary from database

2012-12-13 Thread Andriy
Thank you. Its very easy and it works! I knew I should read online version of the book as it is more updated. This is the case. I was reading through web2py_manual_4th.1.pdf and filter_in - filter_out is not mentioned there. --

[web2py] how to "orderby" string field with multiple words by second word

2013-01-01 Thread Andriy
I have a table with 'name' Field: db.define_table('person', Field('name', 'string')) 'name' is in format 'Name Lastname', ie, "Mark Twain". Can I sort such records by Lastname when selecting with "orderby"? Like this: db(db.person).select(db.person.name, orderby=?) I thought about writing lamb

[web2py] Re: how to "orderby" string field with multiple words by second word

2013-01-01 Thread Andriy
Thank you, Niphlod and DenesL. Thats what I need. "Find, exclude, sort" and row manipulation slipped through my attention before. --

[web2py] Can we disable creation of non-Auth sessions somehow?

2013-05-03 Thread Andriy
On my site, which is not even used by public right now, I get about 1000 sessions in a day created from various bots (google, yandex etc). I use default option of storing sessions in file system. I created a page for admin, on which admin can see all the sessions in a table and manually remove

[web2py] Re: Can we disable creation of non-Auth sessions somehow?

2013-05-06 Thread Andriy
Yes, it looks like it was forms (login form in particular), thank you. Ended up adding this to def user() in default.py: if not auth.user: session.forget(response) -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from thi

[web2py] Re: Can we disable creation of non-Auth sessions somehow?

2013-05-06 Thread Andriy
Yes, *def user()* in *default.py* has form for login. If I put: if not auth.user: session.forget(response) in this function, then session is not created, but logging in no longer works. Can something else be done to turn off session creation by this function and not break login? -- ---

[web2py] Re: Can we disable creation of non-Auth sessions somehow?

2013-05-06 Thread Andriy
Ok, thanks. I`ve put robots.txt in /static and configured routes.py for it. I hope this helps. -- --- 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+unsu

[web2py] Re: Can we disable creation of non-Auth sessions somehow?

2013-05-06 Thread Andriy
Maybe I did it wrong because I now still see sessions created from 66.249.73... which is Google-bot. I only changed url in the line: ('/robots.txt', '/examples/static/robots.txt'), to: ('/robots.txt', '/myAppName/static/robots.txt'), I checked, and www.mySiteName.ru/robots.txt opens in browser s

[web2py] Re: Can we disable creation of non-Auth sessions somehow?

2013-05-06 Thread Andriy
On Monday, May 6, 2013 8:53:32 PM UTC+3, Anthony wrote: > > Anyway, are you saying that http://www.yourdomain.com/robots.txt does > show the robots.txt file in the browser? If so, then I believe it should > work. However, I'm not sure Google will check for it/update it on every > single request

[web2py] Random, wrong strings in Content-Type Response header for .css

2013-05-17 Thread Andriy
I had this problem for a while, but since I was in development stage, I`ve not payed much attention. I use Apache/2.2.22 (Win32) mod_wsgi/3.3 Python/2.7.3 For some reason in some requests Content-Type Response header for .css returns not with "text/css", but with random strings. So browser do

[web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-17 Thread Andriy
I use Python 2.7.3 The problem manifests in all browsers. In FF its really rare. In Opera with "Max Connections To Server" > 2 its almost every time you load a page. In Opera with "Max Connections To Server" < 2 its 1 in 30-50 hits, or every time if you reload a page with CTRL+F5. In Chrome its

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-17 Thread Andriy
Web2py version is 2.4.6. I did change in stream_file_or_304_or_206 that you proposed, it did not fix the problem. If my static files are served by web2py, then I understand its wrong for production? Its better to serve them by Apache directly. But how to do this, I`m confused. I thought block

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-17 Thread Andriy
Ok, this is really strange. I changed line 68 (69 after Ricardo`s code addition) in *streamer.py* from: *headers.setdefault('Content-Type', contenttype(static_file))* to *headers.setdefault('Content-Type', 'text/css')* And problem gone! .css file have *text/css *headers, all other files have the

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-18 Thread Andriy
Thank you for your answers. I have only code like this in some controllers: *import gluon.contenttype response.headers['Content-Type']=gluon.contenttype.contenttype('.js')* or like this when I need to export some data to file and download it: *from gluon.contenttype import contenttype response.he

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-19 Thread Andriy
I`ve added this lines in http.py before responder(status, rheaders): ... *with open('d:\content_type.txt', 'a') as content_log: content_log.write(str([h for h in rheaders if h[0]=='Content-Type'])+'\n')* responder(status, rheaders) ... All headers in .txt file look normal, like: [('Content-Ty

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
Only now I noticed that not only .css files, but all files from /static folder are served with *text/css* headers for Content-Type. So I started to search why, rewritten all files in *gluon* folder with original source files, and recreated the main problem by doing this. Apparently, for some re

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
Niphlod, could you please tell me how to serve static files from apache without passing through web2py? Or where to read on this? Thanks. I may reinstall Apache. May be its problem with my current version (2.2) or with configuration... -- --- You received this message because you are subscri

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
Thank you, I did this and I think its Apache serving static files now, because all headers are OK. But if I make request for static file in Opera it has *X-Powered-By: web2py *header... Also I had response.static_version set in model file and now I have problem with it. I`m reading in web2py ma

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
So far I found that: http://www.autosim.ru/static/css/web2py.css - without app name in link, returns X-Powered-By: web2py http://www.autosim.ru/mad/static/css/web2py.css - with app name in link, no X-Powered-By header -- --- You received this message because you are subscribed to t

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
Yes, app generates all links with app-name in them. I was making manual requests in Opera without them before. Now only files like autosim.ru/robots.txt have no app name in them and are served with X-Powered-By: web2py header. I dont think its big problem For now I`m stuck, because I have no kn

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
Ok, it looks like a typo in web2py.com/books/default/chapter/29/04#Static-asset-management ? I`ve made a simple script to look what this pattern actually matching, and found that its not matching version string at all. By trial and error I found unnecessary Slash after *^/([^/]+)/static/(?:* Th

Re: [web2py] Re: Random, wrong strings in Content-Type Response header for .css

2013-05-31 Thread Andriy
Yes, *^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*)* works. -- --- 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 o

[web2py] Site does not remember users (auth.settings.long_expiration) after 2.6.3 update?

2013-09-19 Thread Andriy
My site and forum was running fine for 5 month now. Yesterday, I updated from version 2.4 (or 2.5, I don`t remember for sure which it was) to version 2.6.3. I did what change log says and copied static/js/web2py.js, controllers/appadmin.py, and views/appadmin.html from the welcome app to my app

[web2py] Re: Site does not remember users (auth.settings.long_expiration) after 2.6.3 update?

2013-09-19 Thread Andriy
Yes. I installed http://www.web2py.com/examples/static/nightly/web2py_src.zip (this is latest?) and can not replicate problem now. Site remembers me every time so far and cookie has right "expires" data. Thank you very much, Massimo! If something goes wrong during the day (days) I`ll post here.

[web2py] Multiple domains accessing all apps through URL

2013-10-02 Thread Andriy
I`ve successfully connected 2 domains to my apache-web2py configuration using routes.py. But I have one problem - all apps are accessible from one-another if I add app-name to domain URL. For example, I defined: domains = { 'domain1.com': 'app1', 'domain2.com': 'app2'} www.domain1.co

[web2py] Re: Multiple domains accessing all apps through URL

2013-10-02 Thread Andriy
Its a trunk version, that I`ve took between versions 2.6.3 and 2.6.4. -- 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 yo

Re: [web2py] Re: Multiple domains accessing all apps through URL

2013-10-02 Thread Andriy
Yes, adding "exclusive_domain=True" helped. I get "invalid function (default/...)" now, which is what I wanted. Thank you, Jonathan. domains = { 'domain1.com': 'app1', 'domain2.com': 'app2'}*,* *exclusive_domain=True* * * * * -- Resources: - http://web2py.com - http://web2py.com/boo

[web2py] Re: search db, return table with pagination

2014-08-14 Thread Andriy
Thats because your "rows = None" until you submit the form. You can add this check in the template: *{{if rows:}}* {{for i,row in enumerate(rows):}} ... ... next {{pass}} *{{pass}}* Or you can try set rows to empty list in controller: def search(): *rows = []* -- Resources: - http://web2py

[web2py] Why input field in form.vars is stripped of trailing spaces?

2017-02-10 Thread Andriy
fields = [ Field('name', 'string', default=defaults['name'], requires=[IS_NOT_EMPTY(error_message='Enter name')]), ] form = SQLFORM.factory(*fields, _class="uk-form uk-form-horizontal", _name="edit_form") if form.process(hideerror=True).accepted: print (form.vars.name, request.vars.na

[web2py] Re: Why input field in form.vars is stripped of trailing spaces?

2017-02-10 Thread Andriy
Thanks, Anthony. lambda that you posted works like you described, I`ll use it. But if I remove* requires=[IS_NOT_EMPTY* validator completely, the form.vars still returns name without spaces. Does it apply some validtion without it by default and removing spaces? -- Resources: - http://web

[web2py] Re: Why input field in form.vars is stripped of trailing spaces?

2017-02-10 Thread Andriy
I completely agree. It would be better if this will be fixed. I never noticed this behavior until I`ve got to the case where I need to keep white spaces in front and at the back of the input field. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/we