[web2py:35818] Re: crud.select headers attribute

2009-11-23 Thread annet

Massimo,

On page 218 of the web2py manual it says:

headers={'person.name', 'Name'}

That should read like:

headers={'person.name':'Name'}


Kind regards,

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



[web2py:35819] Re: cron and permissions

2009-11-23 Thread mika

I tried, and it gives me:

WARNING:root:WEB2PY CRON Call returned code 1: No error message
available


On Nov 9, 4:33 pm, mdipierro  wrote:
> Can you try:
>
> @auth.requires(auth.has_membership(...) or not request.env)
>
> On Nov 9, 6:53 am,mika wrote:
>
>
>
> > I have no idea for such condition.
> > Maybe it is possible to add support for built-in user 'cron',
> > so calling functions from cron would be called as user 'cron'?
>
> > On Nov 6, 6:29 pm, mdipierro  wrote:
>
> > > You cannot do
>
> > > @auth.requires_membership()
>
> > > and call it from cron because there is no user to check permissions
> > > against. You can do
>
> > > @auth.requires(auth.has_membership(...) or condition)
>
> > > where condition is something that determines whether it is being
> > > called by CRON. I cannot think of anything that defines condition.
> > > Perhaps something missing in request.env? This needs to be tested. If
> > > you do any test, please let us know.
>
> > > On Nov 6, 4:58 am,mika wrote:
>
> > > > hi!
>
> > > > I noticed that if I decorate a function with a
> > > > @auth.requires_membership,
> > > > the function call from cron not work and give the:
> > > > WARNING:root:WEB2PY CRON Call returned code 1: No error message
> > > > available
>
> > > > what I need to enable calling such functions from cron?
>
> > > > my cron looks like:
> > > > */5 * * * *             root *control/dec_function
>
> > > > best regards,
> > > >mika
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35820] Re: file|upload third column

2009-11-23 Thread annet

Massimo,

> there will be no link to download, no preview and (I think) no delete
> button.

You're right, all three features are gone when using an SQLFORM.


Kind regards,

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



[web2py:35821] Re: twitter in GAE

2009-11-23 Thread Leandro - ProfessionalIT

Hi wes,

I copy and paste your suggestion em my controller/page, but I
still receive the message: 'Unable to download'. I don't know, but I
think that this feature don't run in GAE.

Thanks by your help.

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



[web2py:35822] Auto-Populate the database

2009-11-23 Thread harshit agrawal

hello sir,
I posted a question about auto-population of the database
but no replies came. Please tell me can I populate the database by
using a file in place of forms.

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



[web2py:35823] Re: Auto-Populate the database

2009-11-23 Thread Kuba Kucharski
The answer came pretty fast.. maybe this is a problem w your email client?

http://groups.google.com/group/web2py/browse_thread/thread/bedece34cee4638e?pli=1


-- 
Kuba


On Mon, Nov 23, 2009 at 1:17 PM, harshit agrawal <
harsh.agrawal2...@gmail.com> wrote:

>
> hello sir,
>I posted a question about auto-population of the database
> but no replies came. Please tell me can I populate the database by
> using a file in place of forms.
>
> Hoping for a quick response.
> Harshit
> >
>

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



[web2py:35824] Re: Populating database

2009-11-23 Thread harshit agrawal

I got it.
Thank You


On Nov 22, 5:50 pm, mdipierro  wrote:
> done.
>
> On Nov 22, 3:39 pm, "mr.freeze"  wrote:
>
> > Any chance you could add populate to svn?
>
> > On Nov 22, 9:19 am, mdipierro  wrote:
>
> > > With random data or with your own data?
>
> > > 1) With random data:
>
> > > from gluon.contrib.populate import populate
> > > populate(db.table,1000) # will fill db.table with 1000 records
>
> > > 2) With your own data
> > > I depends on where the data is. You can create a controller action
> > > that loops and
> > >    db.table.insert(field='value',...)
>
> > > On Nov 22, 3:47 am, harshit agrawal 
> > > wrote:
>
> > > > sir,
> > > > I am populating my database by filling forms. But I don't want to fill
> > > > long forms again and again. Is there a way to populate the database in
> > > > one shot . If Yes, please explain...
>
> > > > Thank You
> > > > waiting for response
> > > > harshit
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35825] Maximum No of users can web2py server can support

2009-11-23 Thread harshit agrawal

Hello sir,
 I am making a portal for my institute in web2py but it
requires that about 200 users can use the system  simultaneously. So
how can we do this?

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



[web2py:35826] Re: Maximum No of users can web2py server can support

2009-11-23 Thread mr.freeze

This may help:
http://www.web2pyslices.com/main/slices/take_slice/33

On Nov 23, 6:54 am, harshit agrawal 
wrote:
> Hello sir,
>          I am making a portal for my institute in web2py but it
> requires that about 200 users can use the system  simultaneously. So
> how can we do this?
>
> Harshit
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35827] Re: Extremely basic question about view

2009-11-23 Thread mdipierro

I understand that.
You can define at the top of layout and do
{{def block(name):
try:
  name()
  return False
except:
  return True
  pass
return}}

and do

#layout.html

{{if block(title):}}index{{pass}} - mysite.com

# some navigation links here
{{include}}

{{if block(right_col):}}
Latest Comments

Latest RSS Feeds

{{pass}}



#default/search.html

{{def right_col():}}
... search options
{{=search_form}}
Search Tips
Try using keywords
{{return}}

{{extend 'layout.html'}}
{{=BEAUTIFY(results)}}






On Nov 23, 12:08 am, Thadeus Burgess  wrote:
> I think you're trying to use blocks incorrectly. Blocks are defined in a
> base template that is to be extended. When the extending template declares a
> block that exists in the parent template, it will replace everything in
> between the parent block, like inheritance and overriding. However the
> parent template can display a default value for the block, in case it does
> not get overridden.
>
> A case example, say on every page I want to display the latest posts,
> comments, and updated RSS feeds. However on my search page, I want to
> replace this column with a search form instead, so I display a lengthy form
> so you can select between categories, tags, search phrase, etc.
>
> I do not believe this is possible in pure template code in web2py, you have
> to do something from your controller such as response.right_column =
> "latest_stuff.html", and then if you want to set it to something else you
> have to set it from your specific action, def search():
> response.right_column = "default/search_sidebar.html". I don't like this
> because it starts to blend the line between a Controller, and a View.
>
> With blocks this is how it would be implemented, all from within the views.
>
> #layout.html
>
> 
>
> {{block title}}index{{endblock}} - mysite.com
>
> 
>
> # some navigation links here
>
> {{include}}
>
> 
> {{block right_col}}
>
> Latest Comments
>
> 
>
> Latest RSS Feeds
>
> 
>
> {{endblock}}
> 
>
> #default/search.html
>
> {{block right_col}}
>
> ... search options
>
> {{=search_form}}
>
> Search Tips
> Try using keywords
>
> {{endblock}}
>
> {{=BEAUTIFY(results)}}
>
> 
>
> -Thadeus
>
> On Sun, Nov 22, 2009 at 10:03 PM, mdipierro  wrote:
>
> > Here is my problem with blocks:
>
> > #extended
> > {{block a}}hello{{endblock}} world {{block b}}hello{{endblock}}
>
> > #extending
> > {{block a}}HELLO{{endblock}} WORLD {{block b}}HELLO{{endblock}}
>
> > where does WORLD go? It gets lost. Blocks are convenient and not well
> > defined.
>
> > I believe {{def a():}}HELLO{{return}}, the current web2py way, is more
> > Pythonic and it is better defined.
>
> > Massimo
>
> > On Nov 22, 9:46 pm, Thadeus Burgess  wrote:
> > > Would blocks be too much to ask for?
>
> > > -Thadeus
>
> > > On Sun, Nov 22, 2009 at 9:15 AM, mdipierro 
> > wrote:
>
> > > > Perhaps you are talking about something equivalent to Django blocks?
> > > > We do not have that.
> > > > We have other ways to do a similar thing. There are two basic things
> > > > you can do:
>
> > > > 1) Extending
> > > > #extedened.html
> > > > {{include}}
>
> > > > #extending.html
> > > > {{extends 'extended.html'}}Hello
>
> > > > 2) Including
> > > > #including.html
> > > > {{include 'body.html'}}
>
> > > > #body.html
> > > > Hello
>
> > > > And you can mix and match.
> > > > You can also pass functions to the extended function
>
> > > > Extending
> > > > #extedened.html
> > > > {{header()}}{{include}}{{footer()}} > > > body>
>
> > > > #extending.html
> > > > {{def header():}}This is the header{{return}}
> > > > {{def footer():}}This is the footer{{return}}
> > > > {{extends 'extended.html'}}Hello
>
> > > > and you can do these things in a try ... except to have a default:
>
> > > > {{try: header()}}{{except:}}default{{pass}}
> > > > {{include}}{{footer()}}
>
> > > > Massimo
>
> > > > On Nov 22, 7:18 am, jensmun  wrote:
> > > > > Hi,
>
> > > > > Typical case of embarrassing situation. I don't know anything about
> > > > > programming and wanted to try this out. Unfortunately I can't even
> > get
> > > > > my head around extensions of views. And I can't seem to find a
> > > > > description of something this basic.
>
> > > > > I've tried stripped the example app in web2py from everything but a
> > > > > default controller, two views and the db-model. But I can't get the
> > > > > extension of views to work. And the Welcome-application is far too
> > > > > complicated for somebody like me to understand.
>
> > > > > I would be grateful for a pointer to some place which explains view
> > > > > and their extensions. If for example there are two places where I use
> > > > >  how does the extension view know which of these two replace with
> > > > > the  in the extension.
>
> > > > > Stupid question I know - but I've been trying to create a model and
> > > > > extension view which changes top "Welcome customize me" and not been
> > > > > succeeding.
>
> > > > > And Massimo's manual

[web2py:35828] Re: How to delete file uploaded via SQLFORM.factory()?

2009-11-23 Thread mdipierro

SQLFORM.factory(Field('the_file','upload',requires=IS_UPLOAD_FILENAME
()),uploadfield=False)

On Nov 23, 1:24 am, Iceberg  wrote:
> I noticed that a file uploaded via SQLFORM.factory() exists in myapp/
> uploads. How to delete them automatically?
>
> By the way, shall the auto-deletion be web2py's default behaviour?
> Since using SQLFORM.factory() hints no need to keep those file at all.
>
> Code for reproducing the problem.
>
> def foo():
>   form = SQLFORM.factory(Field
> ('the_file','upload',requires=IS_UPLOAD_FILENAME()))
>   if form.accepts(...):
>     process_file_content_on_the_fly( form.vars.the_file.value )
>     delete_uploaded_temp_file(...) # but how?
>   return {'':form}
>
> Sincerely,
>              Ruijun Luo, 2009-Nov-22, 11:59(AM), Sun
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35829] Re: cron and permissions

2009-11-23 Thread mdipierro

Can you try

@auth.requires(not request.env or auth.has_membership(...) )

On Nov 23, 3:16 am, mika  wrote:
> I tried, and it gives me:
>
> WARNING:root:WEB2PY CRON Call returned code 1: No error message
> available
>
> On Nov 9, 4:33 pm, mdipierro  wrote:
>
> > Can you try:
>
> > @auth.requires(auth.has_membership(...) or not request.env)
>
> > On Nov 9, 6:53 am,mika wrote:
>
> > > I have no idea for such condition.
> > > Maybe it is possible to add support for built-in user 'cron',
> > > so calling functions from cron would be called as user 'cron'?
>
> > > On Nov 6, 6:29 pm, mdipierro  wrote:
>
> > > > You cannot do
>
> > > > @auth.requires_membership()
>
> > > > and call it from cron because there is no user to check permissions
> > > > against. You can do
>
> > > > @auth.requires(auth.has_membership(...) or condition)
>
> > > > where condition is something that determines whether it is being
> > > > called by CRON. I cannot think of anything that defines condition.
> > > > Perhaps something missing in request.env? This needs to be tested. If
> > > > you do any test, please let us know.
>
> > > > On Nov 6, 4:58 am,mika wrote:
>
> > > > > hi!
>
> > > > > I noticed that if I decorate a function with a
> > > > > @auth.requires_membership,
> > > > > the function call from cron not work and give the:
> > > > > WARNING:root:WEB2PY CRON Call returned code 1: No error message
> > > > > available
>
> > > > > what I need to enable calling such functions from cron?
>
> > > > > my cron looks like:
> > > > > */5 * * * *             root *control/dec_function
>
> > > > > best regards,
> > > > >mika
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35830] Re: twitter in GAE

2009-11-23 Thread mdipierro

Use this:

def twitter():
session.forget()
session._unlock(response)
import gluon.tools
import gluon.contrib.simplejson as sj
page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
return sj.loads(page)['#timeline']

and see what error you get in the GAE log.

On Nov 23, 5:24 am, Leandro - ProfessionalIT 
wrote:
> Hi wes,
>
>     I copy and paste your suggestion em my controller/page, but I
> still receive the message: 'Unable to download'. I don't know, but I
> think that this feature don't run in GAE.
>
> Thanks by your help.
>
> -- Leandro.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35831] Re: Maximum No of users can web2py server can support

2009-11-23 Thread mdipierro



On Nov 23, 6:54 am, harshit agrawal 
wrote:
> Hello sir,
>          I am making a portal for my institute in web2py but it
> requires that about 200 users can use the system  simultaneously. So
> how can we do this?
>
> Harshit
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35832] Re: Maximum No of users can web2py server can support

2009-11-23 Thread mdipierro

It really depends on many issues. 200 users are not going to make 1
request/second but more like 1 request every ten seconds each or less.
That means you need to handle 20 requests/seconds.

On my laptop an average dynamic page takes ~20ms, and that means 50
requests/second. This means I can handle 200 current users on my
laptop.

The bottleneck is always database access. It really depends on what
those users do with the database.

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



[web2py:35833] Re: Dropbox based on query

2009-11-23 Thread mdipierro

myactivities = db((db.company_activity.bedrijf==auth.user.bedrijf)&
(db.company_activity.activity==db.activity.id))
.select(db.activity.activity)

IS_IN_SET([row.activity for row in myactivities])


On Nov 20, 11:23 am, annet  wrote:
> I have a table which combines companies with activities and I have
> a table called timetable for scheduled activities:
>
> db.define_table('company_activity,
>     Field('company,db.company),
>     Field('activity',db.activity),
>     migrate=False)
>
> db.define_table('timetable',
>     Field('company',db.company),
>     Field('activity'),
>     Field('day',db.day),
>     Field('time',type='time'),
>     Field('duration'),
>     Field('level',db.level),
>     migrate=False)
>
> To prevent the user from entering an activity in timetable and to not
> confront him
> with an endless list of activities he doesn't offer, I would like to
> vailidate timetable.activity
> using a dropbox with options based on the company_activity and
> activity tables.
>
> The query would read like:
>
> db((db.company_activity.bedrijf==auth.user.bedrijf)&
> (db.company_activity.activity==db.activity.id))
> .select(db.activity.activity)
>
> The key and value in the dropbox should have the value of
> db.activity.activity.  Does one of
> you know how to implement this?
>
> Kind regards,
>
> Annet
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35834] Sphinx

2009-11-23 Thread mdipierro

We have had some discussion about moving the documentation to Sphinx.
Months have passed and there has been no progress. I personally do not
mind epydoc but some of you really liked Sphinx.

If you know Sphinx and want web2py to use it, please help us.

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



[web2py:35835] Re: twitter in GAE

2009-11-23 Thread Leandro - ProfessionalIT

Massimo,
With this code, I don't receive a error message, but show me a
etern 'loading' in the div field. Look in my page: http://www.leandro.inf.br

-- Leandro.


On Nov 23, 1:07 pm, mdipierro  wrote:
> Use this:
>
> def twitter():
>     session.forget()
>     session._unlock(response)
>     import gluon.tools
>     import gluon.contrib.simplejson as sj
>     page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
>     return sj.loads(page)['#timeline']
>
> and see what error you get in the GAE log.
>
> On Nov 23, 5:24 am, Leandro - ProfessionalIT 
> wrote:
>
> > Hi wes,
>
> >     I copy and paste your suggestion em my controller/page, but I
> > still receive the message: 'Unable to download'. I don't know, but I
> > think that this feature don't run in GAE.
>
> > Thanks by your help.
>
> > -- Leandro.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35836] Re: Sphinx

2009-11-23 Thread Zoom.Quiet

