[web2py] Re: View rendering stop swap of special HTML characters

2010-11-19 Thread Mark Larsen
Nevermind. Figured it out right after I posed. You use the XML function. My example becomes: someJavascriptFunction({{=XML(simplejson.dumps(aPythonVar))}}); On Fri, Nov 19, 2010 at 12:06 PM, Mark Larsen wrote: > I'm attempting to upgrade to a new version of web2py (1.69 to 1.89.4)

[web2py] View rendering stop swap of special HTML characters

2010-11-19 Thread Mark Larsen
I'm attempting to upgrade to a new version of web2py (1.69 to 1.89.4). It seems that when the views are rendered now Web2py auto swaps any special HTML characters. For instance I have: someJavascriptFunction({{=simplejson.dumps(aPythonVar)}}); This errors because the quotes in the aPythonVar ar

[web2py] NTLM Challenge Response

2010-04-28 Thread Mark Larsen
I'm curious if something like this: http://www.rgagnon.com/javadetails/java-0441.html Can be done with web2py? Essentially I need to: response.status = 401 response.headers["WWW-Authenticate"] = "NTLM" >From a controller. The response.status doesn't seem to do anything as it still returns 200

Re: [web2py] Re: Global Variable Available Across Sessions

2010-02-01 Thread Mark Larsen
> Why not use a chained cache.disk inside a cache.ram. I think I like just using the cache.ram and pre-loading each processes. The structure is large and I'm not sure how reading from disk (especially with a fair amount of users) would affect performance. I'm going to have to profile this when I

Re: [web2py] Re: Global Variable Available Across Sessions

2010-01-31 Thread Mark Larsen
> FWIW, I had good results in a previous project using a recipe from > Massimo for a ram cached threadsafe class. I wasn't using Apache, > though. Mike, that looks really promising. I imagine I could come up with a way to get all the apache processes to cache the same object after the server sta

Re: [web2py] Global Variable Available Across Sessions

2010-01-31 Thread Mark Larsen
> > > > > On Sun, Jan 31, 2010 at 5:04 PM, Mark Larsen wrote: >> I'd like to use a global variable (an instance of an object) that is >> initiated at server start up and that is a available to all >> threads/processes of the application.  Is such a thing possib

[web2py] Global Variable Available Across Sessions

2010-01-31 Thread Mark Larsen
I'd like to use a global variable (an instance of an object) that is initiated at server start up and that is a available to all threads/processes of the application. Is such a thing possible? If it matters, I develop using the built-in server and use apache2/mod_wsgi in production. Thanks, Mark

[web2py:35592] Re: Data parser advice sort from web2py developers

2009-11-18 Thread Mark Larsen
I've had good experience with ElementTree: http://effbot.org/zone/element-index.htm It has both straight python and a CPython versions. It's included with Python >= 2.5. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Gro

[web2py:35131] Re: Not Encoding HTML in View {{=}}

2009-11-11 Thread Mark Larsen
> XML(''.join(['A','B','C'])) Thanks Wes, I knew there had to me a simple mechanism in place. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googleg

[web2py:35126] Not Encoding HTML in View {{=}}

2009-11-11 Thread Mark Larsen
How can I get my view to not encode my html. For example if I do: ''.join(['A','B','C']) I get: ABC I want: ABC Thanks! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. T

[web2py:33337] Global Application Variable Generated Once

2009-10-21 Thread Mark Larsen
Let's say I need to create a global variable once on application start-up. It would take a few CPU cycles to generate this variable so I wouldn't want to re-generate it on each request cycle. Is there a way to do this in web2py? Should I be using the cache? Thanks, Mark --~--~-~--~--

[web2py:29090] Re: Deployment Issues on CentOS

2009-08-21 Thread Mark Larsen
> You don't need to use rewrite rules to do the latter, you can > generalise both to: > >  WSGIScriptAliasMatch ^/(admin|welcome|examples)(/.*)?$ /path/to/ > web2py/wsgihandler.py/$1$2 > > With this approach though, you have to modify the configuration every > time you add a new application. > > T

[web2py:29038] Re: Web2py.com down

2009-08-20 Thread Mark Larsen
> Try the launchpad site... No luck, just the repository. https://launchpad.net/web2py/+download is empty. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to

[web2py:29033] Re: Deployment Issues on CentOS

2009-08-20 Thread Mark Larsen
> == > ### setup WSGI > WSGIScriptAlias /apps /usr/local/web2py/current/wsgihandler.py > WSGIDaemonProcess web2py user=apache group=apache \ >     home=/usr/local/web2py/current \ >     processes=10 maximum-requests=500 > > >     Order allow,deny >     Allow from a

