Re: [web2py] Howto populate table with data

2011-02-10 Thread Sascha Peilicke
On Friday 11 February 2011 03:10:01 Bruno Rocha wrote:
> Forget my last example,
> 
> This is the working code:
> 
> [ db.tag.insert(name=t) for t in TAGS if db(db.tag).count() <= len(TAGS) ]
> 
> The code that @vinicius posted works prefectly too
Thank you guys!
-- 
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com


signature.asc
Description: This is a digitally signed message part.


[web2py] authenticate against Active Directory - need some direction.

2011-02-10 Thread Panupat
Hi everyone.

In my application I need to authenticate users against windows active
directory using user name and password. The user's group is also
determined by the active directory group.

So far I was able to do so using a the ldap class directory and use
lsearch to compare the group.

Can the same be archive using web2py DAL? I'm sad to say that I have
absolutely no clue what to do with the 4 lines of the example codes
showed in the online book >.>


Re: [web2py] how does the default login page work?

2011-02-10 Thread pbreit
Most of the functionality is deep in gluon/tools.py:
http://code.google.com/p/web2py/source/browse/gluon/tools.py


[web2py] Re: JSON in templates

2011-02-10 Thread Dane
On a more general note, it seems like tighter and tighter integration
with the client and javascript, potentially even to the point of
making it a first class citizen like db, would perhaps be one of the
best directions web2py could go in my eyes.

On Feb 10, 11:14 pm, Dane  wrote:
> Hi,
>
> Is there any easy way to embed JSON directly into templates? I've been
> trying a bunch of different methods and nothing seems to work due to
> quote escaping. I'd rather not create a separate controller function
> or loop through JSON structure myself just to output a simple object.
> Ideas? This would be a very powerful feature if it worked
> straightforwardly. Thanks.
>
> -Dane


[web2py] JSON in templates

2011-02-10 Thread Dane
Hi,

Is there any easy way to embed JSON directly into templates? I've been
trying a bunch of different methods and nothing seems to work due to
quote escaping. I'd rather not create a separate controller function
or loop through JSON structure myself just to output a simple object.
Ideas? This would be a very powerful feature if it worked
straightforwardly. Thanks.

-Dane


Re: [web2py] changing default page?

2011-02-10 Thread Vinicius Assef
Name your application "init", but read this:
http://web2py.com/book/default/chapter/04#Routes-on-Error


On Fri, Feb 11, 2011 at 1:11 AM, Panupat  wrote:
> I'm sorry for this very simple questions but I can't seem to find the
> answer. How do I change the default page from welcome/default/index to
> my own applications?


Re: [web2py] changing default page?

2011-02-10 Thread rochacbruno
The simple way is renaming your app to 'init' 

Or you can use autoroutes or create your own route definition in routes.py

Enabling routes.py you can simply change the default_application to your app

Take a look at routes in /book or rename your app folder to 'init' 



Em 11/02/2011, às 01:11, Panupat  escreveu:

> I'm sorry for this very simple questions but I can't seem to find the
> answer. How do I change the default page from welcome/default/index to
> my own applications?


Re: [web2py] how does the default login page work?

2011-02-10 Thread rochacbruno
The layout is defined in views/default/user.html


Em 11/02/2011, às 01:13, Panupat  escreveu:

> Trying to learn how it works. I can't seem to find the layout or any
> code associated to it. Which files should I look at?


[web2py] how does the default login page work?

2011-02-10 Thread Panupat
Trying to learn how it works. I can't seem to find the layout or any
code associated to it. Which files should I look at?


[web2py] changing default page?

2011-02-10 Thread Panupat
I'm sorry for this very simple questions but I can't seem to find the
answer. How do I change the default page from welcome/default/index to
my own applications?


Re: [web2py] Web2py SOAP

2011-02-10 Thread Mariano Reingart
Do you mean xsd:struct?

It is not currently supported, but there are workarounds.

Look at this:

http://code.google.com/p/pysimplesoap/issues/detail?id=4

I have to review and implement some patches, if you are interested in
testing this let me know (if you can, comment on the ticket your
examples and so on).

BTW, multiple items can be mapped to python lists.

Regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com



On Thu, Feb 10, 2011 at 4:31 PM, Oskari  wrote:
> Hi!
>
> I'm building a SOAP interface with web2py. How can I return an array
> with that? I'm guessing its something like:
>
> @service.soap("test",args={},returns={'response':array}
>
> but that isn't recognised as a type. Any ideas?


Re: [web2py] URL anchor breaks routes

2011-02-10 Thread Jonathan Lundell
On Feb 10, 2011, at 6:27 PM, Jonathan Lundell wrote:
> 
> On Feb 10, 2011, at 5:16 PM, Plumo wrote:
>> so let's say I have mapped /init/default/about to /about
>> 
>> Then: URL(r=request, c='default', f='about', anchor='company')
>> will produce: /init/default/about#company 
>> instead of: /about#company
> 
> Post your routes_out, please.

(The reason I ask is that I'm writing unit tests for URL routing, and I want to 
reproduce the error.)

Re: [web2py] URL anchor breaks routes

2011-02-10 Thread Jonathan Lundell
On Feb 10, 2011, at 5:16 PM, Plumo wrote:
> so let's say I have mapped /init/default/about to /about
> 
> Then: URL(r=request, c='default', f='about', anchor='company')
> will produce: /init/default/about#company 
> instead of: /about#company

Post your routes_out, please.


Re: [web2py] Howto populate table with data

2011-02-10 Thread Bruno Rocha
Forget my last example,

This is the working code:

[ db.tag.insert(name=t) for t in TAGS if db(db.tag).count() <= len(TAGS) ]

The code that @vinicius posted works prefectly too


--
Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Howto populate table with data

2011-02-10 Thread rochacbruno
note that db.commit() is needed only in shell or external modules. 

Under web2py environment it is implícit executed. 

It can be simplified as:

[db.tag.insert(name=t) for t in TAGS if not db(db.tag).count()]

(guess it works, not tested)



Em 10/02/2011, às 22:41, Vinicius Assef  escreveu:

> Try  something like this: http://pastebin.com/6yWksPAU
> 
> 
> On Thu, Feb 10, 2011 at 9:36 PM, Marin Pranjic  
> wrote:
>> Add this after define_table
>> for t in TAGS:
>> ... db.tag.insert(name = t)
>> 
>> run once and then comment / delete the lines.
>> 
>> On Thu, Feb 10, 2011 at 10:57 PM, Sascha Peilicke  wrote:
>>> 
>>> Hi guys,
>>> 
>>> I'd like to know how to best populate a table with a given set of default
>>> values. I could add them manually via the shell, but I'd like it to be
>>> done
>>> when the table is created. Let's consider the following table:
>>> 
>>> db.define_table('tag',
>>>Field('name'),
>>>format='%(name)s')
>>> 
>>> And assume I got some tags:
>>> 
>>> TAGS = ['nice','great','awesome']
>>> 
>>> So, how's the most appropriate way in getting those tags into the table?
>>> --
>>> Mit freundlichen Grüßen,
>>> Sascha Peilicke
>>> http://saschpe.wordpress.com
>> 
>> 


[web2py] Re: Authorization to create/update an item

2011-02-10 Thread villas
Unfortunately you cannot avoid having to bury your head in the
Authorization section of the book for a while  :-)

