[web2py] Re: Adding application specific data to httpserver.log ?

2012-02-07 Thread JC11
Thank you,

Would there be any harm in adding environ['QUERY_STRING'] httpserver.log as 
a change in your main.py source code ?  This would solve my issue and 
perhaps help others by giving a little more detail in the logs which for 
REST type applications will be very useful.

One line added and two lines slightly altered around line 700 of main.py in 
gluon:

line = '%s, %s, %s, %s, %s, %s, %f, %s\n' % (  #JC:  added 
extra ', %s' before the \n
environ['REMOTE_ADDR'],
datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S'),
environ['REQUEST_METHOD'],
environ['PATH_INFO'].replace(',', '%2C'),
environ['SERVER_PROTOCOL'],
(status_headers[0])[:3],
time.time() - time_in,  # JC: add a comma at the end of 
this line 
environ['QUERY_STRING'] # JC: new line to show query 
parameters

Thanks,

John Cobo


[web2py] Adding application specific data to httpserver.log ?

2012-02-05 Thread JC11
Hello,

I need to add logging to my application. Out of the box, httpserver.log 
supplies 90% of what I want, but I'd love to add another piece or two of 
data to it. The data to add is specific to my application and present on 
the incoming URLs.

Any advice on where I should start ?

Thanks,

John C.


[web2py] Anyone using memCache ? Two issues

2010-12-01 Thread JC11
Hello,
I have used the local web2py cache such as:
  msg = cache.ram(cacheKey, lambda: getResponse(reqBody),
time_expire=10), and sometimes
 cache.ram.clear(cacheKey)
which works fine.  (easy and fast !)

I am now trying to use memcached and getting two errors.  The first
is :
  cache.ram.clear(cacheKey)
AttributeError: '_MemcacheClient' object has no attribute 'clear'

And the second is that is seems I am not connecting to the memcached
server.  The hints of this are that the responses are now very slow
and not getting a value from the cache, also the admin. chap can not
see any entries being put in the cache by me.

Any solutions to the first problem and hints about where to look for
the second (some sort of debug mode or something).

Thanks,

JC


[web2py] Re: response.render

2010-09-17 Thread JC11
Thanks, :)

On Sep 16, 6:04 pm, mdipierro  wrote:
> from gluon.template import render
> def index():
>     return render()
>
> look at the source code of that function it has lots of options.
>
> On Sep 16, 11:47 am, JC11  wrote:
>
> > Is it possible to call response.render(view, vars) in a controller,
> > but have the view not a file, but as a string ?
>
> > The reason I want to do this is that I am getting the view from a
> > database table and replacing bits of it with python code snippets
> > {{some code}} which response.render will evaluate.
>
> > The other way to do this would be to pass python snippets {{...}} into
> > the view as vars, but they don't seem to get  evaluated.
>
> > The documentation says:
> > 'response.render(view, vars): a method used to call the view
> > explicitly inside the controller. view is an optional parameter which
> > is the name of the view file.'
>
> > Thanks,
>
> > JC
>
>


[web2py] response.render

2010-09-16 Thread JC11
Is it possible to call response.render(view, vars) in a controller,
but have the view not a file, but as a string ?

The reason I want to do this is that I am getting the view from a
database table and replacing bits of it with python code snippets
{{some code}} which response.render will evaluate.

The other way to do this would be to pass python snippets {{...}} into
the view as vars, but they don't seem to get  evaluated.

The documentation says:
'response.render(view, vars): a method used to call the view
explicitly inside the controller. view is an optional parameter which
is the name of the view file.'

Thanks,

JC


[web2py] Re: Anybody going to PyCon?

2010-05-26 Thread JC11
I sang the praises of web2py at Euro-Python last spring.  My talk was
not about web2py or web frameworks but about a (very corporate)
application written with web2py.

Perhaps more talk of what has been built with web2py rather than
framework comparisons and moaning is the way to go ?

John C.


[web2py] LOB variable no longer valid after subsequent fetch - again

2010-05-25 Thread JC11
Hello,
I am migrating a web2py app. to Oracle.  It works fine on postgresql
and sqlite, but my firm demands Oracle.  There is a large field in my
db ( > 4000 chars) so can not be a string.  Oracle creates this a
clob.  Often (but not always) I get the dreaded error: 'LOB variable
no longer valid after subsequent fetch'.

I have dug around and uncommented a 'FIX' in gluon/sql.py:
elif fieldtype == 'text':
if dbname == 'oracle':
return ":CLOB('%s')" % obj.replace("'","?") ### FIX THIS
I also tried :
return ":CLOB('%s')" % obj.replace('\'','\'\'')
both let to even more errors.

Is there a fix for this ?  (Python 2.6.5 on Linux, web2py Version
1.76.5)

Thanks,

John C.


[web2py] Postgresql connection from Jython not working for me