On Mon, Nov 23, 2009 at 23:28, mdipierro  wrote:
>
> We have had some discussion about moving the documentation to Sphinx.
> Months have passed and there has been no progress. I personally do not
> mind epydoc but some of you really liked Sphinx.
>
> If you know Sphinx and want web2py to use it, please help us.
>
Sphinx is very easy and lovely,
for building Book, such as:
Writing Technical Documentation with Sphinx, Paver, and Cog - Doug Hellmann
http://www.doughellmann.com/articles/Writing-Technical-Documentation-Sphinx/index.html

but web2py want to usage Sphinx as epydoc ?
M that is not the Sphinx care about...
i suggest usage Doxygen ...

> Massimo



-- 
http://zoomquiet.org 人生苦短? Pythonic!
usage 7-zip to replace WinRAR/WinZip; You can get the truely Freedom 4 software.

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



[web2py:35837] Re: twitter in GAE

2009-11-23 Thread mdipierro

I assume you are running on GAE. Your browser calls the twitter action
via ajax. That casues en error (the page says loading because ajax
does not a valid response0. Now look into the GAE logs for the error.

On Nov 23, 9:33 am, Leandro - ProfessionalIT 
wrote:
> Massimo,
>     With this code, I don't receive a error message, but show me a
> etern 'loading' in the div field. Look in my 
> page:http://www.leandro.inf.br
>
> -- Leandro.
>
> On Nov 23, 1:07 pm, mdipierro  wrote:
>
> > Use this:
>
> > def twitter():
> >     session.forget()
> >     session._unlock(response)
> >     import gluon.tools
> >     import gluon.contrib.simplejson as sj
> >     page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
> >     return sj.loads(page)['#timeline']
>
> > and see what error you get in the GAE log.
>
> > On Nov 23, 5:24 am, Leandro - ProfessionalIT 
> > wrote:
>
> > > Hi wes,
>
> > >     I copy and paste your suggestion em my controller/page, but I
> > > still receive the message: 'Unable to download'. I don't know, but I
> > > think that this feature don't run in GAE.
>
> > > Thanks by your help.
>
> > > -- Leandro.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35838] Re: Web2Py Multi-site

2009-11-23 Thread David

I did get a chance to read that this morning.  It was well written and
gave me a better idea for what I would like to implement. It seems
that I should be able to link static files on a per virtualhost
directive which _should_ work for what I want to do.

On Nov 2, 2:34 pm, Thadeus Burgess  wrote:
> For what you are trying to accomplish, sounds like it will be kind of nasty.
>
> You will need to look at the request dictionary, which includes the domain
> name in it. Based on that you will need to render different views for your
> functions. It might be easier to just change what CSS file gets included
> based on domain name.
>
> As far as serving just once instance of web2py, in your VirtualHost
> declartion, declare ServerName, and then ServerAlias for all other domains
> it might be on.
>
> I wrote an article on setting up web2py for slicehost, you might want to
> check out the VirtualHost setups near the end.
>
> http://www.web2pyslices.com/main/slices/take_slice/14
>
> -Thadeus
>
>
>
> On Mon, Nov 2, 2009 at 2:28 PM, David Henry  wrote:
> > nted one web2py with multiple applications that serve unique views/html/css
> > to users based on the domain used to access the site so users can custom
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35839] Re: Web2Py Multi-site

2009-11-23 Thread mdipierro

You should consider different approached depending on whether the
layout depends on the domain or the user. If it depends on the domain
and it is fixed for domain, I suggest different web2py apps with
different set of views that talk to the same db. Use virtual hosts to
map domain into app. If the are per user, I would make the CSS dynamic
and retrieve it from the a database based on user preferences.

On Nov 2, 2:28 pm, David Henry  wrote:
> Hi Thadeus,
>
> Did you happen to have the information on how to set this up?
>
> I wanted one web2py with multiple applications that serve unique views/
> html/css to users based on the domain used to access the site so users  
> can customize the look and feel to their tastes.
>
> Thanks,
> David
>
> On Nov 1, 2009, at 7:41 PM, Thadeus Burgess wrote:
>
> > I use virtualhosts on a per domain basis. You are wanting the same  
> > app, with the same data, but different layouts depending on domain,  
> > or do you want two completely separate apps per domain?
>
> > -Thadeus
>
> > On Sun, Nov 1, 2009 at 7:12 PM, David Henry  
> >  wrote:
> > uld I need symlinks to the virtualhost directory as we
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35840] Re: twitter in GAE

2009-11-23 Thread Leandro - ProfessionalIT

Master Massimo,

   Sorry, I forget of this detail. That dummie !.

The GAE log:

In FILE: /base/data/home/apps/leandro-inf/1.337957566746262675/
applications/init/controllers/default.py

Traceback (most recent call last):
  File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
restricted.py", line 184, in restricted
exec ccode in environment
  File "/base/data/home/apps/leandro-inf/1.337957566746262675/
applications/init/controllers/default.py:twitter", line 151, in

  File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
globals.py", line 102, in 
self._caller = lambda f: f()
  File "/base/data/home/apps/leandro-inf/1.337957566746262675/
applications/init/controllers/default.py:twitter", line 75, in twitter
  File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
contrib/simplejson/__init__.py", line 305, in loads
return _default_decoder.decode(s)
  File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
contrib/simplejson/decoder.py", line 329, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
contrib/simplejson/decoder.py", line 347, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


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



[web2py:35841] Re: Extremely basic question about view

2009-11-23 Thread Thadeus Burgess
Except when right_col doesn't exist, the "variable referenced before
assignment" exception.

So you end up with another problem, you have to define your default as a def
right_col in the layout.html, and if you define another one in your
view.html, the one in layout.html still takes precedence and it never uses
the view's custom definition.

-Thadeus

On Mon, Nov 23, 2009 at 9:00 AM, mdipierro  wrote:

> def block(name):
>try:
>  name()
>  return False
>except:
>  return True
>  pass
>

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



[web2py:35842] Re: twitter in GAE

2009-11-23 Thread mdipierro

Sorry to do this to you

try:

def my test():
import gluon.tools
page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
return page

see if what fetch is getting.

On Nov 23, 10:34 am, Leandro - ProfessionalIT 
wrote:
> Master Massimo,
>
>    Sorry, I forget of this detail. That dummie !.
>
> The GAE log:
>
> In FILE: /base/data/home/apps/leandro-inf/1.337957566746262675/
> applications/init/controllers/default.py
>
> Traceback (most recent call last):
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
> restricted.py", line 184, in restricted
>     exec ccode in environment
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/
> applications/init/controllers/default.py:twitter", line 151, in
> 
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
> globals.py", line 102, in 
>     self._caller = lambda f: f()
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/
> applications/init/controllers/default.py:twitter", line 75, in twitter
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
> contrib/simplejson/__init__.py", line 305, in loads
>     return _default_decoder.decode(s)
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
> contrib/simplejson/decoder.py", line 329, in decode
>     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File "/base/data/home/apps/leandro-inf/1.337957566746262675/gluon/
> contrib/simplejson/decoder.py", line 347, in raw_decode
>     raise ValueError("No JSON object could be decoded")
> ValueError: No JSON object could be decoded
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35843] Re: Extremely basic question about view

2009-11-23 Thread mdipierro

Yes. In my exmample above

{{if block(title):}}index{{pass}}

"index" is the default.

On Nov 23, 10:44 am, Thadeus Burgess  wrote:
> Except when right_col doesn't exist, the "variable referenced before
> assignment" exception.
>
> So you end up with another problem, you have to define your default as a def
> right_col in the layout.html, and if you define another one in your
> view.html, the one in layout.html still takes precedence and it never uses
> the view's custom definition.
>
> -Thadeus
>
> On Mon, Nov 23, 2009 at 9:00 AM, mdipierro  wrote:
> > def block(name):
> >    try:
> >      name()
> >      return False
> >    except:
> >      return True
> >      pass
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35844] Re: Extremely basic question about view

2009-11-23 Thread mdipierro

Silly me. You are right. Let me think about this.


On Nov 23, 10:44 am, Thadeus Burgess  wrote:
> Except when right_col doesn't exist, the "variable referenced before
> assignment" exception.
>
> So you end up with another problem, you have to define your default as a def
> right_col in the layout.html, and if you define another one in your
> view.html, the one in layout.html still takes precedence and it never uses
> the view's custom definition.
>
> -Thadeus
>
> On Mon, Nov 23, 2009 at 9:00 AM, mdipierro  wrote:
> > def block(name):
> >    try:
> >      name()
> >      return False
> >    except:
> >      return True
> >      pass
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35845] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
On Mon, Nov 23, 2009 at 12:20 AM, Thadeus Burgess wrote:

> if web2py is mostly written in English, then it needs to default to
> English, and allow for easy overriding of this default.
>

I agree.

More explicitly - whatever the web2py distribution default is should behave
correctly;

If an application declares it's own default language (and it should be easy,
and clear - how should that look to the application writer?), then that
should override the distribution default for requests to that application.

To see why there is currently a bug,

   - set your languages to more than one in (for example) Firefox
  - e.g. [1] 'en';  [2] 'it'
   - go to http://www.web2py.com/examples/simple_examples/hello6  (or any of
   the simple examples)
  - despite 'en' being the first language, the example displays "Slave
  Mondo'  (incorrect behavior)


The current default behavior is incorrect;   the proposal (which is fine for
overriding a site defailt) is that EACH APPLICATION must declare the default
language.

This (currently) is necessary for the system to behave reasonably.

The reason Massimo's proposed "solution" is NOT sufficient for the
installation default should now be quite evident:  the "patch" for the bug
MUST propogate to EACH AND EVERY APP  for the system behavior to be correct.

This is NOT a bug in examples; this is a bug in gluon/languages.py.   To see
this yet another way, write a unit test for gluon/languages.py.

Since examples do not behave correctly, and - in general - with Massimo's
proposal  multiple, and constantly changing (as applications are
installed)   points of correction must be made in order to accomplish
reasonable behavior:  this by itself is sufficient evidence to point
directly to the bug in gluon/languages.py.   Additionally, a suggestion that
"examples" has a bug (it does not)  is a suggestion which breaks "backward
compatibility"  (but backward compatibility is not the point at all here -
that correcting a bug at its source is the proper approach is what is in
discussion here)

Once all recognize this clearly, then we can move on to talking about what a
good solution would look like.

- Yarko



>
> -Thadeus
>
>
>
>
>
> On Sun, Nov 22, 2009 at 10:04 PM, mdipierro wrote:
>
>> rammer always explicitly say which languages do not need
>> transla
>>
>
>
> >
>

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



[web2py:35846] Re: Web2Py Multi-site

2009-11-23 Thread David

Layouts should depend on the domain.

But I don't want to have 50+ installations per server that need to be
update manually when I make changes to the code or bring enhancements.

They don't need appadmin. I am writing a control panel for them to
manage users.

Would it not be possible to share a single web2py installation for
multiple vhosts so I only need to update one directory on each server?


On Nov 23, 10:15 am, mdipierro  wrote:
> You should consider different approached depending on whether the
> layout depends on the domain or the user. If it depends on the domain
> and it is fixed for domain, I suggest different web2py apps with
> different set of views that talk to the same db. Usevirtualhosts to
> map domain into app. If the are per user, I would make the CSS dynamic
> and retrieve it from the a database based on user preferences.
>
> On Nov 2, 2:28 pm, David Henry  wrote:
>
>
>
> > Hi Thadeus,
>
> > Did you happen to have the information on how to set this up?
>
> > I wanted one web2py with multiple applications that serve unique views/
> > html/css to users based on the domain used to access the site so users  
> > can customize the look and feel to their tastes.
>
> > Thanks,
> > David
>
> > On Nov 1, 2009, at 7:41 PM, Thadeus Burgess wrote:
>
> > > I use virtualhosts on a per domain basis. You are wanting the same  
> > > app, with the same data, but different layouts depending on domain,  
> > > or do you want two completely separate apps per domain?
>
> > > -Thadeus
>
> > > On Sun, Nov 1, 2009 at 7:12 PM, David Henry  
> > >  wrote:
> > > uld I need symlinks to the virtualhost directory as we
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35847] Re: twitter in GAE

2009-11-23 Thread Leandro - ProfessionalIT

On Nov 23, 3:06 pm, mdipierro  wrote:
> Sorry to do this to you

Hey Master no problems ! I love Web2Py and I think our community is
very caring.

> try:
>
> def my test():
>     import gluon.tools
>     page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
>     return page
>
> see if what fetch is getting.

Look, run OK.
http://www.leandro.inf.br/init/default/my_test


- Leandro.




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



[web2py:35848] Re: Internationalization

2009-11-23 Thread mdipierro

Yarko, I am leaning towards accepting your proposal for two reasons:
1) it was seconded (by Thedeus)
2) you are right that this results in an incorrect behavior for Admin/
Examples/Welcome

I still stand that those apps have a bug (because when we added
translations I did not set the current language) not languages.py.
Nevertheless it is easier to change the default behavior than change
three apps.

If no objection from people overseas, I will change this in trunk.

To people overseas: If your app is in polish (for example) and you
provide an english translation, the english translation will not work
anymore until you re-set the current language to polish. Now it does
not make any assumption about the current language.

Massimo

On Nov 23, 11:12 am, Yarko Tymciurak 
wrote:
> On Mon, Nov 23, 2009 at 12:20 AM, Thadeus Burgess 
> wrote:
>
> > if web2py is mostly written in English, then it needs to default to
> > English, and allow for easy overriding of this default.
>
> I agree.
>
> More explicitly - whatever the web2py distribution default is should behave
> correctly;
>
> If an application declares it's own default language (and it should be easy,
> and clear - how should that look to the application writer?), then that
> should override the distribution default for requests to that application.
>
> To see why there is currently a bug,
>
>    - set your languages to more than one in (for example) Firefox
>       - e.g. [1] 'en';  [2] 'it'
>    - go tohttp://www.web2py.com/examples/simple_examples/hello6 (or any of
>    the simple examples)
>       - despite 'en' being the first language, the example displays "Slave
>       Mondo'  (incorrect behavior)
>
> The current default behavior is incorrect;   the proposal (which is fine for
> overriding a site defailt) is that EACH APPLICATION must declare the default
> language.
>
> This (currently) is necessary for the system to behave reasonably.
>
> The reason Massimo's proposed "solution" is NOT sufficient for the
> installation default should now be quite evident:  the "patch" for the bug
> MUST propogate to EACH AND EVERY APP  for the system behavior to be correct.
>
> This is NOT a bug in examples; this is a bug in gluon/languages.py.   To see
> this yet another way, write a unit test for gluon/languages.py.
>
> Since examples do not behave correctly, and - in general - with Massimo's
> proposal  multiple, and constantly changing (as applications are
> installed)   points of correction must be made in order to accomplish
> reasonable behavior:  this by itself is sufficient evidence to point
> directly to the bug in gluon/languages.py.   Additionally, a suggestion that
> "examples" has a bug (it does not)  is a suggestion which breaks "backward
> compatibility"  (but backward compatibility is not the point at all here -
> that correcting a bug at its source is the proper approach is what is in
> discussion here)
>
> Once all recognize this clearly, then we can move on to talking about what a
> good solution would look like.
>
> - Yarko
>
>
>
> > -Thadeus
>
> > On Sun, Nov 22, 2009 at 10:04 PM, mdipierro wrote:
>
> >> rammer always explicitly say which languages do not need
> >> transla
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35849] Re: Maximum No of users can web2py server can support

2009-11-23 Thread harshit agrawal

But sir my portal will start at a specific time and around 200-250
users will login at the same time then the system may hang.

Also there is a file named options_std.py, in this file what does
'no_of_threads' means

reply as soon as possible

Thank You
Harshit


On Nov 23, 10:15 am, mdipierro  wrote:
> It really depends on many issues. 200 users are not going to make 1
> request/second but more like 1 request every ten seconds each or less.
> That means you need to handle 20 requests/seconds.
>
> On my laptop an average dynamic page takes ~20ms, and that means 50
> requests/second. This means I can handle 200 current users on my
> laptop.
>
> The bottleneck is always database access. It really depends on what
> those users do with the database.
>
> Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35850] Re: twitter in GAE

2009-11-23 Thread mdipierro

This looks like a bug in fetch on GAE. It is returning the twitter
page but not in JSON.
It is returning this:

   http://twitter.com/web2py

instead of this:

   http://twitter.com/web2py?format=json

One more test please:

from google.appengine.api.urlfetch import fetch
def my test():
page = fetch('http://twitter.com/
web2py',payload='format=json').content
return page

do you get JSON?


Massimo

On Nov 23, 11:22 am, Leandro - ProfessionalIT 
wrote:
> On Nov 23, 3:06 pm, mdipierro  wrote:
>
> > Sorry to do this to you
>
> Hey Master no problems ! I love Web2Py and I think our community is
> very caring.
>
> > try:
>
> > def my test():
> >     import gluon.tools
> >     page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
> >     return page
>
> > see if what fetch is getting.
>
> Look, run OK.http://www.leandro.inf.br/init/default/my_test
>
> - Leandro.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35851] Re: Maximum No of users can web2py server can support