The auth system can work at different levels. I guess most developers
find a way of allocating permissions to groups.  Then they put their
users into those groups.

The permissions work best when used as decorators for functions. For
that reason you may for example decide to have separate functions for
create and update, to keep your permissions (and code) clearer.  You
just have to think through which group can do what.  It is a tricky
process and depends totally on your own circumstances,  so it's
difficult for anyone on the list to give you specific advice.

I admit I am not an expert in this,  but I know enough to realise
there are no shortcuts to understanding it and the book gives enough
info to get things going.

Best wishes,
David


On Feb 10, 8:39 pm, pbreit  wrote:
> Probably true that I don't understand the auth stuff very well. Do I use
> groups? Is that why each user has it's own unique group? Do I assign a write
> permission for a group on a specific and thus only that logged-in-user can
> edit the record?
>
> There's some documentation like that when using CRUD but I'm probably not
> going to use CRUD since I'd like more flexibility. Would I still set it up
> like that, though?
>
> This would seem to be the heart of any application but it's hard to figure
> out how to implement (for me at least). Most of the examples I see seem to
> provide any logged in user with access to everything.


Re: [web2py] URL anchor breaks routes

2011-02-10 Thread Plumo
so let's say I have mapped /init/default/about to /about

Then: URL(r=request, c='default', f='about', anchor='company')
will produce: /init/default/about#company 
instead of: /about#company


[web2py] Re: Web2py and Sencha (Extjs)

2011-02-10 Thread mikech
Sadly only on Apple at the moment

[web2py] Re: Web2py and Sencha (Extjs)

2011-02-10 Thread mikech
Thanks for bringing that to my attention.  Have you used it with web2py?




Re: [web2py] Howto populate table with data

2011-02-10 Thread Vinicius Assef
Try  something like this: http://pastebin.com/6yWksPAU


On Thu, Feb 10, 2011 at 9:36 PM, Marin Pranjic  wrote:
> Add this after define_table
> for t in TAGS:
> ... db.tag.insert(name = t)
>
> run once and then comment / delete the lines.
>
> On Thu, Feb 10, 2011 at 10:57 PM, Sascha Peilicke  wrote:
>>
>> Hi guys,
>>
>> I'd like to know how to best populate a table with a given set of default
>> values. I could add them manually via the shell, but I'd like it to be
>> done
>> when the table is created. Let's consider the following table:
>>
>> db.define_table('tag',
>>    Field('name'),
>>    format='%(name)s')
>>
>> And assume I got some tags:
>>
>> TAGS = ['nice','great','awesome']
>>
>> So, how's the most appropriate way in getting those tags into the table?
>> --
>> Mit freundlichen Grüßen,
>> Sascha Peilicke
>> http://saschpe.wordpress.com
>
>


Re: [web2py] Re: auth.signature

2011-02-10 Thread Vinicius Assef
Another suggestion.

Let's keep consistence.

If you have 'created_on' and 'created_by', what about 'updated_on' and
'updated_by'?

--
Vinicius Assef.


On Tue, Feb 8, 2011 at 6:39 PM, villas  wrote:
> For those intrigued and cannot update to trunk right now, it creates
> some extra fields...
>
> ['id', 'whatever', 'created_on', 'created_by', 'modified_on',
> 'updated_by']
>
> Nice shortcut, but I never guessed from the name 'auth.signature' what
> it would do.
> Maybe a different name would be clearer?  e.g. 'auth.rectimestamp'


Re: [web2py] Run the ultra-marathon along with web2py

2011-02-10 Thread Vinicius Assef
Thank you, man. ;-)

On Wed, Feb 9, 2011 at 3:20 PM, Bruno Rocha  wrote:
> @viniciusban wrote an excellent post about web2py, I reddited (waiting
> comments)
> http://www.reddit.com/r/Python/comments/fi4an/run_the_ultramarathon_along_with_web2py/
>
>
> --
> Bruno Rocha
> http://about.me/rochacbruno/bio
>


[web2py] Re: integration of jquery's ui themes into web2py's default layout/css?

2011-02-10 Thread Carlos
Hi Massimo,

As far as I've tested, the following css must be applied after loading both 
css files (web2py's default + jqueryui's smoothness):

   .ui-widget, .ui-widget-content, .ui-widget-header, .ui-widget input, 
.ui-widget select, .ui-widget textarea, .ui-widget button { font:13px/1.231 
sans-serif; font-size: 100%; color: #444; }
   .ui-button-text-only .ui-button-text { padding: 0 1em; }

Take care,

   Carlos



Re: [web2py] Howto populate table with data

2011-02-10 Thread Marin Pranjic
Add this after define_table

for t in TAGS:
... db.tag.insert(name = t)


run once and then comment / delete the lines.

On Thu, Feb 10, 2011 at 10:57 PM, Sascha Peilicke  wrote:

> Hi guys,
>
> I'd like to know how to best populate a table with a given set of default
> values. I could add them manually via the shell, but I'd like it to be done
> when the table is created. Let's consider the following table:
>
> db.define_table('tag',
>Field('name'),
>format='%(name)s')
>
> And assume I got some tags:
>
> TAGS = ['nice','great','awesome']
>
> So, how's the most appropriate way in getting those tags into the table?
> --
> Mit freundlichen Grüßen,
> Sascha Peilicke
> http://saschpe.wordpress.com
>


[web2py] Howto populate table with data

2011-02-10 Thread Sascha Peilicke
Hi guys,

I'd like to know how to best populate a table with a given set of default 
values. I could add them manually via the shell, but I'd like it to be done 
when the table is created. Let's consider the following table:

db.define_table('tag',
Field('name'),
format='%(name)s')

And assume I got some tags:

TAGS = ['nice','great','awesome']

So, how's the most appropriate way in getting those tags into the table?
-- 
Mit freundlichen Grüßen,
Sascha Peilicke
http://saschpe.wordpress.com


signature.asc
Description: This is a digitally signed message part.


[web2py] WSGI + shared host

2011-02-10 Thread Nico
Hey peeps !

I have simple question Since web2py doesnt need any installation
and i want to run it on my shared host... how can i "set it up"...

I contacted my host, they moved my acc on another server where they
support wsgi and they asked me for the path... i told them, the path
to the script is...

/home/nico/public_html/dev/web2py/wsgihandler.py

or

mydomain.xxx/dev/web2py/wsgihandler

So... They set it up, so in "dev" directory wsgi scripts should work
but it doesnt...

See what it says here:

http://cvrtnjak.com/dev/
or http://cvrtnjak.com/dev/web2py



Did they do something wrong or ?
Any suggestions :) ?


[web2py] Web2py SOAP

2011-02-10 Thread Oskari
Hi!

I'm building a SOAP interface with web2py. How can I return an array
with that? I'm guessing its something like:

@service.soap("test",args={},returns={'response':array}

but that isn't recognised as a type. Any ideas?


[web2py] Re: Use web2py to run trac anywhere (portable trac)

2011-02-10 Thread Massimo Di Pierro
You can use any normal python package with web2py. The binary
distribution works as well as portable python did (no more, no less).

On Feb 10, 3:32 pm, pbreit  wrote:
> Web2py comes with a built-in webserver and SQLite but it's really designed
> to run the web2py Python web framework, not random Python packages.


[web2py] Re: web2py layouts

2011-02-10 Thread Massimo Di Pierro
Now I understand. These are plugins, not apps. You need an existing
app and apply them from the design page of the existing app as plugins
(form is at the bottom).
They do not contain any login (models/controllers).

On Feb 10, 12:56 pm, stargate  wrote:
> Its most of them I have downloaded and tired.  If you have step by
> step instructions i could be doing something wrong.  Thanks
>
> On Feb 10, 12:10 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Are you usinghttp://web2py.com/layouts?Doyou have a problem with
> > this one only?
>
> > On Feb 10, 9:54 am, stargate  wrote:
>
> > > I tried installing the Simpletex layout but i try to view it and it
> > > says invalid controller (default/index).  So i am not sure what are
> > > the steps to installing these sample layouts.


[web2py] Re: Cache.disk() expiring unexpectedly

2011-02-10 Thread Dane
Thanks, make sense.

This could use a bit better explanation in the book.

On Feb 10, 9:23 am, Massimo Di Pierro 
wrote:
> The problem is here:
>
> cached = cache.disk(cache_key, lambda:None)
>
> The expiration time is not set by the initial call but it is set but
> each retrieve call. It is the retrieve call above that decided whether
> the stored value should be considered expired or not. Since you are
> not specifying a time expire you get the default 300seconds (5
> minutes) and then you override it the return of lambda:None, i.e.
> None. Should be:
>
> cached = cache.disk(cache_key, lambda:None, None)
>
> On Feb 10, 6:17 am, Dane  wrote:
>
>
>
>
>
>
>
> > I'm trying to use cache.disk to cache a large TABLE object
> > indefinitely. It seems to work fine at first, but then expires after a
> > couple minutes.
>
> > I'm setting it like this:
>
> > cache.disk.clear('^%s$' % cache_key)
> > cache.disk(cache_key, lambda:grid, None)
>
> > *(I also tried 10**10 instead of None for duration with same result)
>
> > And I'm accessing like this:
>
> > cached = cache.disk(cache_key, lambda:None)
> > if cached: return cached
>
> > -Dane


[web2py] Re: Test if client has javascript

2011-02-10 Thread ma...@rockiger.com
Thanks for the tip. But I doubt that this is faster than making the 
database-request, imo.

Re: [web2py] Test if client has javascript

2011-02-10 Thread ma...@rockiger.com
Thanks for the clarification. 

[web2py] Re: Use web2py to run trac anywhere (portable trac)

2011-02-10 Thread pbreit
Web2py comes with a built-in webserver and SQLite but it's really designed 
to run the web2py Python web framework, not random Python packages.

[web2py] Re: Use web2py to run trac anywhere (portable trac)

2011-02-10 Thread Salvor Hardin
On Feb 9, 1:26 pm, pbreit  wrote:
> Try PortablePython:http://www.portablepython.com/

portablepython project looked dead, which is why I turned to web2py.

web2py was suggested on stackoverflow.com as an alternative to
portablepython, py2exe, etc.

FWIW, I decided to run redmine instead of trac because of overwhelming
recommendations on stackoverflow.com.


Re: [web2py] Re: custom form without using database?

2011-02-10 Thread rochacbruno
I use __ because I like to return locals() instead of a dict()



Em 10/02/2011, às 18:53, pbreit  escreveu:

> Why do you use all the underscores? Is it because those variables are 
> reserved words? Does it make the variables private or something?


[web2py] Re: custom form without using database?

2011-02-10 Thread pbreit
Why do you use all the underscores? Is it because those variables are 
reserved words? Does it make the variables private or something?

[web2py] Re: Authorization to create/update an item

2011-02-10 Thread pbreit
Probably true that I don't understand the auth stuff very well. Do I use 
groups? Is that why each user has it's own unique group? Do I assign a write 
permission for a group on a specific and thus only that logged-in-user can 
edit the record?

There's some documentation like that when using CRUD but I'm probably not 
going to use CRUD since I'd like more flexibility. Would I still set it up 
like that, though?

This would seem to be the heart of any application but it's hard to figure 
out how to implement (for me at least). Most of the examples I see seem to 
provide any logged in user with access to everything.


Re: [web2py] GAE and oauth LinkedIn

2011-02-10 Thread Michele Comitini
I did not test it on GAE but should work

http://code.google.com/r/michelecomitini-facebookaccess/source/browse/#hg%2Fapplications%2FlinkedInOauth

mic

2011/2/10 Carl :
> Has anyone successfully got this running on dev_appserver and GAE?


[web2py] change_password form

2011-02-10 Thread David J.

I noticed that the change password form is not obeying the "formstyle" value

in gluon tools.py

If you see the change_password() function

you see

form = form_factory(
Field('old_password', 'password',
label=self.messages.old_password,
requires=validators(
 table_user[passfield].requires,
 IS_IN_DB(s, '%s.%s' % (usern, passfield),
  
error_message=self.messages.invalid_password))),

Field('new_password', 'password',
label=self.messages.new_password,
requires=table_user[passfield].requires),
Field('new_password2', 'password',
label=self.messages.verify_password,
requires=[IS_EXPR('value==%s' % 
repr(request.vars.new_password),

  self.messages.mismatched_password)]),
submit_button=self.messages.submit_button
)

I added the following line; But I am not sure if it works yet;

form.formstyle = self.settings.formstyle




[web2py] GAE and sending email

2011-02-10 Thread Gary Bee
I am successfully sending an email from my web2py app hosted on GAE:

 mail.send(to=['webs...@rtplanb.com'],reply_to=form.vars.email,
   subject=form.vars.Name+' from '+form.vars.Organisation
+' Website Enquiry ',
   message=form.vars.email+' wrote '+form.vars.Enquiry)

My problem is that when I get the email the reply to field seems to be
ignored? I have added the website visitors email to the message to get
around this but it isnt ideal.
Any ideas?


Re: [web2py] Re: Apache, Wsgi problem

2011-02-10 Thread Jonathan Lundell


On Feb 10, 2011, at 11:18 AM, VP  wrote:

> The modules I used are all standard via installation with apt-get.
> 
> Python is 2.5.2, and psycopg2 is 2.0.7
> 

Upgrade psycopg2 to at least 2.0.8 and see if that doesn't fix the fault.

> On Feb 10, 9:58 am, Jonathan Lundell  wrote:
>> Good work.
>> 
>> You mentioned that you're using Debian Lenny. What version of Python? 2.5.2?
>> 
>> And what version of psycopg2?
>> 
>> On Feb 9, 2011, at 10:38 PM, VP wrote:
>> 
>> 
>> 
>>> Alright people short answer:  I think I figured this out (at least
>>> with my configuration)
>> 
>>> After testing various configurations, here's the result with: ab -kc
>>> 100 -t 20https://domain.com/imageblog/default/index/  (same
>>> imageblog app, 100 connections, 20 seconds stress test).
>> 
>>> Two things you will notice with this result.
>> 
>>> 1.  ZERO failed request.   No more wsgi premature script error
>>> 2.  Complete requests is 1234, 61 requests/second on average.
>>>Compare to prior configuration:  588 total requests, 29 requests/
>>> sec on average.  Not to mention 15 failed requests due to wsgi
>>> premature script errors!!!
>> 
>>> This is insane!!!
>> 
>>> So how did I configure this?   here it is:
>> 
>>>  WSGIDaemonProcess web2py user=username group=username \
>>>   display-name=%{GROUP} processes=5 threads=1
>> 
>>> The important option being 5 processes, 1 thread.
>> 
>>> With this configuration, my real app also did not get wsgi premature
>>> script errors anymore.  And guess what... the requests/sec
>>> triples
>> 
>>> I am still curious about this.  While my real app can possibly be not
>>> thread-safe, but the imageblog app should be thread safe (the index
>>> was simply a listing of images, i.e. read only).  Why would there be a
>>> problem with more than 1 thread?
>> 
>>> 
>> 
>>> Document Path:  /imageblog/default/index
>>> Document Length:13083 bytes
>> 
>>> Concurrency Level:  100
>>> Time taken for tests:   20.008 seconds
>>> Complete requests:  1234
>>> Failed requests:0
>>> Write errors:   0
>>> Keep-Alive requests:1234
>>> Total transferred:  16827432 bytes
>>> HTML transferred:   16171262 bytes
>>> Requests per second:61.68 [#/sec] (mean)
>>> Time per request:   1621.377 [ms] (mean)
>>> Time per request:   16.214 [ms] (mean, across all concurrent
>>> requests)
>>> Transfer rate:  821.33 [Kbytes/sec] received
>> 
>>> Connection Times (ms)
>>>  min  mean[+/-sd] median   max
>>> Connect:01   9.4  0  73
>>> Processing:82  481 890.53175475
>>> Waiting:   76  443 878.72745393
>>> Total: 82  483 894.73175503
>> 
>>> Percentage of the requests served within a certain time (ms)
>>>  50%317
>>>  66%342
>>>  75%360
>>>  80%372
>>>  90%416
>>>  95%489
>>>  98%   5351
>>>  99%   5397
>>> 100%   5503 (longest request)
>>> 
>> 
>> 


[web2py] Re: Apache, Wsgi problem

2011-02-10 Thread VP
The modules I used are all standard via installation with apt-get.

Python is 2.5.2, and psycopg2 is 2.0.7

On Feb 10, 9:58 am, Jonathan Lundell  wrote:
> Good work.
>
> You mentioned that you're using Debian Lenny. What version of Python? 2.5.2?
>
> And what version of psycopg2?
>
> On Feb 9, 2011, at 10:38 PM, VP wrote:
>
>
>
> > Alright people short answer:  I think I figured this out (at least
> > with my configuration)
>
> > After testing various configurations, here's the result with: ab -kc
> > 100 -t 20https://domain.com/imageblog/default/index/  (same
> > imageblog app, 100 connections, 20 seconds stress test).
>
> > Two things you will notice with this result.
>
> > 1.  ZERO failed request.   No more wsgi premature script error
> > 2.  Complete requests is 1234, 61 requests/second on average.
> >    Compare to prior configuration:  588 total requests, 29 requests/
> > sec on average.  Not to mention 15 failed requests due to wsgi
> > premature script errors!!!
>
> > This is insane!!!
>
> > So how did I configure this?   here it is:
>
> >  WSGIDaemonProcess web2py user=username group=username \
> >                           display-name=%{GROUP} processes=5 threads=1
>
> > The important option being 5 processes, 1 thread.
>
> > With this configuration, my real app also did not get wsgi premature
> > script errors anymore.  And guess what... the requests/sec
> > triples
>
> > I am still curious about this.  While my real app can possibly be not
> > thread-safe, but the imageblog app should be thread safe (the index
> > was simply a listing of images, i.e. read only).  Why would there be a
> > problem with more than 1 thread?
>
> > 
>
> > Document Path:          /imageblog/default/index
> > Document Length:        13083 bytes
>
> > Concurrency Level:      100
> > Time taken for tests:   20.008 seconds
> > Complete requests:      1234
> > Failed requests:        0
> > Write errors:           0
> > Keep-Alive requests:    1234
> > Total transferred:      16827432 bytes
> > HTML transferred:       16171262 bytes
> > Requests per second:    61.68 [#/sec] (mean)
> > Time per request:       1621.377 [ms] (mean)
> > Time per request:       16.214 [ms] (mean, across all concurrent
> > requests)
> > Transfer rate:          821.33 [Kbytes/sec] received
>
> > Connection Times (ms)
> >              min  mean[+/-sd] median   max
> > Connect:        0    1   9.4      0      73
> > Processing:    82  481 890.5    317    5475
> > Waiting:       76  443 878.7    274    5393
> > Total:         82  483 894.7    317    5503
>
> > Percentage of the requests served within a certain time (ms)
> >  50%    317
> >  66%    342
> >  75%    360
> >  80%    372
> >  90%    416
> >  95%    489
> >  98%   5351
> >  99%   5397
> > 100%   5503 (longest request)
> > 
>
>


Re: [web2py] Re: Book needs to be updated

2011-02-10 Thread Anthony
On Thursday, February 10, 2011 9:50:27 AM UTC-5, Richard wrote: 
>
> Yes I agree... I remove all my bookmarks and put them in Bookmarks... ;-)

 
Actually, the easiest and cleanest thing to do is go to the settings menu, 
select Tools, and uncheck the "Always show bookmarks bar" option (or just 
hit CTRL+SHIFT+B to toggle the bar off). You should also go to Tools > 
Extensions and disable all of your extensions so their icons don't appear in 
the upper right, next to the address bar.
 

