I suspect this is a bug in the regex module.

Please try the following code in jython (outside web2py)

import re
re_strings=re.compile(r'(?P<name>'+ \
  r"[uU]?[rR]?(?:'''(?:[^']|'{1,2}(?!'))*''')|" +\
              r"(?:'(?:[^'\\]|\\.)*')|" +\
            r'(?:"""(?:[^"]|"{1,2}(?!"))*""")|'+ \
              r'(?:"(?:[^"\\]|\\.)*"))',re.DOTALL)
def replace(regex,text,f,count=0):
    i=0
    output=[]
    for item in regex.finditer(text):
        output.append(text[i:item.start()])
        output.append(f(item.group()))
        i=item.end()
        count -= 1
        if count==0: break
    output.append(text[i:len(text)])
    return ''.join(output)
print replace(re_strings,"a'\n'b",lambda x: x.replace('\n','\\n'))

Massimo

On Jan 10, 10:54 am, "Phyo Arkar" <[email protected]> wrote:
> Anyone have idea how you can make Views Work on jython? Now everything
> without views or db is working .. i feel like drving a card without 2
> wheels....
>
> On Sat, Jan 10, 2009 at 4:17 PM, Phyo Arkar <[email protected]>wrote:
>
> > Enlighten me , Master! :)
>
> > On Sat, Jan 10, 2009 at 4:09 PM, Phyo Arkar <[email protected]>wrote:
>
> >> What next...
>
> >> On Sat, Jan 10, 2009 at 4:08 PM, Phyo Arkar 
> >> <[email protected]>wrote:
>
> >>> Working!!!  But it works when i remove dict() so without template
>
> >>> So here it is:
>
> >>> def index():
>
> >>>     return "WELCOME TO WEB2Jy!!!!"
>
> >>> On Sat, Jan 10, 2009 at 4:04 PM, Phyo Arkar 
> >>> <[email protected]>wrote:
>
> >>>> I tried removing db.py from welcome app and got this new one.
>
> >>>> Traceback (most recent call last
> >>>> ):
> >>>>   File "/home/v3ss/web2py/gluon/main.py", line 215, in wsgibase
>
> >>>>     serve_controller(request,response,session)
>
> >>>>   File "/home/v3ss/web2py/gluon/main.py", line 215, in wsgibase
>
> >>>>     serve_controller(request,response,session)
>
> >>>>   File "/home/v3ss/web2py/gluon/main.py", line 79, in serve_controller
>
> >>>>     run_view_in(response._view_environment)
>
> >>>>   File "/home/v3ss/web2py/gluon/compileapp.py", line 242, in run_view_in
>
> >>>>     
> >>>> ccode=getcfs(layer,filename,lambda:compile(parse_template(response.view,os.path.join(folder,'views/'),context=environment).replace('\r\n','\n'),layer,'exec'))
>
> >>>>   File "/home/v3ss/web2py/gluon/compileapp.py", line 64, in getcfs
>
> >>>>     else: data=filter()
> >>>>   File "/home/v3ss/web2py/gluon/compileapp.py", line 242, in <lambda>
>
> >>>>     
> >>>> ccode=getcfs(layer,filename,lambda:compile(parse_template(response.view,os.path.join(folder,'views/'),context=environment).replace('\r\n','\n'),layer,'exec'))
>
> >>>>   File "/home/v3ss/web2py/gluon/template.py", line 97, in parse_template
>
> >>>>     text=replace(re_strings,text,lambda x: x.replace('\n','\\n'))
>
> >>>>   File "/home/v3ss/web2py/gluon/template.py", line 55, in replace
>
> >>>>     for item in regex.finditer(text):
>
> >>>> RuntimeError: maximum recursion depth exceeded
>
> >>>> On Sat, Jan 10, 2009 at 3:56 PM, mdipierro 
> >>>> <[email protected]>wrote:
>
> >>>>> is this the only issue?
> >>>>> can you run a web2py app without db=SQLDB('sqlite:...') then?
>
> >>>>> Massimo
>
> >>>>> On Jan 10, 9:55 am, "Phyo Arkar" <[email protected]> wrote:
> >>>>> > Ticket
> >>>>> 127.0.0.1.2009-01-10.22-26-35.84500c6a-16ea-4415-918a-7fc2e011133c
>
> >>>>> > Error traceback
>
> >>>>> > 1.
> >>>>> > 2.
> >>>>> > 3.
> >>>>> > 4.
> >>>>> > 5.
> >>>>> > 6.
> >>>>> > 7.
> >>>>> > 8.
> >>>>> > 9.
> >>>>> > 10.
> >>>>> > 11.
> >>>>> > 12.
> >>>>> > 13.
>
> >>>>> > Traceback (most recent call last):
> >>>>> >   File "/home/v3ss/web2py/gluon/restricted.py", line 62, in
> >>>>> restricted
> >>>>> >     exec ccode in environment
> >>>>> >   File "/home/v3ss/web2py/applications/welcome/models/db.py", line 8,
> >>>>> > in <module>
> >>>>> >     db=SQLDB('sqlite://storage.db')         # if not, use SQLite or
> >>>>> other DB
> >>>>> >   File "/home/v3ss/web2py/gluon/sql.py", line 421, in __init__
> >>>>> >     self._pool_connection(lambda:sqlite3.Connection(dbpath))
> >>>>> >   File "/home/v3ss/web2py/gluon/sql.py", line 386, in
> >>>>> _pool_connection
> >>>>> >     self._connection=f()
> >>>>> >   File "/home/v3ss/web2py/gluon/sql.py", line 421, in <lambda>
> >>>>> >     self._pool_connection(lambda:sqlite3.Connection(dbpath))
> >>>>> > NameError: global name 'sqlite3' is not defined
>
> >>>>> > In file: /home/v3ss/web2py/applications/welcome/models/db.py
>
> >>>>> > 1.
>
> >>>>> > <code object <module> at 0x4, file
> >>>>> > "/home/v3ss/web2py/applications/welcome/models/db.py", line 0>
>
> >>>>> > So , Hmm , Jython do not have SQLLite?
>
> >>>>> > On Sat, Jan 10, 2009 at 3:50 PM, Phyo Arkar <
> >>>>> [email protected]>wrote:
>
> >>>>> > > Heres my patched gluon/widget.py
> >>>>> > > Web2py is running!!
>
> >>>>> > > But have Internal Error (cannot see debug due to internal error on
> >>>>> admin
> >>>>> > > page too) lets see.
>
> >>>>> > > On Sat, Jan 10, 2009 at 3:30 PM, Phyo Arkar <
> >>>>> [email protected]>wrote:
>
> >>>>> > >> There!
>
> >>>>> > >> Jython2.5b1 is really cool! improved much from 2.5b0!
> >>>>> > >> Pydev Works Well with Jython2.5b1 , (not when it was 2.5b0!)
>
> >>>>> > >> Got some prob tho , i will remove browser module and try.
> >>>>> > >> v...@v3ssbox-2 /opt/web2py $ ~/jython2.5b1/jython web2py.py
> >>>>> > >> WARNING:root:no file locking
> >>>>> > >> WARNING:root:unable to import dbhash
> >>>>> > >> Traceback (most recent call last):
> >>>>> > >>   File "web2py.py", line 4, in <module>
> >>>>> > >>     from gluon.widget import start
> >>>>> > >>   File "/opt/web2py/gluon/widget.py", line 38, in <module>
> >>>>> > >>     import time, webbrowser, thread, re, cStringIO, os, stat,
> >>>>> socket,
> >>>>> > >> signal, math
>
> >>>>> > >> On Sat, Jan 10, 2009 at 3:10 AM, Massimo Di Pierro <
> >>>>> > >> [email protected]> wrote:
>
> >>>>> > >>> perhaps it is time to again to run web2py to jython! who wants to
> >>>>> take
> >>>>> > >>> the lead on this?
> >>>>> > >>> Massimo
>
> >>>>> > >>> Begin forwarded message:
>
> >>>>> > >>> *From: *Frank Wierzbicki <[email protected]>
> >>>>> > >>> *Date: *January 9, 2009 3:37:38 PM CST
> >>>>> > >>> *To: *Jython Developers <[email protected]>,
> >>>>> userJython <
> >>>>> > >>> [email protected]>, "
> >>>>> [email protected]" <
> >>>>> > >>> [email protected]>
> >>>>> > >>> *Subject: **Jython 2.5 Beta1 Released!*
> >>>>> > >>> *Reply-To: *"[email protected]" <[email protected]>
>
> >>>>> > >>> On behalf of the Jython development team, I'm pleased to announce
> >>>>> that
> >>>>> > >>> Jython 2.5b1 is available for download:
>
> >>>>>http://downloads.sourceforge.net/jython/jython_installer-2.5b1.jar.
> >>>>> > >>> See the installation instructions here:
> >>>>> > >>>http://www.jython.org/Project/installation.html.
>
> >>>>> > >>> Jython 2.5 Beta1 continues a code cooling period where the number
> >>>>> of
> >>>>> > >>> new features should significantly slow as we concentrate on
> >>>>> > >>> solidifying Jython 2.5 for an eventual release.  I would guess
> >>>>> that we
> >>>>> > >>> will put out about two more betas before we start pushing out
> >>>>> release
> >>>>> > >>> candidates, hopefully in February.
>
> >>>>> > >>> This is a beta release so be careful.
>
> >>>>> > >>> -Frank
> >>>>> > >>> --
> >>>>> > >>>http://mail.python.org/mailman/listinfo/python-announce-list
>
> >>>>> > >>>         Support the Python Software Foundation:
> >>>>> > >>>        http://www.python.org/psf/donations.html
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to