2009-11-23 Thread mdipierro



On Nov 23, 11:36 am, harshit agrawal 
wrote:
> But sir my portal will start at a specific time and around 200-250
> users will login at the same time then the system may hang.

Is this an assumption or a fact?

> Also there is a file named options_std.py, in this file what does
> 'no_of_threads' means

that is the number of concurrent threads with wsgiserver. It should
not be relevant in a production environment.

In a production environment you should use apache2+mod_wsgi and let
Apache deal with concurrency and serving static files. You should also
use postgresql (or other database) not the default sqlite. sqlite
always locks the entire database on every request.

You can read more on this in chapter 11 of the book and the source of
this script:
http://www.web2pyslices.com/main/slices/take_slice/29

Massimo


> reply as soon as possible
>
> Thank You
> Harshit
>
> On Nov 23, 10:15 am, mdipierro  wrote:
>
> > It really depends on many issues. 200 users are not going to make 1
> > request/second but more like 1 request every ten seconds each or less.
> > That means you need to handle 20 requests/seconds.
>
> > On my laptop an average dynamic page takes ~20ms, and that means 50
> > requests/second. This means I can handle 200 current users on my
> > laptop.
>
> > The bottleneck is always database access. It really depends on what
> > those users do with the database.
>
> > Massimo
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35852] Timer

2009-11-23 Thread sandy

Sir,
I want to ask - how we can set a timer in our TA portal which we are
making with the help of web2py.
The timer will show how much time is left to close the portal.

sandeep

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



[web2py:35853] Re: Timer

2009-11-23 Thread mdipierro

I would use this:

http://plugins.jquery.com/project/jCountdown

$("#countdown").countdown({ target:"{{=target_time.isoformat()}}" });

web2py would pass the target_time as a datetime.

On Nov 23, 11:42 am, sandy  wrote:
> Sir,
> I want to ask - how we can set a timer in our TA portal which we are
> making with the help of web2py.
> The timer will show how much time is left to close the portal.
>
> sandeep
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35854] Re: twitter in GAE

2009-11-23 Thread Leandro - ProfessionalIT

Massimo,

> from google.appengine.api.urlfetch import fetch
> def my test():
>     page = fetch('http://twitter.com/
> web2py',payload='format=json').content
>     return page
>
> do you get JSON?
>
> Massimo

This function run OK (http://www.leandro.inf.br/init/default/my_test),
then I try change my function twitter to execute:

def twitter():
session.forget()
session._unlock(response)
import gluon.tools
import gluon.contrib.simplejson as sj
from google.appengine.api.urlfetch import fetch
#page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
page = fetch('http://twitter.com/
web2py',payload='format=json').content
return sj.loads(page)['#timeline']

And receive this error in log:
In FILE: /base/data/home/apps/leandro-inf/1.337960094083594016/
applications/init/controllers/default.py

Traceback (most recent call last):
  File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
restricted.py", line 184, in restricted
exec ccode in environment
  File "/base/data/home/apps/leandro-inf/1.337960094083594016/
applications/init/controllers/default.py:twitter", line 163, in

  File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
globals.py", line 102, in 
self._caller = lambda f: f()
  File "/base/data/home/apps/leandro-inf/1.337960094083594016/
applications/init/controllers/default.py:twitter", line 77, in twitter
  File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
contrib/simplejson/__init__.py", line 305, in loads
return _default_decoder.decode(s)
  File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
contrib/simplejson/decoder.py", line 329, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
contrib/simplejson/decoder.py", line 347, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


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



[web2py:35855] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
On Mon, Nov 23, 2009 at 11:33 AM, mdipierro  wrote:
..

> I still stand that those apps have a bug (because when we added
> translations I did not set the current language) not languages.py.
>

Then we must agree to disagree.

For me, it is quite evident (by tracing execution of JUST gluon/languages.py
- without consideration of any application, and BEFORE any application is
even called by gluon/main)  that languages.py selects a language based
(incorrectly) on:


   - whatever the first match is between the http_request_language  and an
   available app directory/languages translation file

The concept that you will translate "from no specified language" to some
language is in itself faulty.

IFF  the app/lanugages translation files held the target string by index,
then your argument might hold some merit.

AS IT IS, the design even of the translation files is that each translation
file contains a "dictionary" pair:  the DEFAULT LANGUAGE string as the key,
and the TARGET SERVE language string as the fetched item.

If the design you had was NOT of tranlation, but rather of serving strings /
localization  (e.g. indexed strings), then expecting to find a string file
for the http_request_language  would make some logical sense.

As it is, you are translating from a default language (which in the
distribution is 'en') to a target language.

Perhaps this is really pointing to a need to review the overall string
serving design.

For example, with an indexed based, language string file, it would be
possible to set [1] a site default language for error messages, and
simultaneously a different language for an application (I'm not sure that is
easy to do right now).

To make clear what I am talking about (as an example)

Current design is based on the concept of TRANSLATION, so that
app/langes/it-it.py (for example) holds:

'Welcome to web2py': 'Ciao da wek2py',
'click here for online examples': 'clicca per vedere gli esempi',

I am suggesting that a "serve language" concept (rather than translation)
would have some string index (rather than translation-based index), perhaps
something like this;  in place of lanugages.py, perhaps a strings/en-us.py:

controller.default[1]:'Welcome to web2py'
controller.default[2]:'click here for online examples'

and for strings/it-it.py:

controller.default[1]': 'Ciao da wek2py',
controller.default[2]: 'clicca per vedere gli esempi',

This is just for illustrative purposes...

What I am saying is how you talk about _this_ (is it a bug? is there
something missing) requires a shift - to the concept that we do not do
translations;  we serve strings in some language, and to do that you must
have the strings existing in that language  (then translation becomes a
utility function, and not a web2py term).

As it currently is, mixing these two perspectives is problematic:  Does
web2py translate (if so - then FROM which language? I need a default
language declared somewhere), or does web2py serve strings on a per-language
basis (if so, then default language is irrelevant; all I need is that one of
the http_request_languages exist).

Massimo seems to say that languages/translate.py  operates in the latter
fashion, but this is incongruent with _even_ the name of that class (class
translator), and the function T('string to translate from').

Consider how even the programming paradigm changes if you shift  to the
"serve string" concept (away from the translate model).

Of course, it is natural to talk about "translate" to a web writer;  the the
internal model does not need to follow the external structure - it can do a
engineering-layer translation to what Massimo is saying - but to do so,
there must be clear separation: "here, we think of it this way;  in gluon,
it accomplishes it this way...".

There is room for much discussion around this, but for now I believe this is
simply a bug in gluon/language.py given the current design, (e.g. names used
for classes/functions).

- Yarko

Nevertheless it is easier to change the default behavior than change
> three apps.
>
> If no objection from people overseas, I will change this in trunk.
>
> To people overseas: If your app is in polish (for example) and you
> provide an english translation, the english translation will not work
> anymore until you re-set the current language to polish. Now it does
> not make any assumption about the current language.
>
> Massimo
>
> On Nov 23, 11:12 am, Yarko Tymciurak 
> wrote:
> > On Mon, Nov 23, 2009 at 12:20 AM, Thadeus Burgess  >wrote:
> >
> > > if web2py is mostly written in English, then it needs to default to
> > > English, and allow for easy overriding of this default.
> >
> > I agree.
> >
> > More explicitly - whatever the web2py distribution default is should
> behave
> > correctly;
> >
> > If an application declares it's own default language (and it should be
> easy,
> > and clear - how should that look to the application writer?), then that
> > should override the distribution default for requests to

[web2py:35856] Re: Maximum No of users can web2py server can support

2009-11-23 Thread Thadeus Burgess
I'd assume this is in a corporate office, where the business opens in the
morning, and everybody arrives at the same time and logs in.

Id go with massimo's suggestion, along with a pound server, and some scripts
to update each instance of the panel.

-Thadeus




On Mon, Nov 23, 2009 at 11:47 AM, mdipierro  wrote:

>
>
>
> On Nov 23, 11:36 am, harshit agrawal 
> wrote:
> > But sir my portal will start at a specific time and around 200-250
> > users will login at the same time then the system may hang.
>
> Is this an assumption or a fact?
>
> > Also there is a file named options_std.py, in this file what does
> > 'no_of_threads' means
>
> that is the number of concurrent threads with wsgiserver. It should
> not be relevant in a production environment.
>
> In a production environment you should use apache2+mod_wsgi and let
> Apache deal with concurrency and serving static files. You should also
> use postgresql (or other database) not the default sqlite. sqlite
> always locks the entire database on every request.
>
> You can read more on this in chapter 11 of the book and the source of
> this script:
> http://www.web2pyslices.com/main/slices/take_slice/29
>
> Massimo
>
>
> > reply as soon as possible
> >
> > Thank You
> > Harshit
> >
> > On Nov 23, 10:15 am, mdipierro  wrote:
> >
> > > It really depends on many issues. 200 users are not going to make 1
> > > request/second but more like 1 request every ten seconds each or less.
> > > That means you need to handle 20 requests/seconds.
> >
> > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > requests/second. This means I can handle 200 current users on my
> > > laptop.
> >
> > > The bottleneck is always database access. It really depends on what
> > > those users do with the database.
> >
> > > Massimo
> >
> >
> >
>

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



[web2py:35857] Re: Maximum No of users can web2py server can support

2009-11-23 Thread harshit agrawal

This is a fact.

Sir I am almost done with all the queries in my project using the
default sqlite and now I want to put the portal on apache server. How
can we do this?

On Nov 23, 12:47 pm, mdipierro  wrote:
> On Nov 23, 11:36 am, harshit agrawal 
> wrote:
>
> > But sir my portal will start at a specific time and around 200-250
> > users will login at the same time then the system may hang.
>
> Is this an assumption or a fact?
>
> > Also there is a file named options_std.py, in this file what does
> > 'no_of_threads' means
>
> that is the number of concurrent threads with wsgiserver. It should
> not be relevant in a production environment.
>
> In a production environment you should use apache2+mod_wsgi and let
> Apache deal with concurrency and serving static files. You should also
> use postgresql (or other database) not the default sqlite. sqlite
> always locks the entire database on every request.
>
> You can read more on this in chapter 11 of the book and the source of
> this script:http://www.web2pyslices.com/main/slices/take_slice/29
>
> Massimo
>
> > reply as soon as possible
>
> > Thank You
> > Harshit
>
> > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > It really depends on many issues. 200 users are not going to make 1
> > > request/second but more like 1 request every ten seconds each or less.
> > > That means you need to handle 20 requests/seconds.
>
> > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > requests/second. This means I can handle 200 current users on my
> > > laptop.
>
> > > The bottleneck is always database access. It really depends on what
> > > those users do with the database.
>
> > > Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35858] Re: Maximum No of users can web2py server can support

2009-11-23 Thread waTR

This is farily simple. No big deal. DAL can be switched to PostgreSQL
without having to do anything other than change the line at the top of
the db.py file in MODEL.

This sounds like a school course registration system.

Definetly use the APACHE + WSGI. Also, use caching as much as possible
for your databse. Shouldn't be a problem at all.

Good luck, and let us know how it goes.



On Nov 23, 10:36 am, harshit agrawal 
wrote:
> This is a fact.
>
> Sir I am almost done with all the queries in my project using the
> default sqlite and now I want to put the portal on apache server. How
> can we do this?
>
> On Nov 23, 12:47 pm, mdipierro  wrote:
>
> > On Nov 23, 11:36 am, harshit agrawal 
> > wrote:
>
> > > But sir my portal will start at a specific time and around 200-250
> > > users will login at the same time then the system may hang.
>
> > Is this an assumption or a fact?
>
> > > Also there is a file named options_std.py, in this file what does
> > > 'no_of_threads' means
>
> > that is the number of concurrent threads with wsgiserver. It should
> > not be relevant in a production environment.
>
> > In a production environment you should use apache2+mod_wsgi and let
> > Apache deal with concurrency and serving static files. You should also
> > use postgresql (or other database) not the default sqlite. sqlite
> > always locks the entire database on every request.
>
> > You can read more on this in chapter 11 of the book and the source of
> > this script:http://www.web2pyslices.com/main/slices/take_slice/29
>
> > Massimo
>
> > > reply as soon as possible
>
> > > Thank You
> > > Harshit
>
> > > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > > It really depends on many issues. 200 users are not going to make 1
> > > > request/second but more like 1 request every ten seconds each or less.
> > > > That means you need to handle 20 requests/seconds.
>
> > > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > > requests/second. This means I can handle 200 current users on my
> > > > laptop.
>
> > > > The bottleneck is always database access. It really depends on what
> > > > those users do with the database.
>
> > > > Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35859] Re: Internationalization

2009-11-23 Thread Thadeus Burgess
I just don't want my code littered with

error_message=languages[0]

print languages[1]

alert(languages[3])

-Thadeus




On Mon, Nov 23, 2009 at 12:23 PM, Yarko Tymciurak <
resultsinsoftw...@gmail.com> wrote:

>
> On Mon, Nov 23, 2009 at 11:33 AM, mdipierro wrote:
> ..
>
>> I still stand that those apps have a bug (because when we added
>> translations I did not set the current language) not languages.py.
>>
>
> Then we must agree to disagree.
>
> For me, it is quite evident (by tracing execution of JUST
> gluon/languages.py - without consideration of any application, and BEFORE
> any application is even called by gluon/main)  that languages.py selects a
> language based (incorrectly) on:
>
>
>- whatever the first match is between the http_request_language  and an
>available app directory/languages translation file
>
> The concept that you will translate "from no specified language" to some
> language is in itself faulty.
>
> IFF  the app/lanugages translation files held the target string by index,
> then your argument might hold some merit.
>
> AS IT IS, the design even of the translation files is that each translation
> file contains a "dictionary" pair:  the DEFAULT LANGUAGE string as the key,
> and the TARGET SERVE language string as the fetched item.
>
> If the design you had was NOT of tranlation, but rather of serving strings
> / localization  (e.g. indexed strings), then expecting to find a string file
> for the http_request_language  would make some logical sense.
>
> As it is, you are translating from a default language (which in the
> distribution is 'en') to a target language.
>
> Perhaps this is really pointing to a need to review the overall string
> serving design.
>
> For example, with an indexed based, language string file, it would be
> possible to set [1] a site default language for error messages, and
> simultaneously a different language for an application (I'm not sure that is
> easy to do right now).
>
> To make clear what I am talking about (as an example)
>
> Current design is based on the concept of TRANSLATION, so that
> app/langes/it-it.py (for example) holds:
>
> 'Welcome to web2py': 'Ciao da wek2py',
> 'click here for online examples': 'clicca per vedere gli esempi',
>
> I am suggesting that a "serve language" concept (rather than translation)
> would have some string index (rather than translation-based index), perhaps
> something like this;  in place of lanugages.py, perhaps a strings/en-us.py:
>
> controller.default[1]:'Welcome to web2py'
> controller.default[2]:'click here for online examples'
>
> and for strings/it-it.py:
>
> controller.default[1]': 'Ciao da wek2py',
> controller.default[2]: 'clicca per vedere gli esempi',
>
> This is just for illustrative purposes...
>
> What I am saying is how you talk about _this_ (is it a bug? is there
> something missing) requires a shift - to the concept that we do not do
> translations;  we serve strings in some language, and to do that you must
> have the strings existing in that language  (then translation becomes a
> utility function, and not a web2py term).
>
> As it currently is, mixing these two perspectives is problematic:  Does
> web2py translate (if so - then FROM which language? I need a default
> language declared somewhere), or does web2py serve strings on a per-language
> basis (if so, then default language is irrelevant; all I need is that one of
> the http_request_languages exist).
>
> Massimo seems to say that languages/translate.py  operates in the latter
> fashion, but this is incongruent with _even_ the name of that class (class
> translator), and the function T('string to translate from').
>
> Consider how even the programming paradigm changes if you shift  to the
> "serve string" concept (away from the translate model).
>
> Of course, it is natural to talk about "translate" to a web writer;  the
> the internal model does not need to follow the external structure - it can
> do a engineering-layer translation to what Massimo is saying - but to do so,
> there must be clear separation: "here, we think of it this way;  in gluon,
> it accomplishes it this way...".
>
> There is room for much discussion around this, but for now I believe this
> is simply a bug in gluon/language.py given the current design, (e.g. names
> used for classes/functions).
>
> - Yarko
>
> Nevertheless it is easier to change the default behavior than change
>> three apps.
>>
>> If no objection from people overseas, I will change this in trunk.
>>
>> To people overseas: If your app is in polish (for example) and you
>> provide an english translation, the english translation will not work
>> anymore until you re-set the current language to polish. Now it does
>> not make any assumption about the current language.
>>
>> Massimo
>>
>> On Nov 23, 11:12 am, Yarko Tymciurak 
>> wrote:
>> > On Mon, Nov 23, 2009 at 12:20 AM, Thadeus Burgess <
>> thade...@thadeusb.com>wrote:
>> >
>> > > if web2py is mostly written in English, then it needs 