> Do you know if Chrome has profile like firefox? And how to boot Chrome with 
> an other profile??
>
 
Not sure about that.
 
Anthony


[web2py] Re: web2py layouts

2011-02-10 Thread stargate
Its most of them I have downloaded and tired.  If you have step by
step instructions i could be doing something wrong.  Thanks

On Feb 10, 12:10 pm, Massimo Di Pierro 
wrote:
> Are you usinghttp://web2py.com/layouts?Do you have a problem with
> this one only?
>
> On Feb 10, 9:54 am, stargate  wrote:
>
> > I tried installing the Simpletex layout but i try to view it and it
> > says invalid controller (default/index).  So i am not sure what are
> > the steps to installing these sample layouts.
>
>


[web2py] Re: jQuery Tools

2011-02-10 Thread Carlos
Hi Bruno,

What should I do in my web2py app in order to integrate jQuery Tools?.

Should I make specific changes or adding it to response.files is enough?.

I was also reviewing jQuery UI, but jQuery Tools seems to be more 
'professional' looking.

Based on your experience, which one is most powerful and easy to 
use/integrate?.

Thanks!,

   Carlos



[web2py] GAE and oauth LinkedIn

2011-02-10 Thread Carl
Has anyone successfully got this running on dev_appserver and GAE?


[web2py] Re: custom form without using database?

2011-02-10 Thread villas
Hi Panupat,
No problem, web2py has so many useful features they are sometimes
overlooked - especially by me!
Anyhow I hope it will at least reduce some of the complexity for
you :)
-D

On Feb 10, 5:11 pm, Panupat Chongstitwattana 
wrote:
> Hi Villas
>
> I'm sorry, I see what you meant now. I wasn't aware of the factory
> feature before
>
> :)
>
> On Thu, Feb 10, 2011 at 11:52 PM, villas  wrote:
> > On Feb 10, 1:16 pm, Panupat  wrote:
> >> Villas - I have read the book. The form.custom only works with SQLFORM
> >> and crud. I cannot use that same method with FORM.
>
> > Hi Panupat,
>
> > I reread your original post again and I notice that your initial
> > comment was: "In the book only mentioned how to use custom form with
> > pre-defined database".
>
> > Your assumption in that comment does not seem correct because I make
> > forms without any database tables by using SQLFORM.factory.
>
> > Best wishes
> > David
>
>