[web2py:29032] Re: Web2py.com down

2009-08-20 Thread Mark Larsen
>> Thanks; this has been reported.  Massimo will have to reset his server >> when he gets back from hiking in a few days. Massimo might want to give another body admin rights to his server. Seems rather horrible that the face of the project "web2py.com" is out of commission for so long. Are ther

[web2py:28553] Re: logo

2009-08-13 Thread Mark Larsen
A --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com

[web2py:23084] Re: Upload progress

2009-06-01 Thread Mark Larsen
> I think you are right Hmm, I am thinking of writing a patch. The web2py server changes would be trivial, perhaps a callback function that fires on each iteration in the copystream function. An example function could say place the percent copied in a database or temp file to then be polled wit

[web2py:23055] Re: Upload progress

2009-06-01 Thread Mark Larsen
> I am pretty sure user ceej has coded using js, perhaps he can tell use > which js plugin he sued. If you are using an HTML 'file' control, all the implementations I've seen require POSTing the upload to an iframe, then using AJAX to poll the progress of the upload. How you poll the progress is

[web2py:22229] Re: make it work under Lighttpd with $HOST['url']?

2009-05-20 Thread Mark Larsen
> but that configuration doesn't fit my needs. > I've tried setting the following config, but it always results with an > "Invalid request". I suppose it's due to the uri parsing, but I can't > solve it as I'm quite new to Lighttpd. > Any ideas? > Giovanni, I had the same problem with web2py, ap

[web2py:21871] Re: Importing modules from controller folder

2009-05-14 Thread Mark Larsen
> /controlllers >              /forms/__init__ >              /forms/ reg_form.py You are missing .py on the __init__, was that a typo? > import forms.reg_form ### ERROR Since web2py runs out of it's root maybe (this as worked for me with things out of my modules directory): import application

[web2py:20589] Re: cache.ram with mod_wsgi/apache does not work?

2009-04-26 Thread Mark Larsen
> would you write an AlterEgo entry about this? Done. Also, I added a wiki entry about configuring apache/mod_wsgi with web2py not at the root of the web-server (I can't believe there's not more demand for that). Would that be better served as an AlterEgo entry? --~--~-~--~~---

[web2py:20449] Re: cache.ram with mod_wsgi/apache does not work?

2009-04-24 Thread Mark Larsen
> Is it because of the multiple apache processes? OK, I answered my own question, setting apache/mod_wsgi to 1 process fixes this. In fact it's mentioned (subtly) in Example 39 at: http://www.web2py.com/examples/default/examples#cache_examples I might look into using mem-cached instead. Thanks

[web2py:20442] cache.ram with mod_wsgi/apache does not work?

2009-04-24 Thread Mark Larsen
Web2py-ers, Does cache.ram not work with mod_wsgi/apache? Is it because of the multiple apache processes? Sample code: result = cache.ram(response.session_id,lambda: cacheFunc(),600) def cacheFunc(): file("/home/www/test.txt","a").write(str(time.time())+"\n") return True Reloading the pa

[web2py:19890] Re: telnetlib & web2py

2009-04-16 Thread Mark Larsen
> By forking you for the entire > web-server (or proxy) with lots of memory overhead and lots on > potential consequences. I've solved a similar problem by having web2py make a system call to a separate python script that demonizes itself immediately (http://code.activestate.com/recipes/278731/).

[web2py:19827] Re: WSGI, Apache2, and web2py NOT at root

2009-04-15 Thread Mark Larsen
> See if http://forum.webfaction.com/viewtopic.php?pid=8473#p8473 > provides any hints for you Thanks Yarko. It still has the troublesome line: WSGIScriptAlias / /home/[YOUR ACCOUNT]/webapps/apachewsgi/web2py/wsgihandler.py Which essentially tells apache to handle anything coming at the ro

[web2py:19748] WSGI, Apache2, and web2py NOT at root

2009-04-14 Thread Mark Larsen
I'm struggling setting up web2py with Apache2 and mod_wsgi. I've followed the manual, (page 205) mainly--> Alias / /home/web2py/applications/ ## setup WSGI WSGIScriptAlias / /home/web2py/wsgihandler.py WSGIDaemonProcess web2py user=www-data group=www-data home=/home/web2py/ 12 processes=10 maxim

[web2py:18919] WSGI Deployment Help