[web2py:35860] Re: Maximum No of users can web2py server can support

2009-11-23 Thread Alexandre Andrade
Web2py migrates the model of your database without problem, but not your
data.


Short tutorial

1. To export your sqlite database, use the shell:

db.export_to_csv_file(open('somefile.csv', 'wb'))


2.  create a empty postgresql database, and change
db = DAL('sqlite://storage.sqlite')

to

# db = DAL('sqlite://storage.sqlite')   # if not, use SQLite or
other DB
db = DAL("postgres://user:passw...@localhost:5432/yournewdatabase")



3. and to import:

db.import_from_csv_file(open('somefile.csv', 'rb'))



2009/11/23 harshit agrawal 

>
> This is a fact.
>
> Sir I am almost done with all the queries in my project using the
> default sqlite and now I want to put the portal on apache server. How
> can we do this?
>
> On Nov 23, 12:47 pm, mdipierro  wrote:
> > On Nov 23, 11:36 am, harshit agrawal 
> > wrote:
> >
> > > But sir my portal will start at a specific time and around 200-250
> > > users will login at the same time then the system may hang.
> >
> > Is this an assumption or a fact?
> >
> > > Also there is a file named options_std.py, in this file what does
> > > 'no_of_threads' means
> >
> > that is the number of concurrent threads with wsgiserver. It should
> > not be relevant in a production environment.
> >
> > In a production environment you should use apache2+mod_wsgi and let
> > Apache deal with concurrency and serving static files. You should also
> > use postgresql (or other database) not the default sqlite. sqlite
> > always locks the entire database on every request.
> >
> > You can read more on this in chapter 11 of the book and the source of
> > this script:http://www.web2pyslices.com/main/slices/take_slice/29
> >
> > Massimo
> >
> > > reply as soon as possible
> >
> > > Thank You
> > > Harshit
> >
> > > On Nov 23, 10:15 am, mdipierro  wrote:
> >
> > > > It really depends on many issues. 200 users are not going to make 1
> > > > request/second but more like 1 request every ten seconds each or
> less.
> > > > That means you need to handle 20 requests/seconds.
> >
> > > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > > requests/second. This means I can handle 200 current users on my
> > > > laptop.
> >
> > > > The bottleneck is always database access. It really depends on what
> > > > those users do with the database.
> >
> > > > Massimo
> >
>


-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

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



[web2py:35861] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
On Mon, Nov 23, 2009 at 12:47 PM, Thadeus Burgess wrote:

> I just don't want my code littered with
>
> error_message=languages[0]
>
> print languages[1]
>
> alert(languages[3])
>

:-)

I agre, that would TRULY be terrible!

If anything, if Massimo would want to go in that direction (instead of
firmly back in the "translation" concept; latter has some distinct
advantages down at the gluon level)  then this kind of stuff would have to
happen "behind the scenes", in gluon.

- Yarko

>
> -Thadeus
>
>
>
>
>
> On Mon, Nov 23, 2009 at 12:23 PM, Yarko Tymciurak <
> resultsinsoftw...@gmail.com> wrote:
>
>>
>> On Mon, Nov 23, 2009 at 11:33 AM, mdipierro wrote:
>> ..
>>
>>> I still stand that those apps have a bug (because when we added
>>> translations I did not set the current language) not languages.py.
>>>
>>
>> Then we must agree to disagree.
>>
>> For me, it is quite evident (by tracing execution of JUST
>> gluon/languages.py - without consideration of any application, and BEFORE
>> any application is even called by gluon/main)  that languages.py selects a
>> language based (incorrectly) on:
>>
>>
>>- whatever the first match is between the http_request_language  and
>>an available app directory/languages translation file
>>
>> The concept that you will translate "from no specified language" to some
>> language is in itself faulty.
>>
>> IFF  the app/lanugages translation files held the target string by index,
>> then your argument might hold some merit.
>>
>> AS IT IS, the design even of the translation files is that each
>> translation file contains a "dictionary" pair:  the DEFAULT LANGUAGE string
>> as the key, and the TARGET SERVE language string as the fetched item.
>>
>> If the design you had was NOT of tranlation, but rather of serving strings
>> / localization  (e.g. indexed strings), then expecting to find a string file
>> for the http_request_language  would make some logical sense.
>>
>> As it is, you are translating from a default language (which in the
>> distribution is 'en') to a target language.
>>
>> Perhaps this is really pointing to a need to review the overall string
>> serving design.
>>
>> For example, with an indexed based, language string file, it would be
>> possible to set [1] a site default language for error messages, and
>> simultaneously a different language for an application (I'm not sure that is
>> easy to do right now).
>>
>> To make clear what I am talking about (as an example)
>>
>> Current design is based on the concept of TRANSLATION, so that
>> app/langes/it-it.py (for example) holds:
>>
>> 'Welcome to web2py': 'Ciao da wek2py',
>> 'click here for online examples': 'clicca per vedere gli esempi',
>>
>> I am suggesting that a "serve language" concept (rather than translation)
>> would have some string index (rather than translation-based index), perhaps
>> something like this;  in place of lanugages.py, perhaps a strings/en-us.py:
>>
>> controller.default[1]:'Welcome to web2py'
>> controller.default[2]:'click here for online examples'
>>
>> and for strings/it-it.py:
>>
>> controller.default[1]': 'Ciao da wek2py',
>> controller.default[2]: 'clicca per vedere gli esempi',
>>
>> This is just for illustrative purposes...
>>
>> What I am saying is how you talk about _this_ (is it a bug? is there
>> something missing) requires a shift - to the concept that we do not do
>> translations;  we serve strings in some language, and to do that you must
>> have the strings existing in that language  (then translation becomes a
>> utility function, and not a web2py term).
>>
>> As it currently is, mixing these two perspectives is problematic:  Does
>> web2py translate (if so - then FROM which language? I need a default
>> language declared somewhere), or does web2py serve strings on a per-language
>> basis (if so, then default language is irrelevant; all I need is that one of
>> the http_request_languages exist).
>>
>> Massimo seems to say that languages/translate.py  operates in the latter
>> fashion, but this is incongruent with _even_ the name of that class (class
>> translator), and the function T('string to translate from').
>>
>> Consider how even the programming paradigm changes if you shift  to the
>> "serve string" concept (away from the translate model).
>>
>> Of course, it is natural to talk about "translate" to a web writer;  the
>> the internal model does not need to follow the external structure - it can
>> do a engineering-layer translation to what Massimo is saying - but to do so,
>> there must be clear separation: "here, we think of it this way;  in gluon,
>> it accomplishes it this way...".
>>
>> There is room for much discussion around this, but for now I believe this
>> is simply a bug in gluon/language.py given the current design, (e.g. names
>> used for classes/functions).
>>
>> - Yarko
>>
>> Nevertheless it is easier to change the default behavior than change
>>> three apps.
>>>
>>> If no objection from people overseas, I will change this in trunk.
>>>

[web2py:35862] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
On Mon, Nov 23, 2009 at 12:56 PM, Yarko Tymciurak <
resultsinsoftw...@gmail.com> wrote:

> On Mon, Nov 23, 2009 at 12:47 PM, Thadeus Burgess 
> wrote:
>
>> I just don't want my code littered with
>>
>> error_message=languages[0]
>>
>> print languages[1]
>>
>> alert(languages[3])
>>
>
> :-)
>
> I agree, that would TRULY be terrible!
>
> If anything, if Massimo would want to go in that direction (instead of
> firmly back in the "translation" concept; latter has some distinct
> advantages down at the gluon level)  then this kind of stuff would have to
> happen "behind the scenes", in gluon.
>

... to make this comment more concrete - it is one of clear, crisp concept,
approach than anything - about being intentional and explicit.

So, consider now what you have "littered" (and it's quite readable, I
think):

error_message=T("This is an error message.")

print message['some_context')

alert(T("Hey! Please don't do this!")





>
> - Yarko
>
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Mon, Nov 23, 2009 at 12:23 PM, Yarko Tymciurak <
>> resultsinsoftw...@gmail.com> wrote:
>>
>>>
>>> On Mon, Nov 23, 2009 at 11:33 AM, mdipierro wrote:
>>> ..
>>>
 I still stand that those apps have a bug (because when we added
 translations I did not set the current language) not languages.py.

>>>
>>> Then we must agree to disagree.
>>>
>>> For me, it is quite evident (by tracing execution of JUST
>>> gluon/languages.py - without consideration of any application, and BEFORE
>>> any application is even called by gluon/main)  that languages.py selects a
>>> language based (incorrectly) on:
>>>
>>>
>>>- whatever the first match is between the http_request_language  and
>>>an available app directory/languages translation file
>>>
>>> The concept that you will translate "from no specified language" to some
>>> language is in itself faulty.
>>>
>>> IFF  the app/lanugages translation files held the target string by index,
>>> then your argument might hold some merit.
>>>
>>> AS IT IS, the design even of the translation files is that each
>>> translation file contains a "dictionary" pair:  the DEFAULT LANGUAGE string
>>> as the key, and the TARGET SERVE language string as the fetched item.
>>>
>>> If the design you had was NOT of tranlation, but rather of serving
>>> strings / localization  (e.g. indexed strings), then expecting to find a
>>> string file for the http_request_language  would make some logical sense.
>>>
>>> As it is, you are translating from a default language (which in the
>>> distribution is 'en') to a target language.
>>>
>>> Perhaps this is really pointing to a need to review the overall string
>>> serving design.
>>>
>>> For example, with an indexed based, language string file, it would be
>>> possible to set [1] a site default language for error messages, and
>>> simultaneously a different language for an application (I'm not sure that is
>>> easy to do right now).
>>>
>>> To make clear what I am talking about (as an example)
>>>
>>> Current design is based on the concept of TRANSLATION, so that
>>> app/langes/it-it.py (for example) holds:
>>>
>>> 'Welcome to web2py': 'Ciao da wek2py',
>>> 'click here for online examples': 'clicca per vedere gli esempi',
>>>
>>> I am suggesting that a "serve language" concept (rather than translation)
>>> would have some string index (rather than translation-based index), perhaps
>>> something like this;  in place of lanugages.py, perhaps a strings/en-us.py:
>>>
>>> controller.default[1]:'Welcome to web2py'
>>> controller.default[2]:'click here for online examples'
>>>
>>> and for strings/it-it.py:
>>>
>>> controller.default[1]': 'Ciao da wek2py',
>>> controller.default[2]: 'clicca per vedere gli esempi',
>>>
>>> This is just for illustrative purposes...
>>>
>>> What I am saying is how you talk about _this_ (is it a bug? is there
>>> something missing) requires a shift - to the concept that we do not do
>>> translations;  we serve strings in some language, and to do that you must
>>> have the strings existing in that language  (then translation becomes a
>>> utility function, and not a web2py term).
>>>
>>> As it currently is, mixing these two perspectives is problematic:  Does
>>> web2py translate (if so - then FROM which language? I need a default
>>> language declared somewhere), or does web2py serve strings on a per-language
>>> basis (if so, then default language is irrelevant; all I need is that one of
>>> the http_request_languages exist).
>>>
>>> Massimo seems to say that languages/translate.py  operates in the latter
>>> fashion, but this is incongruent with _even_ the name of that class (class
>>> translator), and the function T('string to translate from').
>>>
>>> Consider how even the programming paradigm changes if you shift  to the
>>> "serve string" concept (away from the translate model).
>>>
>>> Of course, it is natural to talk about "translate" to a web writer;  the
>>> the internal model does not need to follow the external structure - it can
>>> do

[web2py:35863] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
On Mon, Nov 23, 2009 at 12:59 PM, Yarko Tymciurak <
resultsinsoftw...@gmail.com> wrote:

>
>
> On Mon, Nov 23, 2009 at 12:56 PM, Yarko Tymciurak <
> resultsinsoftw...@gmail.com> wrote:
>
>> On Mon, Nov 23, 2009 at 12:47 PM, Thadeus Burgess 
>> wrote:
>>
>>> I just don't want my code littered with
>>>
>>> error_message=languages[0]
>>>
>>> print languages[1]
>>>
>>> alert(languages[3])
>>>
>>
>> :-)
>>
>> I agree, that would TRULY be terrible!
>>
>>
>> If anything, if Massimo would want to go in that direction (instead of
>> firmly back in the "translation" concept; latter has some distinct
>> advantages down at the gluon level)  then this kind of stuff would have to
>> happen "behind the scenes", in gluon.
>>
>
> ... to make this comment more concrete - it is one of clear, crisp concept,
> approach than anything - about being intentional and explicit.
>
> So, consider now what you have "littered" (and it's quite readable, I
> think):
>
> error_message=T("This is an error message.")
>
> print message['some_context')
>
> alert(T("Hey! Please don't do this!")
>


(sorry - hit send prematurely)... so I'm suggesting  some new, crisp
concept, but of the same form; perhaps something like:

T.default_language('it')   # if you don't declare it in your app, it will be
'en-us' by default;
...
error_message=T("This is an error message.")

print message['some_context')

@T.use_language('pl')   # some temporary overide, only for the next block of
code
alert(T("To jest komunikat o błędzie"))

How gluon finds any of these string is not important to the application
writer.  What is important in this example:  by shifting (at gluon level) to
a string-serving concept, and away from a translation concept - the last
message (in Polish) does NOT need to exist at all in en.py;

This raises some questions, as well as opens some doors.  For example:
Q: what language file would some tool put the last fine into?
A: Well - the language of the current context (pl.py in this case).

Q: How would I create an English translation of this?
A: WIth tools; the underlying implementation should be hidden from the
application writer.

Q:  What happens if I change the decorator to 'en'?
A:  Good question (e.g. with this new "concept" of contexts for language,
what would be reasonable behavior?)

 and so on...

But my biggest point: we are currently in the "translate" model, and should
be careful to be explicit about that, since any crossing over the line to
"serve-string" style of thinking about this requires new questions we have
not even asked yet.  We _might_ want to do that;  it _might_ offer something
useful, but right now, what is implemented is too fuzzy, and needs to get
crisper - pick a way, and stick with it.

- Yarko


>
>
>
>
>>
>> - Yarko
>>
>>>
>>> -Thadeus
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Nov 23, 2009 at 12:23 PM, Yarko Tymciurak <
>>> resultsinsoftw...@gmail.com> wrote:
>>>

 On Mon, Nov 23, 2009 at 11:33 AM, mdipierro wrote:
 ..

> I still stand that those apps have a bug (because when we added
> translations I did not set the current language) not languages.py.
>

 Then we must agree to disagree.

 For me, it is quite evident (by tracing execution of JUST
 gluon/languages.py - without consideration of any application, and BEFORE
 any application is even called by gluon/main)  that languages.py selects a
 language based (incorrectly) on:


- whatever the first match is between the http_request_language  and
an available app directory/languages translation file

 The concept that you will translate "from no specified language" to some
 language is in itself faulty.

 IFF  the app/lanugages translation files held the target string by
 index, then your argument might hold some merit.

 AS IT IS, the design even of the translation files is that each
 translation file contains a "dictionary" pair:  the DEFAULT LANGUAGE string
 as the key, and the TARGET SERVE language string as the fetched item.

 If the design you had was NOT of tranlation, but rather of serving
 strings / localization  (e.g. indexed strings), then expecting to find a
 string file for the http_request_language  would make some logical sense.

 As it is, you are translating from a default language (which in the
 distribution is 'en') to a target language.

 Perhaps this is really pointing to a need to review the overall string
 serving design.

 For example, with an indexed based, language string file, it would be
 possible to set [1] a site default language for error messages, and
 simultaneously a different language for an application (I'm not sure that 
 is
 easy to do right now).

 To make clear what I am talking about (as an example)

 Current design is based on the concept of TRANSLATION, so that
 app/langes/it-it.py (for example) holds:

 'Welco

[web2py:35864] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
2009/11/23 Yarko Tymciurak 

> On Mon, Nov 23, 2009 at 12:59 PM, Yarko Tymciurak <
> resultsinsoftw...@gmail.com> wrote:
>
>>
>>
>> On Mon, Nov 23, 2009 at 12:56 PM, Yarko Tymciurak <
>> resultsinsoftw...@gmail.com> wrote:
>>
>>> On Mon, Nov 23, 2009 at 12:47 PM, Thadeus Burgess >> > wrote:
>>>
 I just don't want my code littered with

 error_message=languages[0]

 print languages[1]

 alert(languages[3])

>>>
>>> :-)
>>>
>>> I agree, that would TRULY be terrible!
>>>
>>>
>>> If anything, if Massimo would want to go in that direction (instead of
>>> firmly back in the "translation" concept; latter has some distinct
>>> advantages down at the gluon level)  then this kind of stuff would have to
>>> happen "behind the scenes", in gluon.
>>>
>>
>> ... to make this comment more concrete - it is one of clear, crisp
>> concept, approach than anything - about being intentional and explicit.
>>
>> So, consider now what you have "littered" (and it's quite readable, I
>> think):
>>
>> error_message=T("This is an error message.")
>>
>> print message['some_context')
>>
>
sorry - probably should have been something like this:

print T(message['some_context'])

>
>> alert(T("Hey! Please don't do this!")
>>
>
>
> (sorry - hit send prematurely)... so I'm suggesting  some new, crisp
> concept, but of the same form; perhaps something like:
>
> T.default_language('it')   # if you don't declare it in your app, it will
> be 'en-us' by default;
> ...
>
> error_message=T("This is an error message.")
>
> print message['some_context')
>
> @T.use_language('pl')   # some temporary overide, only for the next block
> of code
> alert(T("To jest komunikat o błędzie"))
>
> How gluon finds any of these string is not important to the application
> writer.  What is important in this example:  by shifting (at gluon level) to
> a string-serving concept, and away from a translation concept - the last
> message (in Polish) does NOT need to exist at all in en.py;
>
> This raises some questions, as well as opens some doors.  For example:
> Q: what language file would some tool put the last fine into?
> A: Well - the language of the current context (pl.py in this case).
>
> Q: How would I create an English translation of this?
> A: WIth tools; the underlying implementation should be hidden from the
> application writer.
>
> Q:  What happens if I change the decorator to 'en'?
> A:  Good question (e.g. with this new "concept" of contexts for language,
> what would be reasonable behavior?)
>
>  and so on...
>
> But my biggest point: we are currently in the "translate" model, and should
> be careful to be explicit about that, since any crossing over the line to
> "serve-string" style of thinking about this requires new questions we have
> not even asked yet.  We _might_ want to do that;  it _might_ offer something
> useful, but right now, what is implemented is too fuzzy, and needs to get
> crisper - pick a way, and stick with it.
>
> - Yarko
>
>
>>
>>
>>
>>
>>>
>>> - Yarko
>>>

 -Thadeus





 On Mon, Nov 23, 2009 at 12:23 PM, Yarko Tymciurak <
 resultsinsoftw...@gmail.com> wrote:

>
> On Mon, Nov 23, 2009 at 11:33 AM, mdipierro 
> wrote:
> ..
>
>> I still stand that those apps have a bug (because when we added
>> translations I did not set the current language) not languages.py.
>>
>
> Then we must agree to disagree.
>
> For me, it is quite evident (by tracing execution of JUST
> gluon/languages.py - without consideration of any application, and BEFORE
> any application is even called by gluon/main)  that languages.py selects a
> language based (incorrectly) on:
>
>
>- whatever the first match is between the http_request_language
>and an available app directory/languages translation file
>
> The concept that you will translate "from no specified language" to
> some language is in itself faulty.
>
> IFF  the app/lanugages translation files held the target string by
> index, then your argument might hold some merit.
>
> AS IT IS, the design even of the translation files is that each
> translation file contains a "dictionary" pair:  the DEFAULT LANGUAGE 
> string
> as the key, and the TARGET SERVE language string as the fetched item.
>
> If the design you had was NOT of tranlation, but rather of serving
> strings / localization  (e.g. indexed strings), then expecting to find a
> string file for the http_request_language  would make some logical sense.
>
> As it is, you are translating from a default language (which in the
> distribution is 'en') to a target language.
>
> Perhaps this is really pointing to a need to review the overall string
> serving design.
>
> For example, with an indexed based, language string file, it would be
> possible to set [1] a site default language for error messages, an

[web2py:35865] Re: Web2Py Multi-site

2009-11-23 Thread mdipierro



On Nov 23, 11:21 am, David  wrote:
> Layouts should depend on the domain.
>
> But I don't want to have 50+ installations per server that need to be
> update manually when I make changes to the code or bring enhancements.
>
> They don't need appadmin. I am writing a control panel for them to
> manage users.
>
> Would it not be possible to share a single web2py installation for
> multiple vhosts so I only need to update one directory on each server?

Yes you can. You never need more than one web2py installation.
- You can have multiple apps under one web2py installation and map
them ti different vhosts (in this case apache does the mapping)
- You can have one app with multiple layouts depending on the vhosts
but in this case (in this case web2py does the mapping)
- You can have one layout.html and different CSS files depending on
the vhosts

The best way really depends on what the differences are and who is
allowed to edit these differences. Are they set once for all? Do you
need to add more? Are the differences just in color and images or are
they differences in the actual HTML?

have you looked into http://web2py.com/layouts ?

> On Nov 23, 10:15 am, mdipierro  wrote:
>
> > You should consider different approached depending on whether the
> > layout depends on the domain or the user. If it depends on the domain
> > and it is fixed for domain, I suggest different web2py apps with
> > different set of views that talk to the same db. Usevirtualhosts to
> > map domain into app. If the are per user, I would make the CSS dynamic
> > and retrieve it from the a database based on user preferences.
>
> > On Nov 2, 2:28 pm, David Henry  wrote:
>
> > > Hi Thadeus,
>
> > > Did you happen to have the information on how to set this up?
>
> > > I wanted one web2py with multiple applications that serve unique views/
> > > html/css to users based on the domain used to access the site so users  
> > > can customize the look and feel to their tastes.
>
> > > Thanks,
> > > David
>
> > > On Nov 1, 2009, at 7:41 PM, Thadeus Burgess wrote:
>
> > > > I use virtualhosts on a per domain basis. You are wanting the same  
> > > > app, with the same data, but different layouts depending on domain,  
> > > > or do you want two completely separate apps per domain?
>
> > > > -Thadeus
>
> > > > On Sun, Nov 1, 2009 at 7:12 PM, David Henry  
> > > >  wrote:
> > > > uld I need symlinks to the virtualhost directory as we
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35866] Re: twitter in GAE

2009-11-23 Thread mdipierro

One more try. I think I understand the problem now. Here is a possible
solution:

def twitter():
session.forget()
session._unlock(response)
import gluon.tools
import gluon.contrib.simplejson as sj
from google.appengine.api.urlfetch import fetch
#page = gluon.tools.fetch('http://twitter.com/web2py?
format=json')
page = fetch('http://twitter.com/web2py?format=json').content
return sj.loads(page)['#timeline']

does it work?

On Nov 23, 12:09 pm, Leandro - ProfessionalIT 
wrote:
> Massimo,
>
> > from google.appengine.api.urlfetch import fetch
> > def my test():
> >     page = fetch('http://twitter.com/
> > web2py',payload='format=json').content
> >     return page
>
> > do you get JSON?
>
> > Massimo
>
> This function run OK (http://www.leandro.inf.br/init/default/my_test),
> then I try change my function twitter to execute:
>
> def twitter():
>         session.forget()
>         session._unlock(response)
>         import gluon.tools
>         import gluon.contrib.simplejson as sj
>         from google.appengine.api.urlfetch import fetch
>         #page = gluon.tools.fetch('http://twitter.com/web2py?format=json')
>         page = fetch('http://twitter.com/
> web2py',payload='format=json').content
>         return sj.loads(page)['#timeline']
>
> And receive this error in log:
> In FILE: /base/data/home/apps/leandro-inf/1.337960094083594016/
> applications/init/controllers/default.py
>
> Traceback (most recent call last):
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
> restricted.py", line 184, in restricted
>     exec ccode in environment
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/
> applications/init/controllers/default.py:twitter", line 163, in
> 
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
> globals.py", line 102, in 
>     self._caller = lambda f: f()
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/
> applications/init/controllers/default.py:twitter", line 77, in twitter
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
> contrib/simplejson/__init__.py", line 305, in loads
>     return _default_decoder.decode(s)
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
> contrib/simplejson/decoder.py", line 329, in decode
>     obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File "/base/data/home/apps/leandro-inf/1.337960094083594016/gluon/
> contrib/simplejson/decoder.py", line 347, in raw_decode
>     raise ValueError("No JSON object could be decoded")
> ValueError: No JSON object could be decoded
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35867] Re: Maximum No of users can web2py server can support

2009-11-23 Thread mdipierro

What is current setup? Windows binary? Do you know linux?

On Nov 23, 12:36 pm, harshit agrawal 
wrote:
> This is a fact.
>
> Sir I am almost done with all the queries in my project using the
> default sqlite and now I want to put the portal on apache server. How
> can we do this?
>
> On Nov 23, 12:47 pm, mdipierro  wrote:
>
> > On Nov 23, 11:36 am, harshit agrawal 
> > wrote:
>
> > > But sir my portal will start at a specific time and around 200-250
> > > users will login at the same time then the system may hang.
>
> > Is this an assumption or a fact?
>
> > > Also there is a file named options_std.py, in this file what does
> > > 'no_of_threads' means
>
> > that is the number of concurrent threads with wsgiserver. It should
> > not be relevant in a production environment.
>
> > In a production environment you should use apache2+mod_wsgi and let
> > Apache deal with concurrency and serving static files. You should also
> > use postgresql (or other database) not the default sqlite. sqlite
> > always locks the entire database on every request.
>
> > You can read more on this in chapter 11 of the book and the source of
> > this script:http://www.web2pyslices.com/main/slices/take_slice/29
>
> > Massimo
>
> > > reply as soon as possible
>
> > > Thank You
> > > Harshit
>
> > > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > > It really depends on many issues. 200 users are not going to make 1
> > > > request/second but more like 1 request every ten seconds each or less.
> > > > That means you need to handle 20 requests/seconds.
>
> > > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > > requests/second. This means I can handle 200 current users on my
> > > > laptop.
>
> > > > The bottleneck is always database access. It really depends on what
> > > > those users do with the database.
>
> > > > Massimo
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35868] Re: twitter in GAE

2009-11-23 Thread Leandro - ProfessionalIT

Massimo,
> def twitter():
>         session.forget()
>         session._unlock(response)
>         import gluon.tools
>         import gluon.contrib.simplejson as sj
>         from google.appengine.api.urlfetch import fetch
>         #page = gluon.tools.fetch('http://twitter.com/web2py?
> format=json')
>         page = fetch('http://twitter.com/web2py?format=json').content
>         return sj.loads(page)['#timeline']
>
> does it work?

Yes !, perfect master this function run's OK.

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



[web2py:35869] Re: twitter in GAE

2009-11-23 Thread mdipierro

Looks like you found a bug in gluon.tools.fetch (I remember testing
this, perhaps they changed the behavior of GAE fetch? whatever). I
fixed it in trunk and your original code should work as originally
intended.

On Nov 23, 1:49 pm, Leandro - ProfessionalIT 
wrote:
> Massimo,
>
> > def twitter():
> >         session.forget()
> >         session._unlock(response)
> >         import gluon.tools
> >         import gluon.contrib.simplejson as sj
> >         from google.appengine.api.urlfetch import fetch
> >         #page = gluon.tools.fetch('http://twitter.com/web2py?
> > format=json')
> >         page = fetch('http://twitter.com/web2py?format=json').content
> >         return sj.loads(page)['#timeline']
>
> > does it work?
>
> Yes !, perfect master this function run's OK.
>
> Thank's by your great help !.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35870] Re: Internationalization

2009-11-23 Thread mdipierro

Yarko's patch is tentatively in trunk since nobody seems to complain
about this change in behavior.

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



[web2py:35871] Re: Internationalization

2009-11-23 Thread Thadeus Burgess
I'm not sure if changing the underlying workings of T is really necessary.
What are the Pro's and Con's of each system (translation vs string serving).
Mainly, what are the Con's with the current implementation that a new
underlying system would fix?

Does it make creating new language files easier? Does it make implementing
i8n easier?


The biggest question I have is Can I stick my language file into google
translate and get the translated strings back in a usable format by web2py?

-Thadeus




On Mon, Nov 23, 2009 at 2:25 PM, mdipierro  wrote:

>
> Yarko's patch is tentatively in trunk since nobody seems to complain
> about this change in behavior.
>
> Massimo
> >
>

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



[web2py:35872] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
just to repeat (again) --- pointing out this difference in fundamental
paradigm:  translation vs. string-serving
was not to suggest we make a change (at this point) but rather to point out
the necessity to be explicit and crisp about describing what we _have_
chosen to do (as not having this boundary clear can create, and in this case
has, bugs).

In summary, this is my most direct explanation for precisely why being
explicit about a default language in the current paradigm is important for
reasonable, correct behavior.

- Yarko

On Mon, Nov 23, 2009 at 3:01 PM, Yarko Tymciurak  wrote:

> On Mon, Nov 23, 2009 at 2:55 PM, Thadeus Burgess wrote:
>
>> I'm not sure if changing the underlying workings of T is really necessary.
>> What are the Pro's and Con's of each system (translation vs string serving).
>> Mainly, what are the Con's with the current implementation that a new
>> underlying system would fix?
>>
>
> The change in "concept" would not "FIX" anything; it would add a new
> possibility (I think):  Having context-specific language settings, e.g.
> right now you cannot have an english web2py site serving (say) a "Learn
> Polish" tutorial applicaiton where that app's content is in Polish (can do
> that now), but the messages, help, etc. are in the default site language
> (for example, English).
>
> A shift to string-serving vs. one level translation would enable this.
> (There may be other ways to accomplish this).
>
>
>> Does it make creating new language files easier? Does it make implementing
>> i8n easier?
>>
>
> No.  Only makes shifting language contexts during runtime / w/in an app
> possible (and possibly other things).
>
>
>>
>>
>> The biggest question I have is Can I stick my language file into
>> google translate and get the translated strings back in a usable format by
>> web2py?
>>
>
> Either way, I think this would not be affected.
>
> - Yarko
>
>>
>> -Thadeus
>>
>>
>>
>>
>>
>> On Mon, Nov 23, 2009 at 2:25 PM, mdipierro wrote:
>>
>>>
>>> Yarko's patch is tentatively in trunk since nobody seems to complain
>>> about this change in behavior.
>>>
>>> Massimo
>>>
>>>
>>
>> >>
>>
>

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



[web2py:35873] Re: Internationalization

2009-11-23 Thread mdipierro

This is a different than addressed in this thread. Please open a
different thread if you want to discuss that.

A web2py translation is a dictionary that maps original strings into
translated strings. You can write an interface to google translate
simply.

On Nov 23, 2:55 pm, Thadeus Burgess  wrote:
> I'm not sure if changing the underlying workings of T is really necessary.
> What are the Pro's and Con's of each system (translation vs string serving).
> Mainly, what are the Con's with the current implementation that a new
> underlying system would fix?
>
> Does it make creating new language files easier? Does it make implementing
> i8n easier?
>
> The biggest question I have is Can I stick my language file into google
> translate and get the translated strings back in a usable format by web2py?
>
> -Thadeus
>
> On Mon, Nov 23, 2009 at 2:25 PM, mdipierro  wrote:
>
> > Yarko's patch is tentatively in trunk since nobody seems to complain
> > about this change in behavior.
>
> > Massimo
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35874] Re: Internationalization

2009-11-23 Thread Yarko Tymciurak
FYI -

This should not impact anyone;  if a clent browses your site with multiple
language preferences (which will probably not be the majority of visitors),
then those people will have correct language selection (that is the fix).