2010-04-08 Thread JC11
The next Jython challenge !

The line:
db = DAL('postgres://stubo:st...@10.220.17.77/stubo_remote',
pool_size=10)
works fine when running in python, but fails from Jython (see
below).

>From Jython I can run: 'from com.ziclix.python.sql import zxJDBC', so
I think that is installed OK


Traceback (most recent call last):
  File "C:\web2py1_76_5\gluon\restricted.py", line 173, in restricted
exec ccode in environment
  File "C:/web2py1_76_5/applications/stubo/models/db.py", line 27, in

db = DAL('postgres://stubo:st...@10.220.17.77/stubo_remote',
pool_size=10)
  File "C:\web2py1_76_5\gluon\sql.py", line 3782, in DAL
return SQLDB(uri, pool_size=pool_size, folder=folder,
  File "C:\web2py1_76_5\gluon\sql.py", line 1161, in __init__
self._pool_connection(lambda
params=params:zxJDBC.connect(*params))
  File "C:\web2py1_76_5\gluon\sql.py", line 840, in _pool_connection
self._connection = f()
  File "C:\web2py1_76_5\gluon\sql.py", line 1161, in 
self._pool_connection(lambda
params=params:zxJDBC.connect(*params))
IndexError: index out of range

Any suggestions welcome.

John C.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How to install and run web2py on Jython ?

2010-04-08 Thread JC11
If you want me to test it, I will gladly do so.

John C.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread JC11
I am getting the dreaded error:
  RuntimeError: maximum recursion depth exceeded

I am using web2py vsn. 1.76.5, jython version 2.5.1 on Windows XP.

I have altered the web2py 'welcome' application defaault controller
to: return 'Hello World' rather than return dict(message=T('Hello
World')).
This solved the recursion problem, but only if one does not use web2py
views :(

I tried adding the following to the default controller, but it did not
help.
 import sys
 sys.setrecursionlimit(2500)

Any suggestions ?

On Apr 7, 4:16 pm, Jonathan Lundell  wrote:
> On Apr 7, 2010, at 7:14 AM, mdipierro wrote:
>
> > Some people have reported problems with Jython due to a bug in Java
> > regex. I tried Jython2.5rc2 and it worked for me. Let us know.
>
> One or two of the regex patches a while back (URL checking IIRC) was aimed at 
> preventing excessive backtracking under Jython. If anyone runs into that 
> problem again, they should report it. I'm pretty sure I understand how to 
> avoid at least the problem we had then, by making alternations mutually 
> exclusive.
>
>
>
> > On Apr 7, 6:14 am, JC11  wrote:
> >> Thanks,
>
> >> I am sure I searched in the 'book', how silly of me not to find it.
> >> What about Oracle and Jython ?  The last line of the entrie reads:
> >>    'You will be able to use DAL('sqlite://...') and
> >> DAL('postgres://...')  only.'
>
> >> John C.
>
> >> On Apr 7, 11:54 am, Kuba Kucharski  wrote:
>
> >>> Hi,
>
> >>> here they are:
>
> >>>http://web2py.com/book/default/section/12/9
>
> >>> + use newest stable
>
> >>> --
> >>> Kuba
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How to install and run web2py on Jython ?

2010-04-07 Thread JC11
Thanks,

I am sure I searched in the 'book', how silly of me not to find it.
What about Oracle and Jython ?  The last line of the entrie reads:
   'You will be able to use DAL('sqlite://...') and
DAL('postgres://...')  only.'

John C.

On Apr 7, 11:54 am, Kuba Kucharski  wrote:
> Hi,
>
> here they are:
>
> http://web2py.com/book/default/section/12/9
>
> + use newest stable
>
> --
> Kuba

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] How to install and run web2py on Jython ?

2010-04-07 Thread JC11
Hello,
Are there instructions anywhere for installig and running web2py on
Jython ?

A few questions I have so far:

+ which version of web2py (source code ?)
+ how and where to install database drivers ? - my attempt fails
to find psycopg2. Does one use python db drivers or java drivers ?
+ start command (something like: jython web2py.py -a password -i
127.0.0.1 -p 8000 ???)

Thanks,

For us, Jython will likely be the way to get web2py into the
'enterprise'.

Thanks,

John C.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: turnkeylinux help

2010-03-28 Thread JC11
Is there any progress on turnkey or a vmware appliance for web2py ?  I
have been trying - and failing to install web2py on our (old) Red Hat
Linux that has a very old Python version.  A vmware appliance would be
ideal.  Anything I can do to help ?

John C.

On Mar 21, 4:21 pm, "Mark Breedveld"  wrote:
> Testing a reply from outlook.
> Ignore this message
>
> -Oorspronkelijk bericht-
> Van: web2py@googlegroups.com [mailto:web...@googlegroups.com] Namens
> mdipierro
> Verzonden: vrijdag 12 maart 2010 19:12
> Aan: web2py-users
> Onderwerp: [web2py] Re: turnkeylinux help
>
> My interest in turnkey is that once made it will be available forvmware, 
> amazon, xen and will show up in the VPS.net list of available
> appliances. The rule is that the machine has to be built by their
> patching process.
>
> I hit a block there because my patch fails ad apt-get install a module
> that is there.
> I do not know were to go from here but I will get back at it next
> week.
>
> Massimo
>
> On Mar 12, 10:01 am, Christopher Steel  wrote:
>
>
>
>
>
> > I ran a test on a virtual machine with similar results.
>
> > If I understand what you are trying to do correctly and  that echo
> > message is valid then perhaps the script 'setup-web2py-ubuntu.sh' is
> > being run as part of the ISO patching process?
>
> > A better solution might be to put the script on the ISO being created
> > and have it run during the eventual system installation via kickstart
> > using some other mechanism.
>
> > I am currently looking for ways to automating setting up Ubuntu web2py
> > server (hosting) setups for a new Canadian non-profit.
>
> > Please let me know if I can be of further assistance in this or
> > similar activities.
>
> > Thanks,
>
> > Chris
>
> > On Mar 11, 11:15 am, mdipierro  wrote:
>
> > > keep us posted.
>
> > > I had some problems with the one I posted:
> > > 1) the apt-get install get stuck and I have to restart a few times
> > > 2) it is supposed to use the PAM user password for admin but PAM does
> > > not seem to allow the app to login as root
> > > 3) I am using the LAPP appliance and phpPgAdmin does not appear to be
> > > running.
>
> > > On Mar 11, 9:40 am, Mark Breedveld  wrote:
>
> > > > I have an Turnkey instance ready and try it as soon as possible.
>
> > > > greetings,
>
> > > > Mark,
>
> > > > On 11 mrt, 16:07, Massimo Di Pierro  wrote:
>
> > > > > Try this
>
> > > > >  web2py_patch.zip
> > > > > 3KWeergevenDownloaden
>
> --
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py:19007] Re: Save a view as a file ?