Re: [web2py] Re: custom form without using database?

2011-02-10 Thread Panupat Chongstitwattana
Hi Villas

I'm sorry, I see what you meant now. I wasn't aware of the factory
feature before

:)

On Thu, Feb 10, 2011 at 11:52 PM, villas  wrote:
> On Feb 10, 1:16 pm, Panupat  wrote:
>> Villas - I have read the book. The form.custom only works with SQLFORM
>> and crud. I cannot use that same method with FORM.
>
> Hi Panupat,
>
> I reread your original post again and I notice that your initial
> comment was: "In the book only mentioned how to use custom form with
> pre-defined database".
>
> Your assumption in that comment does not seem correct because I make
> forms without any database tables by using SQLFORM.factory.
>
> Best wishes
> David


[web2py] Re: web2py layouts

2011-02-10 Thread Massimo Di Pierro
Are you using http://web2py.com/layouts? Do you have a problem with
this one only?

On Feb 10, 9:54 am, stargate  wrote:
> I tried installing the Simpletex layout but i try to view it and it
> says invalid controller (default/index).  So i am not sure what are
> the steps to installing these sample layouts.


[web2py] Re: custom form without using database?

2011-02-10 Thread villas
On Feb 10, 1:16 pm, Panupat  wrote:
> Villas - I have read the book. The form.custom only works with SQLFORM
> and crud. I cannot use that same method with FORM.

Hi Panupat,

I reread your original post again and I notice that your initial
comment was: "In the book only mentioned how to use custom form with
pre-defined database".

Your assumption in that comment does not seem correct because I make
forms without any database tables by using SQLFORM.factory.

Best wishes
David


[web2py] Re: custom form without using database?

2011-02-10 Thread Panupat
How do I add css class,id or java onClick etc to the tags?

On Feb 10, 8:44 pm, Bruno Rocha  wrote:
> You can use TAG.dd() , TAG.dl()
>
> here is a working MVC example for a customized contact form, which sends an
> email
>
> http://pastebin.com/jTbGQNZk
>
> --
> Bruno Rochahttp://about.me/rochacbruno/bio


Re: [web2py] Re: Apache, Wsgi problem

2011-02-10 Thread Jonathan Lundell
Good work.

You mentioned that you're using Debian Lenny. What version of Python? 2.5.2?

And what version of psycopg2?



On Feb 9, 2011, at 10:38 PM, VP wrote:
> 
> 
> Alright people short answer:  I think I figured this out (at least
> with my configuration)
> 
> After testing various configurations, here's the result with: ab -kc
> 100 -t 20 https://domain.com/imageblog/default/index/   (same
> imageblog app, 100 connections, 20 seconds stress test).
> 
> Two things you will notice with this result.
> 
> 1.  ZERO failed request.   No more wsgi premature script error
> 2.  Complete requests is 1234, 61 requests/second on average.
>Compare to prior configuration:  588 total requests, 29 requests/
> sec on average.  Not to mention 15 failed requests due to wsgi
> premature script errors!!!
> 
> This is insane!!!
> 
> So how did I configure this?   here it is:
> 
>  WSGIDaemonProcess web2py user=username group=username \
>   display-name=%{GROUP} processes=5 threads=1
> 
> 
> The important option being 5 processes, 1 thread.
> 
> With this configuration, my real app also did not get wsgi premature
> script errors anymore.  And guess what... the requests/sec
> triples
> 
> 
> I am still curious about this.  While my real app can possibly be not
> thread-safe, but the imageblog app should be thread safe (the index
> was simply a listing of images, i.e. read only).  Why would there be a
> problem with more than 1 thread?
> 
> 
> 
> 
> 
> Document Path:  /imageblog/default/index
> Document Length:13083 bytes
> 
> Concurrency Level:  100
> Time taken for tests:   20.008 seconds
> Complete requests:  1234
> Failed requests:0
> Write errors:   0
> Keep-Alive requests:1234
> Total transferred:  16827432 bytes
> HTML transferred:   16171262 bytes
> Requests per second:61.68 [#/sec] (mean)
> Time per request:   1621.377 [ms] (mean)
> Time per request:   16.214 [ms] (mean, across all concurrent
> requests)
> Transfer rate:  821.33 [Kbytes/sec] received
> 
> Connection Times (ms)
>  min  mean[+/-sd] median   max
> Connect:01   9.4  0  73
> Processing:82  481 890.53175475
> Waiting:   76  443 878.72745393
> Total: 82  483 894.73175503
> 
> Percentage of the requests served within a certain time (ms)
>  50%317
>  66%342
>  75%360
>  80%372
>  90%416
>  95%489
>  98%   5351
>  99%   5397
> 100%   5503 (longest request)
> 






[web2py] web2py layouts

2011-02-10 Thread stargate
I tried installing the Simpletex layout but i try to view it and it
says invalid controller (default/index).  So i am not sure what are
the steps to installing these sample layouts.



Re: [web2py] Re: Book needs to be updated

2011-02-10 Thread Richard Vézina
Yes I agree... I remove all my bookmarks and put them in Bookmarks... ;-)

Do you know if Chrome has profile like firefox? And how to boot Chrome with
an other profile??

I realise also that for most of screenshots already in book the navigator
windows was shrinked when needed so there is no need for a frame to be
added...

I can't reproduce some of the screenshot with Massimo on it for example ;-)

Richard





On Wed, Feb 9, 2011 at 11:25 PM, Anthony  wrote:

> Thanks, Richard. A couple suggestions:
>
>- All images should be captured without including the mouse pointer in
>the image.
>- The browser chrome should be kept as generic as possible, so you
>should hide the "Bookmarks" and "Autres Favoris" toolbars as well as the
>Google Chrome extensions you have installed.
>
> Before proceeding further, perhaps we should settle on a theme/layout for
> the screenshots, as cjrh mentioned. If multiple people will be taking
> screenshots, we'll also need to settle on a common browser/platform that
> will look the same from user to user. If that's not practical, maybe one
> person will have to do them all.
>
> Best,
> Anthony
>
> On Wednesday, February 9, 2011 10:47:04 PM UTC-5, Richard wrote:
>
>> Hello,
>>
>> Here 16 images of chapter 3. Waiting for comment to continue and bit tired
>> ;-)
>>
>> See attach zip.
>>
>> Richard
>>
>> On Wed, Feb 9, 2011 at 9:29 PM, Richard Vézina wrote:
>>
>>> @cjrh
>>>
>>> I can make capture and crop and you script the frame with PIL... How it
>>> sounds?
>>>
>>> I think all the interested person can all pick a chapter
>>>
>>> 00 : 0
>>> 01 : 4
>>> 02 : 0
>>> 03 : 48
>>> 04 : 1
>>> 05 : 0
>>> 06 : 0
>>> 07 : 9
>>> 08 : 2
>>> 09 : 0
>>> 10 : 9
>>> 11 : 4 (not sure they needs update)
>>> 12 : 0
>>> 13 : 12
>>>
>>> I take the big one : 03
>>>
>>> And see how it progress...
>>>
>>> Richard
>>>
>>> On Wed, Feb 9, 2011 at 8:14 PM, stargate  wrote:
>>>
 Let me know if I can be of any help

 On Feb 9, 5:18 pm, cjrh  wrote:

 > On Feb 9, 9:01 pm, Richard Vézina  wrote:
 >
 > > We can put a frame around the screenshot... But it will make harder
 to have
 > > unity between screenshot if it not the same person that make all of
 them...
 >
 > Good idea for frame.  Multiple people can make screenshots (e.g. let's
 > say Massimo assigns a captain to each chapter, and they manage the
 > work) but I still say that we must make a special theme/layout to be
 > used for book screenshots, and the layout/theme must be shared with
 > all the captains, so that the theming of all the screenshots is
 > correct.
 >
 > > Or we can make a script in gimp for cropping.
 >
 > Sure, that kind of thing is no problem, I would actually prefer to use
 > PIL over Gimp.