2009-04-01 Thread Mark Larsen
Web2py 1.59 Apache 2.2.11 My http.conf entries for this are: WSGIScriptAlias /web2py/ /home/larsenma/web2py/web2py-algSim/wsgihandler.py Order allow,deny Allow from all Going to http://serverName/web2py/, returns HTTP 400 Bad Request, nothing in the apache logs Going to http://serv

[web2py:18648] Re: cache.ram Questions

2009-03-26 Thread Mark Larsen
Since we are on the subject, how can you remove an item from the cache? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To uns

[web2py:18604] cache.ram Questions

2009-03-25 Thread Mark Larsen
Web2Pyers, What the appropriate way to use cache.ram? Let's say I want to cache an object (in my case its a cStringIO). In my controller function --> def makeMe(): x = cStringIO.StringIO() cache.ram("myObj", lambda: x, 5) def getMe(): x = cache.ram.storage['myObj'][1] response.headers[

[web2py:13942] Re: Must Web2py always be running?

2008-12-20 Thread Mark Larsen
Tokyo Dan, Not sure what you mean by stand-alone, but I'm using web2py to run a client application. The web2py framework runs in the background using the built-in webserver, the start menu item for my application launches IE pointed to http://127.0.0.1:8000/appName. To give it all a more seamle

[web2py:12398] Re: Return only one dict to the view?

2008-11-23 Thread Mark Larsen
Just return a dict of dicts --> return dict(dict1={'one':1,'two':2},dict2={3:'three',4:'four'}, dict3={'hi':'mom'}) > Yes, I realized this is a python issue, and found my python manual > telling me that I could combine several dicts in the return statement > by making a tuple out of them, just

[web2py:11748] Re: Patch Proposal - Custom Exception Handling

2008-11-12 Thread Mark Larsen
Duh! It looks like his routes_onerror would do everything I need. My customexception.py just becomes a controller method. Thanks Tim & Massimo. On Nov 12, 12:45 pm, mdipierro <[EMAIL PROTECTED]> wrote: > Mark, > > please talk to Tim. We just included (1.48) his patch for > "routes_onerror". I

[web2py:11745] Patch Proposal - Custom Exception Handling

2008-11-12 Thread Mark Larsen
ndler, set to None or False to do nothing set to string for text to display to user within your file you set rv to a string to display to the user, set it to None or False to have web2pys default mechanism used. An example of a "customexception.py" file would be: [code] '&#x

[web2py:11724] Re: mod_wsgi / Apache, Non-root mount, setting default application

2008-11-11 Thread Mark Larsen
Experimenting some and it seems it might be as simple as: WSGIScriptAlias /appName /opt/web2py-1.49/wsgihandler.py/appName Of course this would require multiple handlers for each application. Is there a better way? On Nov 11, 4:10 pm, Mark Larsen <[EMAIL PROTECTED]> wrote: > web

[web2py:11695] mod_wsgi / Apache, Non-root mount, setting default application

2008-11-11 Thread Mark Larsen
web2py users, I'm running apache2 with mod_wsgi. I ScriptAlias the wsgihandler.py not as the root of the server but with it's own directory. From my vhost file: WSGIScriptAlias /appName /opt/web2py-1.49/wsgihandler.py Order allow,deny Allow from all To access th

[web2py:11556] Re: new in trunk

2008-11-10 Thread Mark Larsen
up. For the icon it looks for "web2py.ico" in the root folder of web2py. If that isn't present it uses the default "application icon" supplied with windows. On Nov 8, 5:27 pm, mdipierro <[EMAIL PROTECTED]> wrote: > I also included patches from Mark Larsen and N

[web2py:11425] Re: web2py in Taskbar (System Tray) - now without wx bloat

2008-11-07 Thread Mark Larsen
Sorry off playing basketball (75 degrees out in November)! It's on its way. On Nov 7, 6:04 pm, mdipierro <[EMAIL PROTECTED]> wrote: > hey, I have not got this yet. :-( > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Group

[web2py:11423] Re: web2py in Taskbar (System Tray) - now without wx bloat

2008-11-07 Thread Mark Larsen
Tim, I included the restart mostly for my own use. My client app communicates with a serial port barcode scanner. Although I think I've coded for all the possibilities, I'm worried something will go arwy and I needed an easy way for users to reset it. You are right about the browser window pop

[web2py:11400] web2py in Taskbar (System Tray) - now without wx bloat

2008-11-07 Thread Mark Larsen
Based on Tim Farrell's advice in a previous discussion, I've recoded my system tray stuff using pyWin32 libraries (Mark Hammond had an excellent example). While this means it'll only work on windows it does not add the WX library bloat (it's a single .py file and maybe a dozen lines in widget.py)