Massimo, sorry for stalking you, but could you (or somebody) make this work:

Massimo wrote on github:

wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
cd web2py
mkdir applications/benchmark
cp -r applications/welcome/* applications/benchmark
rm applications/benchmark/models/*
echo """
import sqlite3
def index():
    return 'Hello World!'
def hellos():
    return dict()
def hellodb(): # NO DAL
    db = sqlite3.connect(os.path.join(request.folder,'databases','hello.db'))
    rows = db.execute('select id, data from hello order by id asc')
    lipsum = [dict(id=row[0], data=row[1]) for row in rows.fetchall()]
    return dict(rows=lipsum)
def hellodb2(): # DAL
    response.view = 'tests/hellodb.html' # recycle view
    db = DAL('sqlite://hello.db')
    db.define_table('hello',Field('data')) # creates table and db if not exists
    rows = db(db.hello).select()
    return dict(rows=rows)
""" > applications/benchmark/controllers/tests.py
mkdir  applications/benchmark/views/tests
echo """
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en">
<head>
    <title>Hello World</title>
</head>
<body>
    {{ include }}
</body>
</html>
""" > applications/benchmark/views/base.html
echo """
{{ extend "base.html" }}
    <p>Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. 
Condimentum vel, at augue nibh sed.     Diam praesent metus ut eros, sem 
penatibus. Pellentesque. Fusce odio posuere litora non integer habitant proin. 
Metus accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra 
a volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni 
tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. 
Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, 
aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. 
Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, 
ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum 
non.</p>
""" > applications/benchmark/views/tests/hellos.html
echo """
{{ extend "base.html" }}
<p>Lorem ipsum dolor sit amet, consecteteur adipiscing elit nisi ultricies. 
Condimentum vel, at augue nibh sed. Diam praesent metus ut eros, sem penatibus. 
Pellentesque. Fusce odio posuere litora non integer habitant proin. Metus 
accumsan nibh facilisis nostra lobortis cum diam tellus. Malesuada nostra a 
volutpat pede primis congue nisl feugiat in fermentum. Orci in hymenaeos. Eni 
tempus mi mollis lacinia orci interdum lacus. Sollicitudin aliquet, etiam. Ac. 
Mi, nullam ligula, tristique penatibus nisi eros nisl pede pharetra congue, 
aptent nulla, rhoncus tellus morbi, ornare. Magna condimentum erat turpis. 
Fusce arcu ve suscipit nisi phasellus rutrum a dictumst leo, laoreet dui, 
ultricies platea. Porta venenatis fringilla vestibulum arcu etiam condimentum 
non.</p>
<table border="1">
    {{ for row in rows }}
        <tr><td>{{=row['id']}}</td><td>{{=row['data']}}</td></tr>
    {{ endfor }}
</table>
""" >  applications/benchmark/views/tests/hellodb.html
python web2py.py -a chooseapassword &
open http://127.0.0.1:8000/benchmark/tests/hello
open http://127.0.0.1:8000/benchmark/tests/hellos
open http://127.0.0.1:8000/benchmark/tests/hellodb


I cant even debug it to work. It seems (for me) that web2py is too smart 
for me to do simple application :) Sorry for bothering you guys.

-Oj

On Monday, February 25, 2013 9:50:06 PM UTC+2, OJ wrote:
>
> Uh, beginners mistake... default.py had that same thing when learning by 
> examples. After this fix - comment out that troubling 
> @auth.requires_signature() I ran into more problems. Now it has  
>  db = sqlite3.connect(os.path.join(request.folder,'databases','hello.db'))
>
> NameError: global name 'os' is not defined
>
> After importing os (remember, still talking about Massimos patch for 
> framework shootout) once again new problem: 
>
> Traceback (most recent call last):
>   File "/Users/xxx/web2py/web2py/gluon/main.py", line 543, in wsgibase
>     serve_controller(request, response, session)
>   File "/Users/xxx/web2py/web2py/gluon/main.py", line 227, in 
> serve_controller
>     run_view_in(response._view_environment)
>   File "/Users/xxx/web2py/web2py/gluon/compileapp.py", line 672, in 
> run_view_in
>     context=environment)
>   File "/Users/xxx/web2py/web2py/gluon/template.py", line 785, in 
> parse_template
>     return str(TemplateParser(text, context=context, path=path, 
> lexers=lexers, delimiters=delimiters))
>   File "/Users/xxx/web2py/web2py/gluon/template.py", line 316, in __init__
>     self.parse(text)
>   File "/Users/xxx/web2py/web2py/gluon/template.py", line 756, in parse
>     self.extend(extend)
>   File "/Users/xxx/web2py/web2py/gluon/template.py", line 471, in extend
>     text = self._get_file_text(filename)
>   File "/Users/xxx/web2py/web2py/gluon/template.py", line 436, in 
> _get_file_text
>     filename = eval(filename, context)
>   File "<string>", line 1, in <module>
> NameError: name 'base' is not defined
>
> Which is much harder for me to fix - somehow.
>
> -Oj
>
>
>
> On Monday, February 25, 2013 4:57:17 PM UTC+2, OJ wrote:
>>
>> Yeah,
>>
>> Your example has a bug in it. I get:
>> "
>> <type 'exceptions.NameError'> name 'auth' is not defined
>>
>> Traceback (most recent call last):
>>   File "/Users/xxx/web2py/gluon/restricted.py", line 212, in restricted
>>     exec ccode in environment
>>   File "/Users/xxx/web2py/applications/benchmark/controllers/default.py" 
>> <http://localhost:8000/admin/default/edit/benchmark/controllers/default.py>, 
>> line 60, in <module>
>>     @auth.requires_signature()
>> NameError: name 'auth' is not defined
>>
>> "
>>
>> I think that Seth ran into same troubles when he tried your code.
>>
>> Best,
>>
>> Oj
>>
>>
>> On Tuesday, February 5, 2013 12:40:23 AM UTC+2, Massimo Di Pierro wrote:
>>>
>>> I did not find it myself the first time I looked. ;-)
>>>
>>> Notice I used sqlite api and not DAL to comare with bottle and flask 
>>> where the examples also use the sqlite api instead of SQLA.
>>>
>>> On Monday, 4 February 2013 15:04:07 UTC-6, OJ wrote:
>>>>
>>>> Hey Thanks Massimo!
>>>>
>>>> I didn't notice that one, sorry! I have to be careful, I know. I'll try 
>>>> to rule out (or measure) all possible moving parts. I fell in love with 
>>>> DAL 
>>>> therefore I took web2py to my agenda to do in 2013 in the first place. All 
>>>> "other" features has stunned me ever since I've moved to other parts of 
>>>> web2py :)
>>>>  
>>>> On Monday, February 4, 2013 10:52:33 PM UTC+2, Massimo Di Pierro wrote:
>>>>>
>>>>> This was my previous comment:
>>>>>
>>>>>     
>>>>> https://github.com/seedifferently/the-great-web-framework-shootout/issues/14
>>>>>
>>>>> Notice that some of the frameworks are using native sqlite api and 
>>>>> some are using ORMs. A comparison is difficult.
>>>>>
>>>>> On Monday, 4 February 2013 13:26:14 UTC-6, OJ wrote:
>>>>>>
>>>>>> I would gladly accept if anyone else could provide me web2py 
>>>>>> application with same spesifications as this shootout had. I would do it 
>>>>>> myself but it is unfair for web2py (I'm just getting to know it) if I 
>>>>>> would 
>>>>>> do it and test it with other frameworks :) 
>>>>>>
>>>>>> On Sunday, February 3, 2013 12:08:50 AM UTC+2, OJ wrote:
>>>>>>>
>>>>>>> Could you send it to me? Or did you mean that you don't have it 
>>>>>>> anymore :)
>>>>>>>
>>>>>>> I tried to contact the author about it, but haven't heard from him.
>>>>>>>
>>>>>>> On Saturday, February 2, 2013 10:40:36 PM UTC+2, Massimo Di Pierro 
>>>>>>> wrote:
>>>>>>>>
>>>>>>>> I do not recall. I do not see it there which is strange.
>>>>>>>>
>>>>>>>> On Saturday, 2 February 2013 05:24:05 UTC-6, OJ wrote:
>>>>>>>>>
>>>>>>>>> Massimo, where can I find your patch? I understood that you 
>>>>>>>>> submitted web2py -patch for the shootout. I'm currently interested to 
>>>>>>>>> see 
>>>>>>>>> how hw aspect would have effect to results and I need web2py to be 
>>>>>>>>> part of 
>>>>>>>>> it. 
>>>>>>>>>
>>>>>>>>> On Monday, February 20, 2012 3:51:36 PM UTC+2, Massimo Di Pierro 
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> I did submit a patch. I also submitted a comment on reddit. Those 
>>>>>>>>>> benchmarks are misleading. For example in Django they use the ORM 
>>>>>>>>>> but 
>>>>>>>>>> in Flask they use native sqlite, not SQLAlchemy. In Django I 
>>>>>>>>>> think 
>>>>>>>>>> they have sessions enabled, in Flask, I think no. 
>>>>>>>>>>
>>>>>>>>>> On Feb 19, 11:23 pm, Bruno Rocha <[email protected]> wrote: 
>>>>>>>>>> > I did not see web2py on the list... 
>>>>>>>>>> > Em 20/02/2012 03:03, "pbreit" <[email protected]> 
>>>>>>>>>> escreveu: 
>>>>>>>>>> > 
>>>>>>>>>> > 
>>>>>>>>>> > 
>>>>>>>>>> > 
>>>>>>>>>> > 
>>>>>>>>>> > 
>>>>>>>>>> > 
>>>>>>>>>> > >
>>>>>>>>>> http://blog.curiasolutions.com/the-great-web-framework-shootout/ 
>>>>>>>>>> > >
>>>>>>>>>> https://github.com/seedifferently/the-great-web-framework-shootout
>>>>>>>>>
>>>>>>>>>

-- 

--- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to