>>>
>>>
>>


[web2py] Re: Web2py and Sencha (Extjs)

2011-02-10 Thread stargate
Well Sencha Touch its pretty bloated and can be slow at times for
loading on a mobile device.  Your best bet is to look at 
http://www.phonegap.com/


On Feb 9, 8:09 pm, mikech  wrote:
> Has anyone looked at the recent Extjs developements or Sencha Touch?  I'm
> nowhere ready to do this, but would it be fairly simple to make use of this
> library.  It seems to have a very complete set of business type widgets.  
> Is anyone using it?
>
> Mike


[web2py] Re: Cache.disk() expiring unexpectedly

2011-02-10 Thread Massimo Di Pierro
The problem is here:

cached = cache.disk(cache_key, lambda:None)

The expiration time is not set by the initial call but it is set but
each retrieve call. It is the retrieve call above that decided whether
the stored value should be considered expired or not. Since you are
not specifying a time expire you get the default 300seconds (5
minutes) and then you override it the return of lambda:None, i.e.
None. Should be:

cached = cache.disk(cache_key, lambda:None, None)


On Feb 10, 6:17 am, Dane  wrote:
> I'm trying to use cache.disk to cache a large TABLE object
> indefinitely. It seems to work fine at first, but then expires after a
> couple minutes.
>
> I'm setting it like this:
>
> cache.disk.clear('^%s$' % cache_key)
> cache.disk(cache_key, lambda:grid, None)
>
> *(I also tried 10**10 instead of None for duration with same result)
>
> And I'm accessing like this:
>
> cached = cache.disk(cache_key, lambda:None)
> if cached: return cached
>
> -Dane


[web2py] Re: Apache, Wsgi problem

2011-02-10 Thread Massimo Di Pierro
I offer $300 to whoever can identify within 3 weeks and without
ambiguity the cause of this problem. The bounty applies even if the
problem turns out to be not in web2py but in one of the Python
modules, in Apache or in the mod_wsgi implementation. It does not
apply if the problem is due to known bug that has already been fixed
by the responsible party (for example if you are using an old un-
patched python version like 2.5.0 or an old mod_wsgi version).