If you have a site in some language, and it is other than English, AND you
have a translation file for English, you will want to be aware of the
following (for the purpose of discussion, I will assume an app written in
Italien, but the same will hold for other non-English apps):

   - If there is no italian translation file people browsing in Itailan will
   still see Italian (although now gluon will assume this is English, the
   behavior should that it will do NOTHING with languages files, but rather
   display the default - in this case, your apps Italian - strings)
   - COULD SOMEONE CHECK THIS AND REPORT:   If there is an English
   translation file, and you have not declared / forced any language in your
   app (e.g. in db.py or 0.py), then the displayed language will be still be
   Italian (since the "default" language to gluon will be english, the selected
   language - Italian - will not have a translation file, so the default
   behavior will be to do nothing, no translation file - and so you should be
   displaying the "native" app strings, with no access of the translation file.
  - HOWEVER:  if the client has multiple languages set, and ONE of them
  has a translation file, this will be the displayed language.
For example:
  If client has prefernce languages (in order): Italian, English,
AND there is
  an English translation file, ENGLISH will be serverd.
  - Since this will be NEW and NOT DESIRED (and also not the usual
  case), you will need to update your app to declare / force Italian as the
  default language, either of these ways:
 - in db.py (or 0.py, or any early controller), add:
- T.current_languages=['it-it']  # replace with what your app is
using for language
T.force(T.http_accept_language)
 - new (I added, because I like it saying what it is doing more
 clearly; it is equivalent functionaly to the above):
 - T.app_default_languages('it-it')   # since current_languages can
 be multiple, so can this

So this ONE SPECIAL CASE is the only where you will want to change your
app.   SInce this is ALSO the case where clients (multiple language choices)
will have "incorrect" language behavior, either way it is a bug for those
clients, and you would have to make this same kind of change for them
regardless.  This patch just REDUCES the number of times you need to worry
about this.

I hope this helps.

Regards,

- Yarko

On Mon, Nov 23, 2009 at 2:25 PM, mdipierro  wrote:

>
> Yarko's patch is tentatively in trunk since nobody seems to complain
> about this change in behavior.
>
> Massimo
> >
>

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



[web2py:35875] Running query in default.py using urllib

2009-11-23 Thread Yash

When I run some function in web2py by opening it's url in browser i
get the output.
But when i run the url using urllib module in python using python code
It doesn't give output.
say application name is TLS
and in default.py i have made a function trial as
def trial():
print "yash"
return dict()
by opening the url
http://172.17.11.243/TLS/default/trial
query runs and output comes i.e. yash gets printed on terminal.
but see the code try.py
try.py as given below
import urllib
urllib.urlopen('http://172.17.11.243/TLS/default/trial')
python try.py doesn't give output i.e. it doesn't print yash on
terminal.
I don't know why is this happening

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



[web2py:35876] Re: Maximum No of users can web2py server can support

2009-11-23 Thread waTR

Someone needs to do a wiki entry for HIGH PERFORMANCE web2py setup.

I.e. Apache + WSGI + Postgre/MySQL + Query Cache code + Page Cache
code.
A simple program that could be made for this is an app for allowing
students to register for classes.
Requirements:
Super user can: add classes, change classes (time, section, prof,
etc.), view classes, lock classes (i.e. no additional registrations
allowed), set maximum # students per class (after which additional
students added to waitlist--when some registered student drops, FIFO
method for registering students on waitlist).
Student user can: add classes to time-table, check for pre-requisites,
check for conflicts in schedule, view schedule, join waitlist.

I'm already writing an app, but would totally make this as it is
EXTREMELY useful for schools. Lots of schools have problems with their
registration system being too slow. This includes private lesson and
adult education programs...this is also especially useful with OBAMA's
announcement today about more funding for schools ;)



On Nov 23, 11:35 am, mdipierro  wrote:
> What is current setup? Windows binary? Do you know linux?
>
> On Nov 23, 12:36 pm, harshit agrawal 
> wrote:
>
> > This is a fact.
>
> > Sir I am almost done with all the queries in my project using the
> > default sqlite and now I want to put the portal on apache server. How
> > can we do this?
>
> > On Nov 23, 12:47 pm, mdipierro  wrote:
>
> > > On Nov 23, 11:36 am, harshit agrawal 
> > > wrote:
>
> > > > But sir my portal will start at a specific time and around 200-250
> > > > users will login at the same time then the system may hang.
>
> > > Is this an assumption or a fact?
>
> > > > Also there is a file named options_std.py, in this file what does
> > > > 'no_of_threads' means
>
> > > that is the number of concurrent threads with wsgiserver. It should
> > > not be relevant in a production environment.
>
> > > In a production environment you should use apache2+mod_wsgi and let
> > > Apache deal with concurrency and serving static files. You should also
> > > use postgresql (or other database) not the default sqlite. sqlite
> > > always locks the entire database on every request.
>
> > > You can read more on this in chapter 11 of the book and the source of
> > > this script:http://www.web2pyslices.com/main/slices/take_slice/29
>
> > > Massimo
>
> > > > reply as soon as possible
>
> > > > Thank You
> > > > Harshit
>
> > > > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > > > It really depends on many issues. 200 users are not going to make 1
> > > > > request/second but more like 1 request every ten seconds each or less.
> > > > > That means you need to handle 20 requests/seconds.
>
> > > > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > > > requests/second. This means I can handle 200 current users on my
> > > > > laptop.
>
> > > > > The bottleneck is always database access. It really depends on what
> > > > > those users do with the database.
>
> > > > > Massimo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35877] Languages integration with Google Translate

2009-11-23 Thread Thadeus Burgess
I am doing a case study on determining the viability for integrating google
translate into web2py.

I would like any input or ideas from the community, currently my line of
thinking is to have a controller that will post queries to googles translate
form, and then place the results in the languages/...py files.

Google also has the following, javascript page translator. There is a little
lag as google translates the page, however everything seems to work
perfectly after the fact. Any reasons for not including this in your page?
How does it effect international users to your site, would they appreciate
it or hate it?

http://translate.google.com/translate_tools

-Thadeus

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



[web2py:35878] Re: Running query in default.py using urllib

2009-11-23 Thread Thadeus Burgess
lines = urllib.urlopen(url).read()
print lines

-Thadeus




On Mon, Nov 23, 2009 at 3:30 PM, Yash  wrote:

>
> When I run some function in web2py by opening it's url in browser i
> get the output.
> But when i run the url using urllib module in python using python code
> It doesn't give output.
> say application name is TLS
> and in default.py i have made a function trial as
> def trial():
>print "yash"
>return dict()
> by opening the url
> http://172.17.11.243/TLS/default/trial
> query runs and output comes i.e. yash gets printed on terminal.
> but see the code try.py
> try.py as given below
> import urllib
> urllib.urlopen('http://172.17.11.243/TLS/default/trial')
> python try.py doesn't give output i.e. it doesn't print yash on
> terminal.
> I don't know why is this happening
>
> >
>

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



[web2py:35879] Re: Maximum No of users can web2py server can support

2009-11-23 Thread Thadeus Burgess
We have articles about this on web2pyslices.com... Three to be exact.

-Thadeus




On Mon, Nov 23, 2009 at 3:45 PM, waTR  wrote:

>
> Someone needs to do a wiki entry for HIGH PERFORMANCE web2py setup.
>
> I.e. Apache + WSGI + Postgre/MySQL + Query Cache code + Page Cache
> code.
> A simple program that could be made for this is an app for allowing
> students to register for classes.
> Requirements:
> Super user can: add classes, change classes (time, section, prof,
> etc.), view classes, lock classes (i.e. no additional registrations
> allowed), set maximum # students per class (after which additional
> students added to waitlist--when some registered student drops, FIFO
> method for registering students on waitlist).
> Student user can: add classes to time-table, check for pre-requisites,
> check for conflicts in schedule, view schedule, join waitlist.
>
> I'm already writing an app, but would totally make this as it is
> EXTREMELY useful for schools. Lots of schools have problems with their
> registration system being too slow. This includes private lesson and
> adult education programs...this is also especially useful with OBAMA's
> announcement today about more funding for schools ;)
>
>
>
> On Nov 23, 11:35 am, mdipierro  wrote:
> > What is current setup? Windows binary? Do you know linux?
> >
> > On Nov 23, 12:36 pm, harshit agrawal 
> > wrote:
> >
> > > This is a fact.
> >
> > > Sir I am almost done with all the queries in my project using the
> > > default sqlite and now I want to put the portal on apache server. How
> > > can we do this?
> >
> > > On Nov 23, 12:47 pm, mdipierro  wrote:
> >
> > > > On Nov 23, 11:36 am, harshit agrawal 
> > > > wrote:
> >
> > > > > But sir my portal will start at a specific time and around 200-250
> > > > > users will login at the same time then the system may hang.
> >
> > > > Is this an assumption or a fact?
> >
> > > > > Also there is a file named options_std.py, in this file what does
> > > > > 'no_of_threads' means
> >
> > > > that is the number of concurrent threads with wsgiserver. It should
> > > > not be relevant in a production environment.
> >
> > > > In a production environment you should use apache2+mod_wsgi and let
> > > > Apache deal with concurrency and serving static files. You should
> also
> > > > use postgresql (or other database) not the default sqlite. sqlite
> > > > always locks the entire database on every request.
> >
> > > > You can read more on this in chapter 11 of the book and the source of
> > > > this script:http://www.web2pyslices.com/main/slices/take_slice/29
> >
> > > > Massimo
> >
> > > > > reply as soon as possible
> >
> > > > > Thank You
> > > > > Harshit
> >
> > > > > On Nov 23, 10:15 am, mdipierro  wrote:
> >
> > > > > > It really depends on many issues. 200 users are not going to make
> 1
> > > > > > request/second but more like 1 request every ten seconds each or
> less.
> > > > > > That means you need to handle 20 requests/seconds.
> >
> > > > > > On my laptop an average dynamic page takes ~20ms, and that means
> 50
> > > > > > requests/second. This means I can handle 200 current users on my
> > > > > > laptop.
> >
> > > > > > The bottleneck is always database access. It really depends on
> what
> > > > > > those users do with the database.
> >
> > > > > > Massimo
> >
>

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



[web2py:35880] Re: Maximum No of users can web2py server can support

2009-11-23 Thread mdipierro

I think it makes sense for web2py users to form interest groups in at
least two areas:
- education
- healthcare
and develop common tools to work on those.

Massimo

On Nov 23, 3:45 pm, waTR  wrote:
> Someone needs to do a wiki entry for HIGH PERFORMANCE web2py setup.
>
> I.e. Apache + WSGI + Postgre/MySQL + Query Cache code + Page Cache
> code.
> A simple program that could be made for this is an app for allowing
> students to register for classes.
> Requirements:
> Super user can: add classes, change classes (time, section, prof,
> etc.), view classes, lock classes (i.e. no additional registrations
> allowed), set maximum # students per class (after which additional
> students added to waitlist--when some registered student drops, FIFO
> method for registering students on waitlist).
> Student user can: add classes to time-table, check for pre-requisites,
> check for conflicts in schedule, view schedule, join waitlist.
>
> I'm already writing an app, but would totally make this as it is
> EXTREMELY useful for schools. Lots of schools have problems with their
> registration system being too slow. This includes private lesson and
> adult education programs...this is also especially useful with OBAMA's
> announcement today about more funding for schools ;)
>
> On Nov 23, 11:35 am, mdipierro  wrote:
>
> > What is current setup? Windows binary? Do you know linux?
>
> > On Nov 23, 12:36 pm, harshit agrawal 
> > wrote:
>
> > > This is a fact.
>
> > > Sir I am almost done with all the queries in my project using the
> > > default sqlite and now I want to put the portal on apache server. How
> > > can we do this?
>
> > > On Nov 23, 12:47 pm, mdipierro  wrote:
>
> > > > On Nov 23, 11:36 am, harshit agrawal 
> > > > wrote:
>
> > > > > But sir my portal will start at a specific time and around 200-250
> > > > > users will login at the same time then the system may hang.
>
> > > > Is this an assumption or a fact?
>
> > > > > Also there is a file named options_std.py, in this file what does
> > > > > 'no_of_threads' means
>
> > > > that is the number of concurrent threads with wsgiserver. It should
> > > > not be relevant in a production environment.
>
> > > > In a production environment you should use apache2+mod_wsgi and let
> > > > Apache deal with concurrency and serving static files. You should also
> > > > use postgresql (or other database) not the default sqlite. sqlite
> > > > always locks the entire database on every request.
>
> > > > You can read more on this in chapter 11 of the book and the source of
> > > > this script:http://www.web2pyslices.com/main/slices/take_slice/29
>
> > > > Massimo
>
> > > > > reply as soon as possible
>
> > > > > Thank You
> > > > > Harshit
>
> > > > > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > > > > It really depends on many issues. 200 users are not going to make 1
> > > > > > request/second but more like 1 request every ten seconds each or 
> > > > > > less.
> > > > > > That means you need to handle 20 requests/seconds.
>
> > > > > > On my laptop an average dynamic page takes ~20ms, and that means 50
> > > > > > requests/second. This means I can handle 200 current users on my
> > > > > > laptop.
>
> > > > > > The bottleneck is always database access. It really depends on what
> > > > > > those users do with the database.
>
> > > > > > Massimo
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35881] Re: Maximum No of users can web2py server can support

2009-11-23 Thread Thadeus Burgess
Kind of like how django went the news / blogging route?

-Thadeus




On Mon, Nov 23, 2009 at 4:33 PM, mdipierro  wrote:

>
> I think it makes sense for web2py users to form interest groups in at
> least two areas:
> - education
> - healthcare
> and develop common tools to work on those.
>
> Massimo
>
> On Nov 23, 3:45 pm, waTR  wrote:
> > Someone needs to do a wiki entry for HIGH PERFORMANCE web2py setup.
> >
> > I.e. Apache + WSGI + Postgre/MySQL + Query Cache code + Page Cache
> > code.
> > A simple program that could be made for this is an app for allowing
> > students to register for classes.
> > Requirements:
> > Super user can: add classes, change classes (time, section, prof,
> > etc.), view classes, lock classes (i.e. no additional registrations
> > allowed), set maximum # students per class (after which additional
> > students added to waitlist--when some registered student drops, FIFO
> > method for registering students on waitlist).
> > Student user can: add classes to time-table, check for pre-requisites,
> > check for conflicts in schedule, view schedule, join waitlist.
> >
> > I'm already writing an app, but would totally make this as it is
> > EXTREMELY useful for schools. Lots of schools have problems with their
> > registration system being too slow. This includes private lesson and
> > adult education programs...this is also especially useful with OBAMA's
> > announcement today about more funding for schools ;)
> >
> > On Nov 23, 11:35 am, mdipierro  wrote:
> >
> > > What is current setup? Windows binary? Do you know linux?
> >
> > > On Nov 23, 12:36 pm, harshit agrawal 
> > > wrote:
> >
> > > > This is a fact.
> >
> > > > Sir I am almost done with all the queries in my project using the
> > > > default sqlite and now I want to put the portal on apache server. How
> > > > can we do this?
> >
> > > > On Nov 23, 12:47 pm, mdipierro  wrote:
> >
> > > > > On Nov 23, 11:36 am, harshit agrawal 
> > > > > wrote:
> >
> > > > > > But sir my portal will start at a specific time and around
> 200-250
> > > > > > users will login at the same time then the system may hang.
> >
> > > > > Is this an assumption or a fact?
> >
> > > > > > Also there is a file named options_std.py, in this file what does
> > > > > > 'no_of_threads' means
> >
> > > > > that is the number of concurrent threads with wsgiserver. It should
> > > > > not be relevant in a production environment.
> >
> > > > > In a production environment you should use apache2+mod_wsgi and let
> > > > > Apache deal with concurrency and serving static files. You should
> also
> > > > > use postgresql (or other database) not the default sqlite. sqlite
> > > > > always locks the entire database on every request.
> >
> > > > > You can read more on this in chapter 11 of the book and the source
> of
> > > > > this script:http://www.web2pyslices.com/main/slices/take_slice/29
> >
> > > > > Massimo
> >
> > > > > > reply as soon as possible
> >
> > > > > > Thank You
> > > > > > Harshit
> >
> > > > > > On Nov 23, 10:15 am, mdipierro  wrote:
> >
> > > > > > > It really depends on many issues. 200 users are not going to
> make 1
> > > > > > > request/second but more like 1 request every ten seconds each
> or less.
> > > > > > > That means you need to handle 20 requests/seconds.
> >
> > > > > > > On my laptop an average dynamic page takes ~20ms, and that
> means 50
> > > > > > > requests/second. This means I can handle 200 current users on
> my
> > > > > > > laptop.
> >
> > > > > > > The bottleneck is always database access. It really depends on
> what
> > > > > > > those users do with the database.
> >
> > > > > > > Massimo
> >
> >
> >
>

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



[web2py:35882] Re: Web2Py Multi-site

2009-11-23 Thread David

Hi Massimo,

Yes I saw the plugin and thought it was pretty fancy.  I might have
missed the point on implementation of it.


Here's a better look at what I am trying to do:



www.example1.com ---> css+ static files in their own home directory
(Independent of example2.com)
|
<>web2py + postgresql (1
installation)
|
www.example2.com-> css+ static files in their own home directory
(independent of example1.com)