2009-04-03 Thread JC11

Super, thanks.
This works but with 'write' rather than 'save'.

I am getting more and more impressed with web2py as I use it more.
JC

On Apr 2, 11:39 pm, mdipierro  wrote:
> open(filename,'wb').save(response.render(view_filename,dict(a=3)))
>
> On Apr 2, 5:22 pm, JC11  wrote:
>
> > Sorry I did not make that clear.  The file should be saved on the
> > server.
> > JC
>
> > On Apr 2, 2:16 pm, mdipierro  wrote:
>
> > > Yes but I am not sure from your question if you want the visitor to
> > > save the file on the client machine or on the server machine. I assume
> > > the former:
>
> > > def save_file():
> > >      filename='bla.html'
> > >      response.headers['Content-Disposition']='attachment;
> > > filename="%s"' % filename
> > >      return dict(var='whatever')
>
> > > On Apr 2, 2:07 am, JC11  wrote:
>
> > > > Hello,
> > > > I would like to use the excellent template facilities in web2py views
> > > > {{}} but save the results to a file rather than present them as a
> > > > web page.  How would this be possible ?
>
> > > > This is just for one of several views in my application and should
> > > > happen always for the one view without the user needing to do
> > > > anything.  This can manually be achieved by the user seeing the page,
>
> > > > > view source, > save as .
>
> > > > Thanks,
> > > > JC
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18993] Re: Save a view as a file ?

2009-04-02 Thread JC11

Sorry I did not make that clear.  The file should be saved on the
server.
JC

On Apr 2, 2:16 pm, mdipierro  wrote:
> Yes but I am not sure from your question if you want the visitor to
> save the file on the client machine or on the server machine. I assume
> the former:
>
> def save_file():
>      filename='bla.html'
>      response.headers['Content-Disposition']='attachment;
> filename="%s"' % filename
>      return dict(var='whatever')
>
> On Apr 2, 2:07 am, JC11  wrote:
>
> > Hello,
> > I would like to use the excellent template facilities in web2py views
> > {{}} but save the results to a file rather than present them as a
> > web page.  How would this be possible ?
>
> > This is just for one of several views in my application and should
> > happen always for the one view without the user needing to do
> > anything.  This can manually be achieved by the user seeing the page,
>
> > > view source, > save as .
>
> > Thanks,
> > JC
--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:18972] Save a view as a file ?

2009-04-02 Thread JC11

Hello,
I would like to use the excellent template facilities in web2py views
{{}} but save the results to a file rather than present them as a
web page.  How would this be possible ?

This is just for one of several views in my application and should
happen always for the one view without the user needing to do
anything.  This can manually be achieved by the user seeing the page,
> view source, > save as .

Thanks,
JC

--~--~-~--~~~---~--~~
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 unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---