On Feb 10, 12:38 am, VP  wrote:
> Alright people short answer:  I think I figured this out (at least
> with my configuration)
>
> After testing various configurations, here's the result with: ab -kc
> 100 -t 20https://domain.com/imageblog/default/index/  (same
> imageblog app, 100 connections, 20 seconds stress test).
>
> Two things you will notice with this result.
>
> 1.  ZERO failed request.   No more wsgi premature script error
> 2.  Complete requests is 1234, 61 requests/second on average.
>     Compare to prior configuration:  588 total requests, 29 requests/
> sec on average.  Not to mention 15 failed requests due to wsgi
> premature script errors!!!
>
> This is insane!!!
>
> So how did I configure this?   here it is:
>
>   WSGIDaemonProcess web2py user=username group=username \
>                            display-name=%{GROUP} processes=5 threads=1
>
> The important option being 5 processes, 1 thread.
>
> With this configuration, my real app also did not get wsgi premature
> script errors anymore.  And guess what... the requests/sec
> triples
>
> I am still curious about this.  While my real app can possibly be not
> thread-safe, but the imageblog app should be thread safe (the index
> was simply a listing of images, i.e. read only).  Why would there be a
> problem with more than 1 thread?
>
> 
>
> Document Path:          /imageblog/default/index
> Document Length:        13083 bytes
>
> Concurrency Level:      100
> Time taken for tests:   20.008 seconds
> Complete requests:      1234
> Failed requests:        0
> Write errors:           0
> Keep-Alive requests:    1234
> Total transferred:      16827432 bytes
> HTML transferred:       16171262 bytes
> Requests per second:    61.68 [#/sec] (mean)
> Time per request:       1621.377 [ms] (mean)
> Time per request:       16.214 [ms] (mean, across all concurrent
> requests)
> Transfer rate:          821.33 [Kbytes/sec] received
>
> Connection Times (ms)
>               min  mean[+/-sd] median   max
> Connect:        0    1   9.4      0      73
> Processing:    82  481 890.5    317    5475
> Waiting:       76  443 878.7    274    5393
> Total:         82  483 894.7    317    5503
>
> Percentage of the requests served within a certain time (ms)
>   50%    317
>   66%    342
>   75%    360
>   80%    372
>   90%    416
>   95%    489
>   98%   5351
>   99%   5397
>  100%   5503 (longest request)
> 


Re: [web2py] Re: custom form without using database?

2011-02-10 Thread Bruno Rocha
You can use TAG.dd() , TAG.dl()

here is a working MVC example for a customized contact form, which sends an
email

http://pastebin.com/jTbGQNZk



--
Bruno Rocha
http://about.me/rochacbruno/bio


Re: [web2py] Re: custom form without using database?

2011-02-10 Thread Panupat Chongstitwattana
Thanks Bruno the DIV(FORM()) trick is really nice.

Too bad there's no dd, dt, dl which is what I usually use for form
layouts. I guess I can always manually append them in.



On Thu, Feb 10, 2011 at 8:32 PM, Bruno Rocha  wrote:
>> Anyone know what properties I can call to get the hidden fields?
>
> Using SQLFORM you have form.hidden_fields()
> but using FORM you need to use Server side DOM and Parsing
> #
> # Create a form with hidden elements
 form =
 FORM(INPUT(_type='hidden',_value='secret'),INPUT(_type='hidden',_value='secret2'))
 print form
>  type="hidden" value="secret" /> />
> #Get the hidden elements
 form.elements(_type='hidden')
> [,  0xa3592ec>]
> #Get by its index
 form.elements(_type='hidden')[0]
> 
> # each one
 print form.elements(_type='hidden')[0]
> 
 print form.elements(_type='hidden')[1]
> 
> #iterate
 for element in form.elements(_type='hidden'): print element
> ...
> 
> 

> 
>


[web2py] Re: custom form without using database?

2011-02-10 Thread Dane
What about widgets? IS_IN_DB() for example. Is there a way to get
those working with a regular FORM without using SQLFORM?

On Feb 10, 8:22 am, Bruno Rocha  wrote:
> I almost always use forms in this following way:
>
> 
>
> *#Create a DIV to WRAP it all*>>> div = DIV(FORM())
> >>> print div
>
>  method="post">
>
> *#Take the elements of the wrapper using DOM*>>> print div.element('form')
>
> 
>
> *#Create some other objects*>>> table = TABLE()
> >>> table.append(TR(TD(INPUT(_type='text',requires=IS_NOT_EMPTY()
> >>> print table
>
> 
>
> *#Append other objects to the wrapper*>>> div.element('form').append(table)
> >>> print div
>
>  method="post"> />
>
> *#validators works well*>>> 
> div.element('form').element(_type='text')['requires']
>
> 
>
> 
>
> Note that it will work even if you want to use SQLFORM.
>
> --
> Bruno Rochahttp://about.me/rochacbruno/bio


Re: [web2py] Re: custom form without using database?

2011-02-10 Thread Bruno Rocha
>
> Anyone know what properties I can call to get the hidden fields?


Using SQLFORM you have form.hidden_fields()

but using FORM you need to use Server side DOM and Parsing

#
*# Create a form with hidden elements*
>>> form =
FORM(INPUT(_type='hidden',_value='secret'),INPUT(_type='hidden',_value='secret2'))
>>> print form


*#Get the hidden elements*
>>> form.elements(_type='hidden')
[, ]

*#Get by its index*
>>> form.elements(_type='hidden')[0]


*# each one*
>>> print form.elements(_type='hidden')[0]

>>> print form.elements(_type='hidden')[1]


*#iterate*
>>> for element in form.elements(_type='hidden'): print element
...


>>>




[web2py] Re: custom form without using database?

2011-02-10 Thread Panupat
Thanks Bruno. That looks very promising I'm trying it out now :)

I got mine working too but it's very amature dir to find what's
there and add bits and pieces of them into the view. /sigh.



On Feb 10, 8:22 pm, Bruno Rocha  wrote:
> I almost always use forms in this following way:
>
> 
>
> *#Create a DIV to WRAP it all*>>> div = DIV(FORM())
> >>> print div
>
>  method="post">
>
> *#Take the elements of the wrapper using DOM*>>> print div.element('form')
>
> 
>
> *#Create some other objects*>>> table = TABLE()
> >>> table.append(TR(TD(INPUT(_type='text',requires=IS_NOT_EMPTY()
> >>> print table
>
> 
>
> *#Append other objects to the wrapper*>>> div.element('form').append(table)
> >>> print div
>
>  method="post"> />
>
> *#validators works well*>>> 
> div.element('form').element(_type='text')['requires']
>
> 
>
> 
>
> Note that it will work even if you want to use SQLFORM.
>
> --
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: Apache, Wsgi problem

2011-02-10 Thread Massimo Di Pierro
This is a very important test. I believe web2py to be thread safe and
in fact we thread.lock every access to shared objects even if
operations are atomic, yet I will review it in detail.

Massimo

On Feb 10, 12:38 am, VP  wrote:
> Alright people short answer:  I think I figured this out (at least
> with my configuration)
>
> After testing various configurations, here's the result with: ab -kc
> 100 -t 20https://domain.com/imageblog/default/index/  (same
> imageblog app, 100 connections, 20 seconds stress test).
>
> Two things you will notice with this result.
>
> 1.  ZERO failed request.   No more wsgi premature script error
> 2.  Complete requests is 1234, 61 requests/second on average.
>     Compare to prior configuration:  588 total requests, 29 requests/
> sec on average.  Not to mention 15 failed requests due to wsgi
> premature script errors!!!
>
> This is insane!!!
>
> So how did I configure this?   here it is:
>
>   WSGIDaemonProcess web2py user=username group=username \
>                            display-name=%{GROUP} processes=5 threads=1
>
> The important option being 5 processes, 1 thread.
>
> With this configuration, my real app also did not get wsgi premature
> script errors anymore.  And guess what... the requests/sec
> triples
>
> I am still curious about this.  While my real app can possibly be not
> thread-safe, but the imageblog app should be thread safe (the index
> was simply a listing of images, i.e. read only).  Why would there be a
> problem with more than 1 thread?
>
> 
>
> Document Path:          /imageblog/default/index
> Document Length:        13083 bytes
>
> Concurrency Level:      100
> Time taken for tests:   20.008 seconds
> Complete requests:      1234
> Failed requests:        0
> Write errors:           0
> Keep-Alive requests:    1234
> Total transferred:      16827432 bytes
> HTML transferred:       16171262 bytes
> Requests per second:    61.68 [#/sec] (mean)
> Time per request:       1621.377 [ms] (mean)
> Time per request:       16.214 [ms] (mean, across all concurrent
> requests)
> Transfer rate:          821.33 [Kbytes/sec] received
>
> Connection Times (ms)
>               min  mean[+/-sd] median   max
> Connect:        0    1   9.4      0      73
> Processing:    82  481 890.5    317    5475
> Waiting:       76  443 878.7    274    5393
> Total:         82  483 894.7    317    5503
>
> Percentage of the requests served within a certain time (ms)
>   50%    317
>   66%    342
>   75%    360
>   80%    372
>   90%    416
>   95%    489
>   98%   5351
>   99%   5397
>  100%   5503 (longest request)
> 


Re: [web2py] Re: custom form without using database?

2011-02-10 Thread Bruno Rocha
I almost always use forms in this following way:



*#Create a DIV to WRAP it all*
>>> div = DIV(FORM())
>>> print div


*#Take the elements of the wrapper using DOM*
>>> print div.element('form')


*#Create some other objects*
>>> table = TABLE()
>>> table.append(TR(TD(INPUT(_type='text',requires=IS_NOT_EMPTY()
>>> print table


*#Append other objects to the wrapper*
>>> div.element('form').append(table)
>>> print div


*#validators works well*
>>> div.element('form').element(_type='text')['requires']





Note that it will work even if you want to use SQLFORM.

--
Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: custom form without using database?

2011-02-10 Thread Panupat
Villas - I have read the book. The form.custom only works with SQLFORM
and crud. I cannot use that same method with FORM.

Looks like there are some other properties of the form I can output in
the view... so far I found

{{=form.formname}} - which just give me the word "default"

{{=form[0]}} 1 2 3 4 to output each individual tags.
The starting  tag and the hidden fields aren't stored this way
tho.
Anyone know what properties I can call to get the hidden fields?



On Feb 10, 8:12 pm, villas  wrote:
> See the Forms and Validators section of the book.  You have total
> flexibility if you want to go to the trouble of building your own
> form.  Check out the Custom Forms section of that chapter.
>
> On Feb 10, 12:45 pm, Panupat Chongstitwattana 
> wrote:
>
> > What I meant was breaking the form down to pieces and put them at the
> > appropriate places. Like,
>
> > 
> >  'Name :' comes here 
> >  INPUT _name comes here
> > 
> > 
> >  'Password :'
> >  INPUT _password 
>
> > etc.
>
> > On Thu, Feb 10, 2011 at 7:37 PM, Bruno Rocha  wrote:
> >  form = FORM()
> >  form.element().append(LABEL(_for='name',_value='Name'))
> >  form.element().append(INPUT(_type='text',_name='name'))
> >  print form
> > >  > > for="name" value="Name">
> > > ---
> > > Bruno Rocha
> > >http://about.me/rochacbruno/bio
>
>


[web2py] Re: custom form without using database?

2011-02-10 Thread villas
See the Forms and Validators section of the book.  You have total
flexibility if you want to go to the trouble of building your own
form.  Check out the Custom Forms section of that chapter.

On Feb 10, 12:45 pm, Panupat Chongstitwattana 
wrote:
> What I meant was breaking the form down to pieces and put them at the
> appropriate places. Like,
>
> 
>  'Name :' comes here 
>  INPUT _name comes here
> 
> 
>  'Password :'
>  INPUT _password 
>
> etc.
>
> On Thu, Feb 10, 2011 at 7:37 PM, Bruno Rocha  wrote:
>  form = FORM()
>  form.element().append(LABEL(_for='name',_value='Name'))
>  form.element().append(INPUT(_type='text',_name='name'))
>  print form
> >  > for="name" value="Name">
> > ---
> > Bruno Rocha
> >http://about.me/rochacbruno/bio
>
>


Re: [web2py] custom form without using database?

2011-02-10 Thread David J.


Side Question;
How can you add validators this way?


On 2/10/11 7:37 AM, Bruno Rocha wrote:

>>> form = FORM()
>>> form.element().append(LABEL(_for='name',_value='Name'))
>>> form.element().append(INPUT(_type='text',_name='name'))
>>> print form
for="name" value="Name">


---
Bruno Rocha
http://about.me/rochacbruno/bio





Re: [web2py] custom form without using database?

2011-02-10 Thread Panupat Chongstitwattana
What I meant was breaking the form down to pieces and put them at the
appropriate places. Like,


 'Name :' comes here 
 INPUT _name comes here


 'Password :'
 INPUT _password 

etc.

On Thu, Feb 10, 2011 at 7:37 PM, Bruno Rocha  wrote:
 form = FORM()
 form.element().append(LABEL(_for='name',_value='Name'))
 form.element().append(INPUT(_type='text',_name='name'))
 print form
>  for="name" value="Name">
> ---
> Bruno Rocha
> http://about.me/rochacbruno/bio
>
>


Re: [web2py] custom form without using database?

2011-02-10 Thread Bruno Rocha
>>> form = FORM()
>>> form.element().append(LABEL(_for='name',_value='Name'))
>>> form.element().append(INPUT(_type='text',_name='name'))
>>> print form


---
Bruno Rocha
http://about.me/rochacbruno/bio


[web2py] Re: PyPy faster than C ...

2011-02-10 Thread villas
Cool indeed!
But please remember NOT to mention any of this to your partner on
Valentine's night!


[web2py] custom form without using database?

2011-02-10 Thread Panupat
I'm trying to put different input fields into different html elements.
In the book only mentioned how to use custom form with pre-defined
database.

db.define_table('image',
Field('name'),
Field('file', 'upload'))

{{=form.custom.begin}}
{{=form.custom.widget.name}}

If I am creating my form from the FORM object, can I break it down in
a similar way? For example

form = FORM('Name: ',
  INPUT(_name='name'),
  'Password: ',
  INPUT(_name='password', _type='password'),
  INPUT(_type='submit'))


[web2py] Re: Cache.disk() expiring unexpectedly

2011-02-10 Thread Dane
This is in my development environment on Windows 7 by the way.

On Feb 10, 7:17 am, Dane  wrote:
> I'm trying to use cache.disk to cache a large TABLE object
> indefinitely. It seems to work fine at first, but then expires after a
> couple minutes.
>
> I'm setting it like this:
>
> cache.disk.clear('^%s$' % cache_key)
> cache.disk(cache_key, lambda:grid, None)
>
> *(I also tried 10**10 instead of None for duration with same result)
>
> And I'm accessing like this:
>
> cached = cache.disk(cache_key, lambda:None)
> if cached: return cached
>
> -Dane


[web2py] Cache.disk() expiring unexpectedly

2011-02-10 Thread Dane
I'm trying to use cache.disk to cache a large TABLE object
indefinitely. It seems to work fine at first, but then expires after a
couple minutes.

I'm setting it like this:

cache.disk.clear('^%s$' % cache_key)
cache.disk(cache_key, lambda:grid, None)

*(I also tried 10**10 instead of None for duration with same result)

And I'm accessing like this:

cached = cache.disk(cache_key, lambda:None)
if cached: return cached

-Dane


[web2py] Re: Authorization to create/update an item

2011-02-10 Thread villas
It sounds like you need to study more the Access Control chapter of
the book.

You don't necessarily need to create a new controller,  but whether
you choose to do so or not is due to your own requirements. Once you
have studied the built-in authorisation system in a little more depth,
all should become clearer to you.

Regards, D

On Feb 10, 6:12 am, pbreit  wrote:
> Forget the needing to lock down. I see what I have to do.
>
> But I'm still wondering if anyone has good practices on item creation and
> modification. It looks like I'll probably need to create a separate
> controller for editing?


[web2py] Re: Apache, Wsgi problem

2011-02-10 Thread Michael Toomim
Great!!

I also had "threads=25" and changed this to "threads=1 processes=5",
so it makes sense that I was encountering the same problem.  It sounds
like something in web2py might not be thread-safe.  The next time I
run a production test I will report if this fixes the problem.

On Feb 10, 2:38 pm, VP  wrote:
> Alright people short answer:  I think I figured this out (at least
> with my configuration)
>
> After testing various configurations, here's the result with: ab -kc
> 100 -t 20https://domain.com/imageblog/default/index/  (same
> imageblog app, 100 connections, 20 seconds stress test).
>
> Two things you will notice with this result.
>
> 1.  ZERO failed request.   No morewsgipremature script error
> 2.  Complete requests is 1234, 61 requests/second on average.
>     Compare to prior configuration:  588 total requests, 29 requests/
> sec on average.  Not to mention 15 failed requests due towsgi
> premature script errors!!!
>
> This is insane!!!
>
> So how did I configure this?   here it is:
>
>   WSGIDaemonProcess web2py user=username group=username \
>                            display-name=%{GROUP} processes=5 threads=1
>
> The important option being 5 processes, 1 thread.
>
> With this configuration, my real app also did not getwsgipremature
> script errors anymore.  And guess what... the requests/sec
> triples
>
> I am still curious about this.  While my real app can possibly be not
> thread-safe, but the imageblog app should be thread safe (the index
> was simply a listing of images, i.e. read only).  Why would there be 
> aproblemwith more than 1 thread?
>
> 
>
> Document Path:          /imageblog/default/index
> Document Length:        13083 bytes
>
> Concurrency Level:      100
> Time taken for tests:   20.008 seconds
> Complete requests:      1234
> Failed requests:        0
> Write errors:           0
> Keep-Alive requests:    1234
> Total transferred:      16827432 bytes
> HTML transferred:       16171262 bytes
> Requests per second:    61.68 [#/sec] (mean)
> Time per request:       1621.377 [ms] (mean)
> Time per request:       16.214 [ms] (mean, across all concurrent
> requests)
> Transfer rate:          821.33 [Kbytes/sec] received
>
> Connection Times (ms)
>               min  mean[+/-sd] median   max
> Connect:        0    1   9.4      0      73
> Processing:    82  481 890.5    317    5475
> Waiting:       76  443 878.7    274    5393
> Total:         82  483 894.7    317    5503
>
> Percentage of the requests served within a certain time (ms)
>   50%    317
>   66%    342
>   75%    360
>   80%    372
>   90%    416
>   95%    489
>   98%   5351
>   99%   5397
>  100%   5503 (longest request)
>