Both sites are virtual hosts which have their own static content that
is exclusive from each other which they can FTP in and out.  This way
a user can upload their new layouts without affecting other sites.
Both sites will have the default layout of my choosing which can be
substituted for their own preferences if they want to change it.

My thinking is that this would give the domain owner a simple way to
implement a custom "template" to modify the look and feel.  I would
then present them with a small manual on the output tags that could be
used to implement boxes, feeds, products etc on their custom
templates.

Both sites will share a common web2py for installation which also has
one postgresql installation.
What I've done in the postgresql side is added auth field (user_id)
and in the views I am pulling data based on user_id  and I would like
to also pull based on request.env server name.  On the named based
vhost side I would like apache2 to serve the static files.











On Nov 23, 1:25 pm, mdipierro  wrote:
> On Nov 23, 11:21 am, David  wrote:
>
> > Layouts should depend on the domain.
>
> > But I don't want to have 50+ installations per server that need to be
> > update manually when I make changes to the code or bring enhancements.
>
> > They don't need appadmin. I am writing a control panel for them to
> > manage users.
>
> > Would it not be possible to share a single web2py installation for
> > multiple vhosts so I only need to update one directory on each server?
>
> Yes you can. You never need more than one web2py installation.
> - You can have multiple apps under one web2py installation and map
> them ti different vhosts (in this case apache does the mapping)
> - You can have one app with multiple layouts depending on the vhosts
> but in this case (in this case web2py does the mapping)
> - You can have one layout.html and different CSS files depending on
> the vhosts
>
> The best way really depends on what the differences are and who is
> allowed to edit these differences. Are they set once for all? Do you
> need to add more? Are the differences just in color and images or are
> they differences in the actual HTML?
>
> have you looked intohttp://web2py.com/layouts?
>
>
>
> > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > You should consider different approached depending on whether the
> > > layout depends on the domain or the user. If it depends on the domain
> > > and it is fixed for domain, I suggest different web2py apps with
> > > different set of views that talk to the same db. Usevirtualhosts to
> > > map domain into app. If the are per user, I would make the CSS dynamic
> > > and retrieve it from the a database based on user preferences.
>
> > > On Nov 2, 2:28 pm, David Henry  wrote:
>
> > > > Hi Thadeus,
>
> > > > Did you happen to have the information on how to set this up?
>
> > > > I wanted one web2py with multiple applications that serve unique views/
> > > > html/css to users based on the domain used to access the site so users  
> > > > can customize the look and feel to their tastes.
>
> > > > Thanks,
> > > > David
>
> > > > On Nov 1, 2009, at 7:41 PM, Thadeus Burgess wrote:
>
> > > > > I use virtualhosts on a per domain basis. You are wanting the same  
> > > > > app, with the same data, but different layouts depending on domain,  
> > > > > or do you want two completely separate apps per domain?
>
> > > > > -Thadeus
>
> > > > > On Sun, Nov 1, 2009 at 7:12 PM, David Henry  
> > > > >  wrote:
> > > > > uld I need symlinks to the virtualhost directory as we
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35883] Re: Web2Py Multi-site

2009-11-23 Thread mdipierro

You layout.html needs to look into

request.env.http_host for the requested host name and include a
corresponding

 then present them with a small manual on the output tags that could be
> used to implement boxes, feeds, products etc on their custom
> templates.
>
> Both sites will share a common web2py for installation which also has
> one postgresql installation.
> What I've done in the postgresql side is added auth field (user_id)
> and in the views I am pulling data based on user_id  and I would like
> to also pull based on request.env server name.  On the named based
> vhost side I would like apache2 to serve the static files.
>
> On Nov 23, 1:25 pm, mdipierro  wrote:
>
> > On Nov 23, 11:21 am, David  wrote:
>
> > > Layouts should depend on the domain.
>
> > > But I don't want to have 50+ installations per server that need to be
> > > update manually when I make changes to the code or bring enhancements.
>
> > > They don't need appadmin. I am writing a control panel for them to
> > > manage users.
>
> > > Would it not be possible to share a single web2py installation for
> > > multiple vhosts so I only need to update one directory on each server?
>
> > Yes you can. You never need more than one web2py installation.
> > - You can have multiple apps under one web2py installation and map
> > them ti different vhosts (in this case apache does the mapping)
> > - You can have one app with multiple layouts depending on the vhosts
> > but in this case (in this case web2py does the mapping)
> > - You can have one layout.html and different CSS files depending on
> > the vhosts
>
> > The best way really depends on what the differences are and who is
> > allowed to edit these differences. Are they set once for all? Do you
> > need to add more? Are the differences just in color and images or are
> > they differences in the actual HTML?
>
> > have you looked intohttp://web2py.com/layouts?
>
> > > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > > You should consider different approached depending on whether the
> > > > layout depends on the domain or the user. If it depends on the domain
> > > > and it is fixed for domain, I suggest different web2py apps with
> > > > different set of views that talk to the same db. Usevirtualhosts to
> > > > map domain into app. If the are per user, I would make the CSS dynamic
> > > > and retrieve it from the a database based on user preferences.
>
> > > > On Nov 2, 2:28 pm, David Henry  wrote:
>
> > > > > Hi Thadeus,
>
> > > > > Did you happen to have the information on how to set this up?
>
> > > > > I wanted one web2py with multiple applications that serve unique 
> > > > > views/
> > > > > html/css to users based on the domain used to access the site so 
> > > > > users  
> > > > > can customize the look and feel to their tastes.
>
> > > > > Thanks,
> > > > > David
>
> > > > > On Nov 1, 2009, at 7:41 PM, Thadeus Burgess wrote:
>
> > > > > > I use virtualhosts on a per domain basis. You are wanting the same  
> > > > > > app, with the same data, but different layouts depending on domain, 
> > > > > >  
> > > > > > or do you want two completely separate apps per domain?
>
> > > > > > -Thadeus
>
> > > > > > On Sun, Nov 1, 2009 at 7:12 PM, David Henry  
> > > > > >  wrote:
> > > > > > uld I need symlinks to the virtualhost directory as we
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35884] Re: validity of file

2009-11-23 Thread Richard

could a new validator be added to check the mime type from the POSTed
content-type?
IS_MIME_TYPE('png')

Django has something like this:
http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=olddocs#uploadedfile-objects

Richard


On Nov 23, 2:50 pm, Thadeus Burgess  wrote:
> This is for uploaded plug-ins (for plugincentral).
>
> I want to make sure they are actually tarred archives with python code in
> them. I need to check the actual file contents instead of just the filename
> (which gets checked first, to make sure it is "web2py.plugin.*.w2p"
>
> -Thadeus
>
> On Sun, Nov 22, 2009 at 9:46 PM, mdipierro  wrote:
>
> > There a IS_IMAGE that can check for BMP, GIF, JPEG, and PNG.
> > You can copy and modify it to check for other formats.
> > What formats are you thinking about?
>
> > On Nov 22, 9:41 pm, Thadeus Burgess  wrote:
> > > Is there a way, through SQLFORM to open a file, and make sure it is the
> > kind
> > > of file you are expecting.
>
> > > I would like to check to see if the files users are uploading, are indeed
> > > w2p tarred files with only .py files with a naming scheme in them.
>
> > > I know I could use SQLFORM.factory and then open the file after it is
> > saved
> > > to the server, then delete it if it was no good, I was just wondering if
> > > there was a way to "hook" into the validation.
>
> > > -Thadeus
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35885] Re: Delete record from row object

2009-11-23 Thread Richard

ah OK - I didn't know the record update could be split like that.
Neat.
Richard


On Nov 19, 1:23 pm, mdipierro  wrote:
> A Row object extends a dictionary and inherits an update method. It
> only updates the dict not the record. The us of it is that you can do:
>
> row.update(...)
> row.update(...)
> row.update(...)
> row.update_record()
>
> and the last update_record() without parameters will update the
> database with the previous updated changes.
>
> row.update() on its own is useless.
>
> On Nov 18, 8:09 pm, Richard  wrote:
>
> > what is the use case for updating the row object instead of the
> > database? I sometimes use update() instead of update_record(), so I
> > would prefer update() threw an exception.
>
> > Is it worth adding the equivalent delete_record()?
>
> > On Nov 19, 10:43 am, mdipierro  wrote:
>
> > > you can do
>
> > > del db.table[row.id]
>
> > > Mind that
>
> > > row.update(...)
>
> > > only updates the row object, not the database record.
>
> > > row.update_record(...)
>
> > > updates the database record.
>
> > > On Nov 18, 5:22 pm, Thadeus Burgess  wrote:
>
> > > > A feature to delete the record from the current object would be nice, 
> > > > like
> > > > the .update() method of the row, to have .delete()
>
> > > > row = db(db.table.id > 0).select().first()
> > > > ...
> > > > #do some other queries with row data
> > > > ...
> > > > row.delete() # i don't need row anymore, so purge it from database.
>
> > > > # I currently have to do
>
> > > > # db(db.table.id == row.id).delete()
>
> > > > -Thadeus
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35886] Re: web2py and postgresql

2009-11-23 Thread Richard

Modules are only executed once, so could you create the index there?
Or use a database flag.

What I do is create a special function in the controller like
"initiate_database()" and put my code there and then manually call
this function. Not a neat solution, but it works.

Richard


On Nov 19, 8:56 pm, leone  wrote:
> The code is executed only once at the start of session via a
> session.flag, I can't know if table and indexes are already created.
> There is another and better way to execute code only once?
>
> On 19 Nov, 03:20, mdipierro  wrote:
>
> > Yes. I do not think those lines belong in there. I was just suggesting
> > a workaround.
>
> > On Nov 18, 8:06 pm, Richard  wrote:
>
> > > isn't generating that exception every request going to be too much
> > > overhead?
>
> > > On Nov 19, 7:37 am, mdipierro  wrote:
>
> > > > The fact is, indices must be created only once. If you have the index
> > > > already that line fails. You handle the exception at the web2py level
> > > > but the transcation still aborts. Try:
>
> > > > try:
> > > >     db.executesql("CREATE UNIQUE INDEX indexO ON secretnum
> > > > (primocod);")
> > > > except:
> > > >     db.rollback()
>
> > > > On Nov 18, 2:34 pm, leone  wrote:
>
> > > > > Peraphs I found the piece of code that creates the problem.
> > > > > After table definition I have:
> > > > > try:
> > > > >     db.executesql("CREATE UNIQUE INDEX indexO ON secretnum
> > > > > (primocod);")
> > > > > except:
> > > > >     pass
> > > > > if I comment these rows all runs, even if DAL and table definition is
> > > > > in plugin_secretnum.py
>
> > > > > On 18 Nov, 21:11, leone  wrote:
>
> > > > > > If I put DAL and table definition in db.py all is Ok and sql.log
> > > > > > report:
> > > > > > CREATE TABLE secretnum(
> > > > > >         id SERIAL PRIMARY KEY,
> > > > > >         primocod VARCHAR(8),
> > > > > >         secondocod VARCHAR(5),
> > > > > >         terzocod VARCHAR(5),
> > > > > >         username VARCHAR(20),
> > > > > >         attivo CHAR(1)
> > > > > > );
> > > > > > success!
>
> > > > > > If I put DAL and table definition in plugin_secretnum.py in models I
> > > > > > have error:
>
> > > > > > row = db(db.secretnum.primocod == primocod).select()
> > > > > >   File "/home/eugenio/web2py/web2py/gluon/sql.py", line 2901, in
> > > > > > select
> > > > > >     rows = response(query)
> > > > > >   File "/home/eugenio/web2py/web2py/gluon/sql.py", line 2896, in
> > > > > > response
> > > > > >     db._execute(query)
> > > > > >   File "/home/eugenio/web2py/web2py/gluon/sql.py", line 909, in
> > > > > > 
> > > > > >     self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
> > > > > > InternalError: current transaction is aborted, commands ignored 
> > > > > > until
> > > > > > end of transaction block
>
> > > > > > ...and sql.log have no new message.
>
> > > > > > On 18 Nov, 21:01, mdipierro  wrote:
>
> > > > > > > what is in sql.log?
>
> > > > > > > On Nov 18, 10:54 am, leone  wrote:
>
> > > > > > > > Grrr.
> > > > > > > > I can't uderstand. I have code that runs in sqlite bat non in
> > > > > > > > postgresql.
> > > > > > > > Apparently it is very simple.
> > > > > > > > Where is my error??
>
> > > > > > > > db.define_table('secretnum',
> > > > > > > >                 Field('primocod','string', length=8),
> > > > > > > >                 Field('secondocod','string', length=5),
> > > > > > > >                 Field('terzocod','string', length=5),
> > > > > > > >                 Field('username','string', length=20),
> > > > > > > >                 Field('attivo','boolean', default=True),
> > > > > > > >             )
> > > > > > > > row = db(db.secretnum.primocod == '12345678').select()
>
> > > > > > > > Error:
> > > > > > > > File "/home/eugenio/web2py/web2py/gluon/sql.py", line 2901, in 
> > > > > > > > select
> > > > > > > >     rows = response(query)
> > > > > > > >   File "/home/eugenio/web2py/web2py/gluon/sql.py", line 2896, in
> > > > > > > > response
> > > > > > > >     db._execute(query)
> > > > > > > >   File "/home/eugenio/web2py/web2py/gluon/sql.py", line 909, in
> > > > > > > > 
> > > > > > > >     self._execute = lambda *a, **b: self._cursor.execute(*a, 
> > > > > > > > **b)
> > > > > > > > InternalError: current transaction is aborted, commands ignored 
> > > > > > > > until
> > > > > > > > end of transaction block
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35887] Re: Image Uploading

2009-11-23 Thread Richard

Good catch.
Alternatively you could set request.vars.filename before form.accepts
().


On Nov 20, 8:34 pm, Thadeus Burgess  wrote:
> With the above function it will try to insert the image into the database
> twice, you need.
>
> if form.accepts(request.vars, session, dbio=False)
>
> -Thadeus
>
> On Thu, Nov 19, 2009 at 10:51 AM, NuclearDragon
> wrote:
>
>
>
> > Thanks for the replies everyone!
>
> > We are renaming the files with our own naming scheme, so they are
> > unique, but not random. We don't provide a download function for our
> > users, so I'm not worried about the download aspect.
>
> > Thanks especially to Richard for this!:
> > "
> > form = SQLFORM(db.image)
> > if form.accepts(request.vars, session):
> >        target_filename = ...
> >        # need to stream or large files could cripple your server
> >        gluon.fileutils.copystream(request.vars.filename.file, open
> > (target_filename, 'wb'), int(request.env.content_length))
> >        db.image.insert(filename=target_filename)
> > "
>
> > Also, I tried my first 'multiple forms page', and it worked very
> > slick! I'm really starting to like web2py, especially the
> > customization I can do within it.
>
> > Thanks for a great framework, Massimo!
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35888] Re: validity of file

2009-11-23 Thread Thadeus Burgess
>>> import tarfile
>>> tarfile.is_tarfile("web2py.plugin.tagging.w2p")
True
>>> tarfile.is_tarfile("cookbook2.pdf")
False
>>> :)
  File "", line 1
:)
^
SyntaxError: invalid syntax
>>>

Now this needs to integrate with SQLFORM on_validation.

Should I also open the tar archive, and verify its contents are actually,
python code, html, images (such as verifying each of them individually or
just their filenames?)

-Thadeus




On Mon, Nov 23, 2009 at 7:49 PM, Richard  wrote:

>
> could a new validator be added to check the mime type from the POSTed
> content-type?
> IS_MIME_TYPE('png')
>
> Django has something like this:
>
> http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=olddocs#uploadedfile-objects
>
> Richard
>
>
> On Nov 23, 2:50 pm, Thadeus Burgess  wrote:
> > This is for uploaded plug-ins (for plugincentral).
> >
> > I want to make sure they are actually tarred archives with python code in
> > them. I need to check the actual file contents instead of just the
> filename
> > (which gets checked first, to make sure it is "web2py.plugin.*.w2p"
> >
> > -Thadeus
> >
> > On Sun, Nov 22, 2009 at 9:46 PM, mdipierro 
> wrote:
> >
> > > There a IS_IMAGE that can check for BMP, GIF, JPEG, and PNG.
> > > You can copy and modify it to check for other formats.
> > > What formats are you thinking about?
> >
> > > On Nov 22, 9:41 pm, Thadeus Burgess  wrote:
> > > > Is there a way, through SQLFORM to open a file, and make sure it is
> the
> > > kind
> > > > of file you are expecting.
> >
> > > > I would like to check to see if the files users are uploading, are
> indeed
> > > > w2p tarred files with only .py files with a naming scheme in them.
> >
> > > > I know I could use SQLFORM.factory and then open the file after it is
> > > saved
> > > > to the server, then delete it if it was no good, I was just wondering
> if
> > > > there was a way to "hook" into the validation.
> >
> > > > -Thadeus
> >
> >
> >
>

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



[web2py:35889] Encoding problem (bug?)

2009-11-23 Thread blackthorne

hi

Here's my problem...
Let's say I make a View file and add utf-8 characters such as 'ã'. It
works fine.
However, if that same character comes in another View file which
happens an extension of the first, it won't work.

>From my tests, encoding only works well on a View file that doesn't
extend any previous one.

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



[web2py:35890] SQLFORM upload field, absolute filepath

2009-11-23 Thread Thadeus Burgess
How do I get the new filename of an uploaded file? Along with its new
absolute path..

Below, from the book, does not exist.

 web2py 2nd edition pg 196 p. 2.
   Only its extension is preserved. This is a security requirement since the
filename may contain special characters that could allow a visitor to
perform
directory traversal attacks or other malicious operations.
   The new filename is also stored in form.vars.image newfilename.
   When editing the record using an UPDATE form, it would be nice to
display a link to the existing uploaded file, and web2py provides a way to
do it.


-Thadeus

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



[web2py:35891] Re: Web2Py Multi-site

2009-11-23 Thread David

Massimo,

I have downloaded and installed the layout plugin you had mentioned
above.

I can see what you are getting at when you are talking about including
the layouts.

I will have a go with this and see what I can come up with.

Thank you for your help!

-David :0)

On Nov 23, 7:02 pm, mdipierro  wrote:
> You layout.html needs to look into
>
> request.env.http_host for the requested host name and include a
> corresponding
>
>  > then present them with a small manual on the output tags that could be
> > used to implement boxes, feeds, products etc on their custom
> > templates.
>
> > Both sites will share a common web2py for installation which also has
> > one postgresql installation.
> > What I've done in the postgresql side is added auth field (user_id)
> > and in the views I am pulling data based on user_id  and I would like
> > to also pull based on request.env server name.  On the named based
> > vhost side I would like apache2 to serve the static files.
>
> > On Nov 23, 1:25 pm, mdipierro  wrote:
>
> > > On Nov 23, 11:21 am, David  wrote:
>
> > > > Layouts should depend on the domain.
>
> > > > But I don't want to have 50+ installations per server that need to be
> > > > update manually when I make changes to the code or bring enhancements.
>
> > > > They don't need appadmin. I am writing a control panel for them to
> > > > manage users.
>
> > > > Would it not be possible to share a single web2py installation for
> > > > multiple vhosts so I only need to update one directory on each server?
>
> > > Yes you can. You never need more than one web2py installation.
> > > - You can have multiple apps under one web2py installation and map
> > > them ti different vhosts (in this case apache does the mapping)
> > > - You can have one app with multiple layouts depending on the vhosts
> > > but in this case (in this case web2py does the mapping)
> > > - You can have one layout.html and different CSS files depending on
> > > the vhosts
>
> > > The best way really depends on what the differences are and who is
> > > allowed to edit these differences. Are they set once for all? Do you
> > > need to add more? Are the differences just in color and images or are
> > > they differences in the actual HTML?
>
> > > have you looked intohttp://web2py.com/layouts?
>
> > > > On Nov 23, 10:15 am, mdipierro  wrote:
>
> > > > > You should consider different approached depending on whether the
> > > > > layout depends on the domain or the user. If it depends on the domain
> > > > > and it is fixed for domain, I suggest different web2py apps with
> > > > > different set of views that talk to the same db. Usevirtualhosts to
> > > > > map domain into app. If the are per user, I would make the CSS dynamic
> > > > > and retrieve it from the a database based on user preferences.
>
> > > > > On Nov 2, 2:28 pm, David Henry  wrote:
>
> > > > > > Hi Thadeus,
>
> > > > > > Did you happen to have the information on how to set this up?
>
> > > > > > I wanted one web2py with multiple applications that serve unique 
> > > > > > views/
> > > > > > html/css to users based on the domain used to access the site so 
> > > > > > users  
> > > > > > can customize the look and feel to their tastes.
>
> > > > > > Thanks,
> > > > > > David
>
> > > > > > On Nov 1, 2009, at 7:41 PM, Thadeus Burgess wrote:
>
> > > > > > > I use virtualhosts on a per domain basis. You are wanting the 
> > > > > > > same  
> > > > > > > app, with the same data, but different layouts depending on 
> > > > > > > domain,  
> > > > > > > or do you want two completely separate apps per domain?
>
> > > > > > > -Thadeus
>
> > > > > > > On Sun, Nov 1, 2009 at 7:12 PM, David Henry  
> > > > > > >  wrote:
> > > > > > > uld I need symlinks to the virtualhost directory as we
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35892] Re: Plugin Layout

2009-11-23 Thread David

Massimo,

I just got this installed and working and it's given me a few ideas
about different layouts for users.

Thank you for making this plugin.

It's very nice.

- David

On Nov 10, 9:55 pm, Wiiboy  wrote:
> I just noticed: if you hit "changelayout" and you're not logged in as
> an Admin, it doesn't redirect you to the "changelayout" page after
> you log in.  The isn't a ?_next= in the url.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35893] Re: SQLFORM upload field, absolute filepath

2009-11-23 Thread mr.freeze

I believe it is form.vars._newfilename. You should be
able to get the path with:

os.path.join
(request.folder,'uploads',form.vars._newfilename)

There may be a better way though.

On Nov 23, 9:21 pm, Thadeus Burgess  wrote:
> How do I get the new filename of an uploaded file? Along with its new
> absolute path..
>
> Below, from the book, does not exist.
>
>  web2py 2nd edition pg 196 p. 2.
>    Only its extension is preserved. This is a security requirement since the
> filename may contain special characters that could allow a visitor to
> perform
> directory traversal attacks or other malicious operations.
>    The new filename is also stored in form.vars.image newfilename.
>    When editing the record using an UPDATE form, it would be nice to
> display a link to the existing uploaded file, and web2py provides a way to
> do it.
>
> -Thadeus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35894] Re: SQLFORM upload field, absolute filepath

2009-11-23 Thread Thadeus Burgess
The problem is I am trying to get the file from the function in
SQLFORM.onvalidation... and this happens before the file gets renamed or
saved to the disk. The only way i see of accomplishing this is


if form.accepts(request.vars, session, dbio=False):

#def is_plugin_archive(form)
#import tarfile, os
#path = os.path.join(db._folder, '..', 'uploads',
form.vars.file_newfilename)

#if not tarfile.is_tarfile(path):
#form.errors.file = "Not a valid tar archive"


is_plugin_archive(form)

if not form.errors:
session.flash = "Version uploaded."
redirect(URL(r=request, f='plug', args=plugin.id))
else:
response.flash = "There were errors with the file"

elif form.errors:
response.flash = "There were errors"

-Thadeus




On Mon, Nov 23, 2009 at 9:46 PM, mr.freeze  wrote:

> ieve it is form.vars._newfilename. You should be
> able to get the path
>

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



[web2py:35895] Re: SQLFORM upload field, absolute filepath

2009-11-23 Thread Richard

IIRC, you can use db.table.field.store(request.vars.field) to get the
web2py generated filename.


On Nov 24, 2:53 pm, Thadeus Burgess  wrote:
> The problem is I am trying to get the file from the function in
> SQLFORM.onvalidation... and this happens before the file gets renamed or
> saved to the disk. The only way i see of accomplishing this is
>
> if form.accepts(request.vars, session, dbio=False):
>
>                 #def is_plugin_archive(form)
>                 #import tarfile, os
>                 #path = os.path.join(db._folder, '..', 'uploads',
> form.vars.file_newfilename)
>
>                 #if not tarfile.is_tarfile(path):
>                     #form.errors.file = "Not a valid tar archive"
>
>                 is_plugin_archive(form)
>
>                 if not form.errors:
>                     session.flash = "Version uploaded."
>                     redirect(URL(r=request, f='plug', args=plugin.id))
>                 else:
>                     response.flash = "There were errors with the file"
>
>             elif form.errors:
>                 response.flash = "There were errors"
>
> -Thadeus
>
> On Mon, Nov 23, 2009 at 9:46 PM, mr.freeze  wrote:
> > ieve it is form.vars._newfilename. You should be
> > able to get the path
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35896] Re: SQLFORM upload field, absolute filepath

2009-11-23 Thread Thadeus Burgess
Ah yes would love to, however it ends up copy the file twice, since it will
do it in my function, and then again later on in SQLFORM.accepts.

This is the modified version, it works, I just need to make sure the file is
not too large for the server to handle.

The limitation really comes from tarfile.is_tarfile, it expects and requires
a filename, because it wants to open the file itself. Therefore I need a
copy of the file somewhere besides in memory.

Any ideas on improvements or a better way?

def is_valid_tar(form):
import tarfile, os, random, shutil
tmppath = os.path.join(request.folder, 'uploads', 'tmpupf%f.temp.w2p' %
random.random())
f = form.vars.file.file
try:
dest_file = open(tmppath, 'wb')
shutil.copyfileobj(f, dest_file)
except:
pass
finally:
dest_file.close()

if not tarfile.is_tarfile(tmppath):
form.errors.file = "Invalid file format"

try:
os.remove(tmppath)
except:
pass

#...
form.accepts(...onvalidation=is_valid_tar)


-Thadeus




On Mon, Nov 23, 2009 at 10:31 PM, Richard  wrote:

>
> IIRC, you can use db.table.field.store(request.vars.field) to get the
> web2py generated filename.
>
>
> On Nov 24, 2:53 pm, Thadeus Burgess  wrote:
> > The problem is I am trying to get the file from the function in
> > SQLFORM.onvalidation... and this happens before the file gets renamed or
> > saved to the disk. The only way i see of accomplishing this is
> >
> > if form.accepts(request.vars, session, dbio=False):
> >
> > #def is_plugin_archive(form)
> > #import tarfile, os
> > #path = os.path.join(db._folder, '..', 'uploads',
> > form.vars.file_newfilename)
> >
> > #if not tarfile.is_tarfile(path):
> > #form.errors.file = "Not a valid tar archive"
> >
> > is_plugin_archive(form)
> >
> > if not form.errors:
> > session.flash = "Version uploaded."
> > redirect(URL(r=request, f='plug', args=plugin.id))
> > else:
> > response.flash = "There were errors with the file"
> >
> > elif form.errors:
> > response.flash = "There were errors"
> >
> > -Thadeus
> >
> > On Mon, Nov 23, 2009 at 9:46 PM, mr.freeze  wrote:
> > > ieve it is form.vars._newfilename. You should be
> > > able to get the path
> >
> >
> >
>

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



[web2py:35897] Re: validity of file

2009-11-23 Thread mdipierro

Unfortunately checking the mime type is no guarantee that the file
format is conform to specs.

On Nov 23, 7:49 pm, Richard  wrote:
> could a new validator be added to check the mime type from the POSTed
> content-type?
> IS_MIME_TYPE('png')
>
> Django has something like 
> this:http://docs.djangoproject.com/en/dev/topics/http/file-uploads/?from=o...
>
> Richard
>
> On Nov 23, 2:50 pm, Thadeus Burgess  wrote:
>
> > This is for uploaded plug-ins (for plugincentral).
>
> > I want to make sure they are actually tarred archives with python code in
> > them. I need to check the actual file contents instead of just the filename
> > (which gets checked first, to make sure it is "web2py.plugin.*.w2p"
>
> > -Thadeus
>
> > On Sun, Nov 22, 2009 at 9:46 PM, mdipierro  wrote:
>
> > > There a IS_IMAGE that can check for BMP, GIF, JPEG, and PNG.
> > > You can copy and modify it to check for other formats.
> > > What formats are you thinking about?
>
> > > On Nov 22, 9:41 pm, Thadeus Burgess  wrote:
> > > > Is there a way, through SQLFORM to open a file, and make sure it is the
> > > kind
> > > > of file you are expecting.
>
> > > > I would like to check to see if the files users are uploading, are 
> > > > indeed
> > > > w2p tarred files with only .py files with a naming scheme in them.
>
> > > > I know I could use SQLFORM.factory and then open the file after it is
> > > saved
> > > > to the server, then delete it if it was no good, I was just wondering if
> > > > there was a way to "hook" into the validation.
>
> > > > -Thadeus
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35898] Re: Encoding problem (bug?)

2009-11-23 Thread mdipierro

Haven't seen you in long time. How are you?
can post a minimalist app to reproduce the problem?

On Nov 23, 9:13 pm, blackthorne  wrote:
> hi
>
> Here's my problem...
> Let's say I make a View file and add utf-8 characters such as 'ã'. It
> works fine.
> However, if that same character comes in another View file which
> happens an extension of the first, it won't work.
>
> From my tests, encoding only works well on a View file that doesn't
> extend any previous one.
>
> Thank you,
> best regards
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35899] RSS does not escape output?

2009-11-23 Thread Thadeus Burgess
Why does the generic.rss default to non-escaped output?

-Thadeus

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



[web2py:35900] Re: RSS does not escape output?

2009-11-23 Thread mdipierro

I think it does but not there. It calls gluon.serializers.rss which
calls gluon.contrib.rss2.dumps. This is a standard python module for
RSS. This module uses SAX for generating XML+RSS.

generic.rss does not escape because the data passed to it is already
in XML.

The escaping should be done by the RSS2 module. Is it not? Are you
having a problem with it?

Massimo



On Nov 24, 12:13 am, Thadeus Burgess  wrote:
> Why does the generic.rss default to non-escaped output?
>
> -Thadeus
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35901] Including static html pages

2009-11-23 Thread Johann Spies

How do I present a set of html pages created by an external
application (Sphinx) in a web2py application?  I am working on a page
for system administrators which inter alia provides documentation some
of it which were written using sphinx.

This is a rephrase of my previous question about Restructured Text
which resulted in no replies.

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



[web2py:35902] Re: RSS does not escape output?

2009-11-23 Thread mr.freeze

I don't think it does by default.

On Nov 24, 12:47 am, mdipierro  wrote:
> I think it does but not there. It calls gluon.serializers.rss which
> calls gluon.contrib.rss2.dumps. This is a standard python module for
> RSS. This module uses SAX for generating XML+RSS.
>
> generic.rss does not escape because the data passed to it is already
> in XML.
>
> The escaping should be done by the RSS2 module. Is it not? Are you
> having a problem with it?
>
> Massimo
>
> On Nov 24, 12:13 am, Thadeus Burgess  wrote:
>
> > Why does the generic.rss default to non-escaped output?
>
> > -Thadeus
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35903] Re: RSS does not escape output?

2009-11-23 Thread Thadeus Burgess
No the escaping is not done in the RSS2 module, I checked. Firefox is
displaying the form and everything I posted as a comment bad bad bad!

I fixed it by calling XML sanitize as I was looping through the rows. I do
think there should be a note about this?

...
description=XML(row.comment.content, sanitize=True,
permitted_tags=[]).xml(),
...


-Thadeus




On Tue, Nov 24, 2009 at 12:47 AM, mdipierro  wrote:

>
> I think it does but not there. It calls gluon.serializers.rss which
> calls gluon.contrib.rss2.dumps. This is a standard python module for
> RSS. This module uses SAX for generating XML+RSS.
>
> generic.rss does not escape because the data passed to it is already
> in XML.
>
> The escaping should be done by the RSS2 module. Is it not? Are you
> having a problem with it?
>
> Massimo
>
>
>
> On Nov 24, 12:13 am, Thadeus Burgess  wrote:
> > Why does the generic.rss default to non-escaped output?
> >
> > -Thadeus
> >
>

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



[web2py:35904] Re: Including static html pages

2009-11-23 Thread Thadeus Burgess
Easiest way is to just reference the static files directly

http://mysite.com/init/static/documentation/index.html

-Thadeus




On Tue, Nov 24, 2009 at 1:15 AM, Johann Spies wrote:

> lication (Sphinx) in a web2py application?  I am working on a page
> for system administrators which inter alia provides docume
>

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



[web2py:35905] Re: Including static html pages

2009-11-23 Thread mr.freeze

You can render any view from a controller using response.render
(view,vars). Where are the pages stored?

On Nov 24, 1:15 am, Johann Spies  wrote:
> How do I present a set of html pages created by an external
> application (Sphinx) in a web2py application?  I am working on a page
> for system administrators which inter alia provides documentation some
> of it which were written using sphinx.
>
> This is a rephrase of my previous question about Restructured Text
> which resulted in no replies.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---