[web2py] Re: selection by key

2011-02-27 Thread darkblue_b
I see, it makes a button per ID
works for now.. thx!  -Brian


Re: [web2py] Re: Opinions on deployment setup

2011-02-27 Thread Jonathan Lundell
On Feb 27, 2011, at 10:17 PM, Kimmo wrote:
> 
> Hey thanks! It worked. I used to have $anything earlier. Dunno why I
> changed it to any.

It's not too well documented, but $anything translates to .*, and $any (or 
anything but $anything) translates to \w+. In particular, $any won't match a 
slash, only the content between slashes.

Add to that the fact that the pattern being matched by routes_out is always *at 
least* /a/c/f, and you'll see that /a/$any can never match anything. It 
translates to ^/a/\w+$, which can't match any version of /a/c/f.

So: the shortcuts are useful, but it's necessary to understand what they really 
mean. I lean toward spelling out the regular expression instead. Or using the 
new routers syntax, when it does the job for you.


> 
> Hmm. I guess I can do this kind of deployment if there's no one to
> tell me otherwise.
> This is good cause I don't want people going fiddling around with
> httpd.conf and restarting the server all the time, when they make
> mistakes with routing or want to setup a new app.
> 
> Kimmo
> 
> On Feb 24, 5:27 pm, Jonathan Lundell  wrote:
>> On Feb 24, 2011, at 12:30 AM, Kimmo wrote:
>> 
>> 
>> 
>>> So far I've only found one minor problem with this.
>> 
>>> In my example above, the links to other apps in the admin app wont
>>> work.
>>> For example clicking the app2 should redirect towww.myhost.com/subdir/app2,
>>> but it redirects towww.myhost.com/app2and results to Not Found.
>>> Other than that, all editing works fine.
>> 
>>> I tried to edit routes.py for admin like this, but it didn't have any
>>> effect on the link.
>>> routes_out = (('/app2/$any', '/subdir/app2/$any'),)
>> 
>> Use $anything instead of $any.
>> 
>> (and remember to restart web2py after the change)




[web2py] Re: Opinions on deployment setup

2011-02-27 Thread Kimmo
Hey thanks! It worked. I used to have $anything earlier. Dunno why I
changed it to any.

Hmm. I guess I can do this kind of deployment if there's no one to
tell me otherwise.
This is good cause I don't want people going fiddling around with
httpd.conf and restarting the server all the time, when they make
mistakes with routing or want to setup a new app.

Kimmo

On Feb 24, 5:27 pm, Jonathan Lundell  wrote:
> On Feb 24, 2011, at 12:30 AM, Kimmo wrote:
>
>
>
> > So far I've only found one minor problem with this.
>
> > In my example above, the links to other apps in the admin app wont
> > work.
> > For example clicking the app2 should redirect towww.myhost.com/subdir/app2,
> > but it redirects towww.myhost.com/app2and results to Not Found.
> > Other than that, all editing works fine.
>
> > I tried to edit routes.py for admin like this, but it didn't have any
> > effect on the link.
> > routes_out = (('/app2/$any', '/subdir/app2/$any'),)
>
> Use $anything instead of $any.
>
> (and remember to restart web2py after the change)


[web2py] Re: selection by key

2011-02-27 Thread darkblue_b


On Feb 27, 6:29 pm, Massimo Di Pierro 
wrote:
> My mistake:
>
> {{extend 'layout.html'}}
> 
> {{for row in rows:}}
>   {{=row.affirm_pkey}}
> {{pass}}
> 
>
> 
> 
>

sounds good.. {{pass}} seems to work inside or outside of 
but, Button? Dont I want a list / popup menu ?
I am loading more data now..

> On Feb 27, 8:21 pm, darkblue_b  wrote:
>
> > well I guessed a little - and now something seems to work!
> > (more testing now)
>
> > {{=row.affirm_pkey}}{{pass}}
>
> >    -Brian
>
> > On Feb 27, 6:06 pm, darkblue_b  wrote:
>
> > > On Feb 27, 5:41 pm, Massimo Di Pierro 
> > > wrote:
>
> > > > Here is a possible solution (typos aside):
>
> > > > def index():
> > > >     return
> > > > dict(rows=db(db.ratings_view).select(db.ratings_view.affirm_pkey,distinct=T
> > > >  rue))
>
> > > > def callback():
> > > >     return
> > > > SQLTABLE(db(db.ratings_view.affirm_pkey==request.args(0)).select())
>
> > > > and in view/default/index.html()
>
> > > > {{extend 'layout.html'}}
> > > > 
> > > > {{for row in rows:}}
> > > > {{=row.affirm_pkey}}
> > > > 
> > > > 
> > > > 
>
> > > thx for the quick reply
> > > is the '>' necessary before {{=row.affirm_pkey}}   ??
> > > if it is removed, I get
> > >   "missing pass in view"
>
> > > if it is there, and I typed it in right
> > > it is simply a very long error in parse container with no msg
>
> > >   -Brian
>
> > > > On Feb 27, 6:53 pm, darkblue_b  wrote:
>
> > > > > Hi- maybe this is really easy and I havent found it yet..
> > > > > I now have a table defined in db.py, like so
>
> > > > > db.define_table('ratings_view',
> > > > >     Field('flat_key', type='integer'),
> > > > >     Field('rating_value', type='double'),
> > > > >     Field('category', type='text'),
> > > > >     Field('credit', type='text'),
> > > > >     Field('subcredit', type='text'),
> > > > >     Field('credit_weighting', type='integer'),
> > > > >     Field('category_weighting', type='integer'),
> > > > >     Field('subcredit_weighting', type='integer'),
> > > > >     Field('affirm_pkey', type='integer'),
> > > > >     Field('date_executed', type='date'),
> > > > >     Field('who_string', type='text'),
> > > > >     primarykey=['flat_key'],
> > > > >     migrate=migrate)  ##<- I dont know what this does yet --
>
> > > > > I want an HTML page that has two parts, a pop-up menu with a list of
> > > > > DISTINCT(affirm_pkey) at the top, and a table display below. The user
> > > > > chooses an affirm_pkey, and the display table is filled with results.
> > > > > In my case, there are always 253 rows per affirm_key. (this table
> > > > > definition is actually a VIEW defined in postgres.. it seems to work
> > > > > fine)
>
> > > > > thanks in advance  -Brian


[web2py] Re: web2py database administration

2011-02-27 Thread Christopher Steel
Hi Stargate,

I think what you want is called the DAL or Database Abstraction Layer.
The DAL does all of this for you for all of the databases that Web2py
support. You create your database schema in Web2py and the DAL sets up
whatever database backend you are using.

So for example you create this table and field and insert it in a file
in the models section and when you run the application the Web2py
driver for your database does all the "grunt work". You can use the
same definition for a number of database backends as follows:

db.define_table('mytable', Field('myfield'))

See chapter 6 of the online book for more info:

http://web2py.com/book/default/chapter/06



On Feb 22, 10:23 pm, stargate  wrote:
> I just started using mySQL with web2py now my question is when
> administrating the database from the web interface i added a new table
> in the mySQL database but when i hit refresh in the browser the table
> doesn't show up.  Also when adding another user I have to specify the
> userID.  How can you change this so in the database you select the
> maxID and add one to the ID.  Also when I delete the default users in
> the database the default users come back.


[web2py] Re: Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread Anthony
On Sunday, February 27, 2011 9:40:03 PM UTC-5, mart wrote: 
>
> well, I have to check... Naturally (and there is always a chance - I'm 
> actually left feeling surprised when I am not wrong), I could be 
> completely missing the mark here. I do know, that a copy (with a new 
> name) of appadmin is quite open to all users (because I did that 
> once), but just thought i'd mention...

 
Hmm, I can't reproduce this simply by renaming appadmin.py and appadmin.html 
to something else -- I still have to be logged in to admin to access (the 
renamed) appadmin. It looks like the following code in appadmin.py (which 
does not appear to depend on the name being 'appadmin') prevents 
unauthorized access:
 
if (request.application=='admin' and not session.authorized) or \
(request.application!='admin' and not 
gluon.fileutils.check_credentials(request)):
redirect(URL('admin', 'default', 'index'))
Anyway, I'm not recommending changing the name of appadmin -- don't see a 
good reason to.
 

>
> As for the appadmin not being an app... alright, sure. But, I can log 
> onto a web2py server (without logging into any application) and 
> view,update,delete data from any apps DB. Because I can do that, I 
> tend to want to see it as feature of having admin privileges...  admin 
> vs appadmin or app vs .py file with a view. I still see them belonging 
> together (even if I am wrong about it).

 
Yes, that makes sense.
 
Best,
Anthony


[web2py] Re: Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread Massimo Di Pierro
Technically Anthony is right. appadmin is not app, it is a controller
in each one of your apps. Historically appadmin was designed this way
to overcome a problem I had experienced with Django (only one appadmin
- which they call admin - per Django instance. This has changed since
in Django too).

appadmin uses admin authentication but that is just the default
behavior.

Nothing prevents you from renaming appadmin or editing such that it
uses the app's own authentication mechanism.

The name appadmin was chosen because even it today it mostly deal with
db administration, this may change in the future.

The reason appadmin requires admin access appadmin accepts more than
queries and does not validate input. A user with access to appadmin
can do as much damage as a user with access to admin, i.e. that use
has complete read/write access as the user running web2py has.

Instead of giving users access to appadmin create your own controller
action

@auth.requires_login()
def data(): return crud()

and this will give all users access to

/app/default/data/tables
/app/default/data/search/
/app/default/data/select/
/app/default/data/create/
/app/default/data/update//id
/app/default/data/delete//id










On Feb 27, 8:40 pm, mart  wrote:
> well, I have to check... Naturally (and there is always a chance - I'm
> actually left feeling surprised when I am not wrong), I could be
> completely missing the mark here. I do know, that a copy (with a new
> name) of appadmin is quite open to all users (because I did that
> once), but just thought i'd mention...
>
> As for the appadmin not being an app... alright, sure. But, I can log
> onto a web2py server (without logging into any application) and
> view,update,delete data from any apps DB. Because I can do that, I
> tend to want to see it as feature of having admin privileges...  admin
> vs appadmin or app vs .py file with a view. I still see them belonging
> together (even if I am wrong about it).
>
> Mart
>
> On Feb 27, 8:46 pm, Anthony  wrote:
>
>
>
>
>
>
>
> > appadmin isn't a separate app (like admin) -- it's a controller file
> > (appadmin.py) and view file (appadmin.html) included in the welcome and
> > admin apps. I'm not sure, but it looks like you might be able to rename it,
> > though I think the links from admin to appadmin would no longer work, and
> > appadmin.py makes one reference to appadmin.html, which would have to be
> > changed. I'm not sure if there are any security issues.
>
> > Anthony
>
> > On Sunday, February 27, 2011 7:52:31 PM UTC-5, mart wrote:
> > > and its an app... ;) and i think renaming it on the fly will cause you
> > > to lose the security around it (will be  exposed to all users, I
> > > think)
>
> > > On Feb 27, 2:22 pm, pbreit  wrote:
> > > > Well, it also includes /state and /cache so I'd say leave it for now.


[web2py] Re: Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread mart
well, I have to check... Naturally (and there is always a chance - I'm
actually left feeling surprised when I am not wrong), I could be
completely missing the mark here. I do know, that a copy (with a new
name) of appadmin is quite open to all users (because I did that
once), but just thought i'd mention...

As for the appadmin not being an app... alright, sure. But, I can log
onto a web2py server (without logging into any application) and
view,update,delete data from any apps DB. Because I can do that, I
tend to want to see it as feature of having admin privileges...  admin
vs appadmin or app vs .py file with a view. I still see them belonging
together (even if I am wrong about it).

Mart


On Feb 27, 8:46 pm, Anthony  wrote:
> appadmin isn't a separate app (like admin) -- it's a controller file
> (appadmin.py) and view file (appadmin.html) included in the welcome and
> admin apps. I'm not sure, but it looks like you might be able to rename it,
> though I think the links from admin to appadmin would no longer work, and
> appadmin.py makes one reference to appadmin.html, which would have to be
> changed. I'm not sure if there are any security issues.
>
> Anthony
>
> On Sunday, February 27, 2011 7:52:31 PM UTC-5, mart wrote:
> > and its an app... ;) and i think renaming it on the fly will cause you
> > to lose the security around it (will be  exposed to all users, I
> > think)
>
> > On Feb 27, 2:22 pm, pbreit  wrote:
> > > Well, it also includes /state and /cache so I'd say leave it for now.
>
>


[web2py] Re: selection by key

2011-02-27 Thread Massimo Di Pierro
My mistake:

{{extend 'layout.html'}}

{{for row in rows:}}
  {{=row.affirm_pkey}}
{{pass}}





On Feb 27, 8:21 pm, darkblue_b  wrote:
> well I guessed a little - and now something seems to work!
> (more testing now)
>
> {{=row.affirm_pkey}}{{pass}}
>
>    -Brian
>
> On Feb 27, 6:06 pm, darkblue_b  wrote:
>
>
>
>
>
>
>
> > On Feb 27, 5:41 pm, Massimo Di Pierro 
> > wrote:
>
> > > Here is a possible solution (typos aside):
>
> > > def index():
> > >     return
> > > dict(rows=db(db.ratings_view).select(db.ratings_view.affirm_pkey,distinct=T
> > >  rue))
>
> > > def callback():
> > >     return
> > > SQLTABLE(db(db.ratings_view.affirm_pkey==request.args(0)).select())
>
> > > and in view/default/index.html()
>
> > > {{extend 'layout.html'}}
> > > 
> > > {{for row in rows:}}
> > > {{=row.affirm_pkey}}
> > > 
> > > 
> > > 
>
> > thx for the quick reply
> > is the '>' necessary before {{=row.affirm_pkey}}   ??
> > if it is removed, I get
> >   "missing pass in view"
>
> > if it is there, and I typed it in right
> > it is simply a very long error in parse container with no msg
>
> >   -Brian
>
> > > On Feb 27, 6:53 pm, darkblue_b  wrote:
>
> > > > Hi- maybe this is really easy and I havent found it yet..
> > > > I now have a table defined in db.py, like so
>
> > > > db.define_table('ratings_view',
> > > >     Field('flat_key', type='integer'),
> > > >     Field('rating_value', type='double'),
> > > >     Field('category', type='text'),
> > > >     Field('credit', type='text'),
> > > >     Field('subcredit', type='text'),
> > > >     Field('credit_weighting', type='integer'),
> > > >     Field('category_weighting', type='integer'),
> > > >     Field('subcredit_weighting', type='integer'),
> > > >     Field('affirm_pkey', type='integer'),
> > > >     Field('date_executed', type='date'),
> > > >     Field('who_string', type='text'),
> > > >     primarykey=['flat_key'],
> > > >     migrate=migrate)  ##<- I dont know what this does yet --
>
> > > > I want an HTML page that has two parts, a pop-up menu with a list of
> > > > DISTINCT(affirm_pkey) at the top, and a table display below. The user
> > > > chooses an affirm_pkey, and the display table is filled with results.
> > > > In my case, there are always 253 rows per affirm_key. (this table
> > > > definition is actually a VIEW defined in postgres.. it seems to work
> > > > fine)
>
> > > > thanks in advance  -Brian


[web2py] Re: selection by key

2011-02-27 Thread darkblue_b
well I guessed a little - and now something seems to work!
(more testing now)


{{=row.affirm_pkey}}{{pass}}


   -Brian

On Feb 27, 6:06 pm, darkblue_b  wrote:
> On Feb 27, 5:41 pm, Massimo Di Pierro 
> wrote:
>
>
>
> > Here is a possible solution (typos aside):
>
> > def index():
> >     return
> > dict(rows=db(db.ratings_view).select(db.ratings_view.affirm_pkey,distinct=T 
> > rue))
>
> > def callback():
> >     return
> > SQLTABLE(db(db.ratings_view.affirm_pkey==request.args(0)).select())
>
> > and in view/default/index.html()
>
> > {{extend 'layout.html'}}
> > 
> > {{for row in rows:}}
> > {{=row.affirm_pkey}}
> > 
> > 
> > 
>
> thx for the quick reply
> is the '>' necessary before {{=row.affirm_pkey}}   ??
> if it is removed, I get
>   "missing pass in view"
>
> if it is there, and I typed it in right
> it is simply a very long error in parse container with no msg
>
>   -Brian
>
> > On Feb 27, 6:53 pm, darkblue_b  wrote:
>
> > > Hi- maybe this is really easy and I havent found it yet..
> > > I now have a table defined in db.py, like so
>
> > > db.define_table('ratings_view',
> > >     Field('flat_key', type='integer'),
> > >     Field('rating_value', type='double'),
> > >     Field('category', type='text'),
> > >     Field('credit', type='text'),
> > >     Field('subcredit', type='text'),
> > >     Field('credit_weighting', type='integer'),
> > >     Field('category_weighting', type='integer'),
> > >     Field('subcredit_weighting', type='integer'),
> > >     Field('affirm_pkey', type='integer'),
> > >     Field('date_executed', type='date'),
> > >     Field('who_string', type='text'),
> > >     primarykey=['flat_key'],
> > >     migrate=migrate)  ##<- I dont know what this does yet --
>
> > > I want an HTML page that has two parts, a pop-up menu with a list of
> > > DISTINCT(affirm_pkey) at the top, and a table display below. The user
> > > chooses an affirm_pkey, and the display table is filled with results.
> > > In my case, there are always 253 rows per affirm_key. (this table
> > > definition is actually a VIEW defined in postgres.. it seems to work
> > > fine)
>
> > > thanks in advance  -Brian


[web2py] Re: selection by key

2011-02-27 Thread darkblue_b


On Feb 27, 5:41 pm, Massimo Di Pierro 
wrote:
> Here is a possible solution (typos aside):
>
> def index():
>     return
> dict(rows=db(db.ratings_view).select(db.ratings_view.affirm_pkey,distinct=T 
> rue))
>
> def callback():
>     return
> SQLTABLE(db(db.ratings_view.affirm_pkey==request.args(0)).select())
>
> and in view/default/index.html()
>
> {{extend 'layout.html'}}
> 
> {{for row in rows:}}
> {{=row.affirm_pkey}}
> 
> 
> 
>

thx for the quick reply
is the '>' necessary before {{=row.affirm_pkey}}   ??
if it is removed, I get
  "missing pass in view"

if it is there, and I typed it in right
it is simply a very long error in parse container with no msg

  -Brian




> On Feb 27, 6:53 pm, darkblue_b  wrote:
>
> > Hi- maybe this is really easy and I havent found it yet..
> > I now have a table defined in db.py, like so
>
> > db.define_table('ratings_view',
> >     Field('flat_key', type='integer'),
> >     Field('rating_value', type='double'),
> >     Field('category', type='text'),
> >     Field('credit', type='text'),
> >     Field('subcredit', type='text'),
> >     Field('credit_weighting', type='integer'),
> >     Field('category_weighting', type='integer'),
> >     Field('subcredit_weighting', type='integer'),
> >     Field('affirm_pkey', type='integer'),
> >     Field('date_executed', type='date'),
> >     Field('who_string', type='text'),
> >     primarykey=['flat_key'],
> >     migrate=migrate)  ##<- I dont know what this does yet --
>
> > I want an HTML page that has two parts, a pop-up menu with a list of
> > DISTINCT(affirm_pkey) at the top, and a table display below. The user
> > chooses an affirm_pkey, and the display table is filled with results.
> > In my case, there are always 253 rows per affirm_key. (this table
> > definition is actually a VIEW defined in postgres.. it seems to work
> > fine)
>
> > thanks in advance  -Brian


[web2py] Re: Python fourth on the list

2011-02-27 Thread blackthorne
that is programming language popularity
not web programming language popularity

On Feb 28, 12:28 am, Plumo  wrote:
> wow, more popular than PHP? I find that hard to believe.


[web2py] Re: selection by key

2011-02-27 Thread Anthony
On Sunday, February 27, 2011 7:53:39 PM UTC-5, darkblue_b wrote: 
>
> migrate=migrate)  ##<- I dont know what this does yet -- 

 
'migrate' tells web2py whether to run automatic migrations of the database 
table when your web2py model changes. See 
http://web2py.com/book/default/chapter/06#Migrations for details.
 
By default, migrate=True. In the above code, migrate=migrate, so I assume 
the variable 'migrate' is defined earlier to be either True or False 
(usually you want it True in development but False on production). I think 
some people define it programmatically by figuring out whether the current 
environment is the development or production environment.
 
Anthony


[web2py] Re: Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread Anthony
appadmin isn't a separate app (like admin) -- it's a controller file 
(appadmin.py) and view file (appadmin.html) included in the welcome and 
admin apps. I'm not sure, but it looks like you might be able to rename it, 
though I think the links from admin to appadmin would no longer work, and 
appadmin.py makes one reference to appadmin.html, which would have to be 
changed. I'm not sure if there are any security issues.
 
Anthony

On Sunday, February 27, 2011 7:52:31 PM UTC-5, mart wrote:

> and its an app... ;) and i think renaming it on the fly will cause you 
> to lose the security around it (will be  exposed to all users, I 
> think) 
>
> On Feb 27, 2:22 pm, pbreit  wrote: 
> > Well, it also includes /state and /cache so I'd say leave it for now.



[web2py] Re: selection by key

2011-02-27 Thread Massimo Di Pierro
Here is a possible solution (typos aside):

def index():
return
dict(rows=db(db.ratings_view).select(db.ratings_view.affirm_pkey,distinct=True))

def callback():
return
SQLTABLE(db(db.ratings_view.affirm_pkey==request.args(0)).select())

and in view/default/index.html()

{{extend 'layout.html'}}

{{for row in rows:}}
{{=row.affirm_pkey}}






On Feb 27, 6:53 pm, darkblue_b  wrote:
> Hi- maybe this is really easy and I havent found it yet..
> I now have a table defined in db.py, like so
>
> db.define_table('ratings_view',
>     Field('flat_key', type='integer'),
>     Field('rating_value', type='double'),
>     Field('category', type='text'),
>     Field('credit', type='text'),
>     Field('subcredit', type='text'),
>     Field('credit_weighting', type='integer'),
>     Field('category_weighting', type='integer'),
>     Field('subcredit_weighting', type='integer'),
>     Field('affirm_pkey', type='integer'),
>     Field('date_executed', type='date'),
>     Field('who_string', type='text'),
>     primarykey=['flat_key'],
>     migrate=migrate)  ##<- I dont know what this does yet --
>
> I want an HTML page that has two parts, a pop-up menu with a list of
> DISTINCT(affirm_pkey) at the top, and a table display below. The user
> chooses an affirm_pkey, and the display table is filled with results.
> In my case, there are always 253 rows per affirm_key. (this table
> definition is actually a VIEW defined in postgres.. it seems to work
> fine)
>
> thanks in advance  -Brian


[web2py] selection by key

2011-02-27 Thread darkblue_b
Hi- maybe this is really easy and I havent found it yet..
I now have a table defined in db.py, like so

db.define_table('ratings_view',
Field('flat_key', type='integer'),
Field('rating_value', type='double'),
Field('category', type='text'),
Field('credit', type='text'),
Field('subcredit', type='text'),
Field('credit_weighting', type='integer'),
Field('category_weighting', type='integer'),
Field('subcredit_weighting', type='integer'),
Field('affirm_pkey', type='integer'),
Field('date_executed', type='date'),
Field('who_string', type='text'),
primarykey=['flat_key'],
migrate=migrate)  ##<- I dont know what this does yet --

I want an HTML page that has two parts, a pop-up menu with a list of
DISTINCT(affirm_pkey) at the top, and a table display below. The user
chooses an affirm_pkey, and the display table is filled with results.
In my case, there are always 253 rows per affirm_key. (this table
definition is actually a VIEW defined in postgres.. it seems to work
fine)

thanks in advance  -Brian



[web2py] Re: Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread mart
and its an app... ;) and i think renaming it on the fly will cause you
to lose the security around it (will be  exposed to all users, I
think)

On Feb 27, 2:22 pm, pbreit  wrote:
> Well, it also includes /state and /cache so I'd say leave it for now.


[web2py] Re: Python fourth on the list

2011-02-27 Thread Plumo
wow, more popular than PHP? I find that hard to believe.

Re: [web2py] Re: Status of Python 2.4 support

2011-02-27 Thread Plumo
sometimes I have to support whatever server the client uses

Re: [web2py] Re: Status of Python 2.4 support

2011-02-27 Thread David J
I have a side question. Why couldn't you choose another hosting company? Why
do people insist on using hosts that are so outdated? It can't be
financially motivated. It seems like plenty of options are available for
just under $10.
On Feb 27, 2011 2:09 PM, "Russ"  wrote:
> Very good to know. Thanks Anthony!
>
> On Feb 27, 12:56 pm, Anthony  wrote:
>> According to Massimo, the current 1.92.* series will maintain support for
>> Python 2.4, but support will be dropped starting with the 1.93.* release:
>>
>> https://groups.google.com/d/msg/web2py/c58q8YHAGW4/dK4uuvWrq6AJ
>>
>>
>>
>>
>>
>>
>>
>> On Sunday, February 27, 2011 1:32:58 PM UTC-5, Russ wrote:
>> > I know that 2.4 is not "officially" supported, but I've just
>> > discovered the joy of web2py and my web hosting service only provides
>> > 2.4.3 right now.
>>
>> > I've already contacted their support and 2.4.3 is the latest they
>> > provide, although I'll probably make another ticket to request an
>> > upgrade anyway. ;)
>>
>> > Does the latest web2py version still work with Python 2.4 or am I
>> > about to be the guinea pig? ;)
>>
>> > Thanks for reading,
>>
>> > Russ


Re: [web2py] json/xml not working on GAE

2011-02-27 Thread Jonathan Lundell
On Feb 27, 2011, at 12:59 PM, Sebastian E. Ovide wrote:
> yes, that is right...to see that I had to select severity "debug"...
> 
> no errors are thrown... just an empty json/xml
> 
> http://w2papp2.appspot.com/rest/default/restaurants (works)
> http://w2papp2.appspot.com/rest/default/restaurants.json (doen't)
> http://w2papp2.appspot.com/rest/default/restaurants.xml (doen't)

I don't have any particular insight, but I can suggest some things that I'd 
try.( BTW, are you getting an empty document with the appropriate Content-Type 
header, or nothing at all?)

1. Replace generic.json (temporarily) with one that does simply:

{{ raise HTTP(405,'hello from json') }}

...to make sure you're at least invoking it.

2. If (1) "works" (ie, throws a 405), try manually generating some content 
there.

3. Create an explicit rest/views/default/restaurants.json and see if that makes 
any difference.

4. More logging...


> 
> 
> On Sun, Feb 27, 2011 at 6:07 PM, Jonathan Lundell  wrote:
> On Feb 27, 2011, at 9:58 AM, Sebastian E. Ovide wrote:
>> Hi,
>> 
>> I have a simple action:
>> 
>> def restaurants():
>> restaurants=db().select(db.restaurant.ALL)
>> return dict(restaurants=restaurants)
>> 
>> on my machine I can get myapp/default/restaurants.json or .xml but it 
>> doesn't work on GAE !... 
>> 
>> in GAE myapp/default/restaurants work but if I append .json or .xml I would 
>> get an empty json/xml...
>> 
>> on GAE I see 
>> 
>> D2011-02-27 09:50:20.163 routes_out: [/rest/default/restaurants.json] not 
>> rewritten
>> 
>> 
>> any ideas ?
> 
> 
> The message is routine, fwiw, assuming that you're not expecting that path to 
> be rewritten. It's debug-level logging, but IIRC GAE logs everything.
> 
> 
> 
> -- 
> Sebastian E. Ovide
> 
> 
> 
> 




Re: [web2py] json/xml not working on GAE

2011-02-27 Thread Sebastian E. Ovide
yes, that is right...to see that I had to select severity "debug"...

no errors are thrown... just an empty json/xml

http://w2papp2.appspot.com/rest/default/restaurants
 (works)
http://w2papp2.appspot.com/rest/default/restaurants.json (doen't)
http://w2papp2.appspot.com/rest/default/restaurants.
xml (doen't)


On Sun, Feb 27, 2011 at 6:07 PM, Jonathan Lundell wrote:

> On Feb 27, 2011, at 9:58 AM, Sebastian E. Ovide wrote:
>
> Hi,
>
> I have a simple action:
>
> def restaurants():
> restaurants=db().select(db.restaurant.ALL)
> return dict(restaurants=restaurants)
>
> on my machine I can get myapp/default/restaurants.json or .xml but it
> doesn't work on GAE !...
>
> in GAE myapp/default/restaurants work but if I append .json or .xml I would
> get an empty json/xml...
>
> on GAE I see
>
> *D2011-02-27 09:50:20.163 routes_out: [/rest/default/restaurants.json] not
> rewritten*
> *
> *
> *
> *
> *any ideas ?*
>
>
>
> The message is routine, fwiw, assuming that you're not expecting that path
> to be rewritten. It's debug-level logging, but IIRC GAE logs everything.
>



-- 
Sebastian E. Ovide


[web2py] Re: extract_mysql_models.py

2011-02-27 Thread Anthony
It's in /web2py/scripts/

On Sunday, February 27, 2011 2:55:43 PM UTC-5, stargate wrote:

> Where do I find this file? 
>
> extract_mysql_models.py 
>
> On Feb 26, 10:12 am, Vasile Ermicioi  wrote: 
> > please read the comments from the script 
> > 
> > Under Windows you will probably need to add the mysql executable 
> directory 
> > 
> > > to the PATH variable, 
> > > you will also need to modify mysql to mysql.exe and mysqldump to 
> > > mysqldump.exe below. 
> > > Just guessing here :) 
> > 
> >



[web2py] Re: extract_mysql_models.py

2011-02-27 Thread villas
It's distributed with web2py source.  See here:

http://code.google.com/p/web2py/source/browse/scripts/extract_mysql_models.py

On Feb 27, 7:55 pm, stargate  wrote:
> Where do I find this file?
>
> extract_mysql_models.py
>
> On Feb 26, 10:12 am, Vasile Ermicioi  wrote:
>
> > please read the comments from the script
>
> > Under Windows you will probably need to add the mysql executable directory
>
> > > to the PATH variable,
> > > you will also need to modify mysql to mysql.exe and mysqldump to
> > > mysqldump.exe below.
> > > Just guessing here :)
>
>


[web2py] Re: Licensator

2011-02-27 Thread villas
LOL we needed this for web2py a few weeks ago!  Nice idea.

On Feb 27, 7:57 pm, Bruno Rocha  wrote:
>  Starting a new open source project? We can help
> you!
>
> Create your own open source project can be a lot of fun! Except, of course,
> when you have to decide which
> license to
> use.
>
> Licensator  is a free service that helps you
> with this boring task. All you have to do is answer a few questions about
> your project and we'll recommend the licenses that fit best.
>
> Enjoy!
>
> http://licensator.appspot.com/
>
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]


[web2py] Licensator

2011-02-27 Thread Bruno Rocha
 Starting a new open source project? We can help
you!

Create your own open source project can be a lot of fun! Except, of course,
when you have to decide which
license to
use.

Licensator  is a free service that helps you
with this boring task. All you have to do is answer a few questions about
your project and we'll recommend the licenses that fit best.

Enjoy!

http://licensator.appspot.com/


--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]


[web2py] Re: extract_mysql_models.py

2011-02-27 Thread stargate
Where do I find this file?

extract_mysql_models.py

On Feb 26, 10:12 am, Vasile Ermicioi  wrote:
> please read the comments from the script
>
> Under Windows you will probably need to add the mysql executable directory
>
> > to the PATH variable,
> > you will also need to modify mysql to mysql.exe and mysqldump to
> > mysqldump.exe below.
> > Just guessing here :)
>
>


[web2py] Re: bitwise operations?

2011-02-27 Thread pbreit
Would operator.and_(a, b) work?

http://docs.python.org/library/operator.html


[web2py] Re: Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread pbreit
Well, it also includes /state and /cache so I'd say leave it for now.

[web2py] Re: Status of Python 2.4 support

2011-02-27 Thread Russ
Very good to know. Thanks Anthony!

On Feb 27, 12:56 pm, Anthony  wrote:
> According to Massimo, the current 1.92.* series will maintain support for
> Python 2.4, but support will be dropped starting with the 1.93.* release:
>
> https://groups.google.com/d/msg/web2py/c58q8YHAGW4/dK4uuvWrq6AJ
>
>
>
>
>
>
>
> On Sunday, February 27, 2011 1:32:58 PM UTC-5, Russ wrote:
> > I know that 2.4 is not "officially" supported, but I've just
> > discovered the joy of web2py and my web hosting service only provides
> > 2.4.3 right now.
>
> > I've already contacted their support and 2.4.3 is the latest they
> > provide, although I'll probably make another ticket to request an
> > upgrade anyway. ;)
>
> > Does the latest web2py version still work with Python 2.4 or am I
> > about to be the guinea pig? ;)
>
> > Thanks for reading,
>
> > Russ


[web2py] Don't you think the "appadmin" thing can be better named as "dbadmin"?

2011-02-27 Thread AW
As in the subject title.


[web2py] Re: Status of Python 2.4 support

2011-02-27 Thread Anthony
According to Massimo, the current 1.92.* series will maintain support for 
Python 2.4, but support will be dropped starting with the 1.93.* release:
 
https://groups.google.com/d/msg/web2py/c58q8YHAGW4/dK4uuvWrq6AJ
 

On Sunday, February 27, 2011 1:32:58 PM UTC-5, Russ wrote:

> I know that 2.4 is not "officially" supported, but I've just 
> discovered the joy of web2py and my web hosting service only provides 
> 2.4.3 right now. 
>
> I've already contacted their support and 2.4.3 is the latest they 
> provide, although I'll probably make another ticket to request an 
> upgrade anyway. ;) 
>
> Does the latest web2py version still work with Python 2.4 or am I 
> about to be the guinea pig? ;) 
>
> Thanks for reading, 
>
> Russ



[web2py] Suggestion: SQLFORM.formsyle

2011-02-27 Thread teemu
Hi,

I would like to suggest some changes to SQLFORM class. I heavily use
'formstyle=function' feature in my web2py-projects to create
customized form layouts. However, there is one big disadvantage in
behavior of the standard SQLFORM code. SQLFORM always wraps form into
 element if one define 'formstyle=function'. Standard
formstyles 'divs' and 'ul' don't use  element at all but wraps
form to DIV and UL elements respectively. This is code from
web2py.gluon.sqlhtml:

clip--
elif type(formstyle) == type(lambda:None):
table = TABLE()
for id,a,b,c in xfields:
td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
newrows = formstyle(id,a,td_b,c)
if type(newrows).__name__ != "tuple":
newrows = [newrows]
for newrow in newrows:
table.append(newrow)

clip--

I know that it is not possible to change standard behavior of the
current code because it would break backward compatibility. I have
tried to think about other possibilities to modify the SQLFORM code to
bring in some more flexibility or even full freedom to define form
layouts. Currently it is not easy to change behavior of the code by
extending SQLFORM class because the code that I would like to change
is part of SQLFORM constructor. I would need to replace whole
constructor that is quite a big bunch of code.

This is my suggestion:
It would easier to override standard behavior if formstyle code were
outside of constructor in it's own function. Then I would need to
override only this particular function. I created this quick hack
patch to illustrate my idea. What do you thing Massimo? Would this be
the right way to go or do you have better suggestions?

--
clip--
# HG changeset patch
# User teemu 
# Date 1298831231 -7200
# Node ID b44d92468fd59d7197756d5e02493a0bb6a8e8b1
# Parent  05c759fbff4a6dcba140f7f6c59a5cb0e583e73a
customformstyle

diff -r 05c759fbff4a -r b44d92468fd5 gluon/sqlhtml.py
--- a/gluon/sqlhtml.py  Fri Feb 25 22:13:51 2011 -0600
+++ b/gluon/sqlhtml.py  Sun Feb 27 20:27:11 2011 +0200
@@ -891,46 +891,51 @@
 (begin, end) = self._xml()
 self.custom.begin = XML("<%s %s>" % (self.tag, begin))
 self.custom.end = XML("%s" % (end, self.tag))
-if formstyle == 'table3cols':
+   table = self.createform(xfields)
+self.components = [table]
+
+def createform(self, xfields):
+if self.formstyle == 'table3cols':
 table = TABLE()
 for id,a,b,c in xfields:
 td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
 table.append(TR(TD(a,_class='w2p_fl'),
 td_b,
 TD(c,_class='w2p_fc'),_id=id))
-elif formstyle == 'table2cols':
+elif self.formstyle == 'table2cols':
 table = TABLE()
 for id,a,b,c in xfields:
 td_b = self.field_parent[id] =
TD(b,_class='w2p_fw',_colspan="2")
 table.append(TR(TD(a,_class='w2p_fl'),
 TD(c,_class='w2p_fc'),_id=id
+'1',_class='even'))
 table.append(TR(td_b,_id=id+'2',_class='odd'))
-elif formstyle == 'divs':
+elif self.formstyle == 'divs':
 table = TAG['']()
 for id,a,b,c in xfields:
 div_b = self.field_parent[id] =
DIV(b,_class='w2p_fw')
 table.append(DIV(DIV(a,_class='w2p_fl'),
  div_b,
  DIV(c,_class='w2p_fc'),_id=id))
-elif formstyle == 'ul':
+elif self.formstyle == 'ul':
 table = UL()
 for id,a,b,c in xfields:
 div_b = self.field_parent[id] =
DIV(b,_class='w2p_fw')
 table.append(LI(DIV(a,_class='w2p_fl'),
  div_b,
  DIV(c,_class='w2p_fc'),_id=id))
-elif type(formstyle) == type(lambda:None):
+elif type(self.formstyle) == type(lambda:None):
 table = TABLE()
 for id,a,b,c in xfields:
 td_b = self.field_parent[id] = TD(b,_class='w2p_fw')
-newrows = formstyle(id,a,td_b,c)
+newrows = self.formstyle(id,a,td_b,c)
 if type(newrows).__name__ != "tuple":
 newrows = [newrows]
 for newrow in newrows:
 table.append(newrow)
 else:
 raise RuntimeError, 'formsyle not supported'
-self.components = [table]
+
+   return table

--
clip--

I had to pass xfields

[web2py] Status of Python 2.4 support

2011-02-27 Thread Russ
I know that 2.4 is not "officially" supported, but I've just
discovered the joy of web2py and my web hosting service only provides
2.4.3 right now.

I've already contacted their support and 2.4.3 is the latest they
provide, although I'll probably make another ticket to request an
upgrade anyway. ;)

Does the latest web2py version still work with Python 2.4 or am I
about to be the guinea pig? ;)

Thanks for reading,

Russ


[web2py] bitwise operations?

2011-02-27 Thread br
How I can make DAL query using bitwise 'AND' operator?

raw sql looks like:
select * from some_table where flags & 1 = 1

thanks

LOVE web2py


[web2py] Re: are external modules reloaded with each request?

2011-02-27 Thread VP
Yes, thank you.   I mistakenly set it to True and left there.  With
reload=False, the module is loaded only once.

On Feb 27, 12:26 pm, pbreit  wrote:
> I'm wrong, the default is False. So it seems by default it should not be
> reloading.


[web2py] Re: are external modules reloaded with each request?

2011-02-27 Thread pbreit
I'm wrong, the default is False. So it seems by default it should not be 
reloading.

[web2py] Re: are external modules reloaded with each request?

2011-02-27 Thread pbreit
And make sure to set reload=False (default is True) in local_import():
http://www.web2py.com/book/default/chapter/04?search=modules#Third-Party-Modules


[web2py] Re: are external modules reloaded with each request?

2011-02-27 Thread pbreit
I thought the point was to use modules instead of models since modules are 
only loaded when you do a local_import().

[web2py] are external modules reloaded with each request?

2011-02-27 Thread VP
Are modules defined in applications/app/modules reloaded with each
request?

It appears so; because when I modified the module changes are picked
up right away without restarting web2py.

If this is the case, what is the point of moving codes from
controllers/models into external modules?


Re: [web2py] json/xml not working on GAE

2011-02-27 Thread Jonathan Lundell
On Feb 27, 2011, at 9:58 AM, Sebastian E. Ovide wrote:
> Hi,
> 
> I have a simple action:
> 
> def restaurants():
> restaurants=db().select(db.restaurant.ALL)
> return dict(restaurants=restaurants)
> 
> on my machine I can get myapp/default/restaurants.json or .xml but it 
> doesn't work on GAE !... 
> 
> in GAE myapp/default/restaurants work but if I append .json or .xml I would 
> get an empty json/xml...
> 
> on GAE I see 
> 
> D2011-02-27 09:50:20.163 routes_out: [/rest/default/restaurants.json] not 
> rewritten
> 
> 
> any ideas ?


The message is routine, fwiw, assuming that you're not expecting that path to 
be rewritten. It's debug-level logging, but IIRC GAE logs everything.

[web2py] json/xml not working on GAE

2011-02-27 Thread Sebastian E. Ovide
Hi,

I have a simple action:

def restaurants():
restaurants=db().select(db.restaurant.ALL)
return dict(restaurants=restaurants)

on my machine I can get myapp/default/restaurants.json or .xml but it
doesn't work on GAE !...

in GAE myapp/default/restaurants work but if I append .json or .xml I would
get an empty json/xml...

on GAE I see

*D2011-02-27 09:50:20.163 routes_out: [/rest/default/restaurants.json] not
rewritten*
*
*
*
*
*any ideas ?*


-- 
Sebastian E. Ovide


[web2py] Re: Displaying br instead new line in views

2011-02-27 Thread Alexandre Strzelewicz
I simply did :

{{=XML(vote.content.replace('\n',''))}}

Thanks for help

Thanks for your help

On Feb 27, 6:34 pm, blackthorne  wrote:
> yes, because I've inserted some '\n' directly on the database and the
> GUI used for that, did that for me. As I read that by using that it
> still wasn't working for him, I wondered if his problem wasn't the
> same as mine.
>
> On Feb 27, 2:35 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Actually I think Denes is right. If you have to use '\\n' instead of
> > '\n' something is wrong with the data you have (it is escaped twice?)
>
> > Massimo
>
> > On Feb 26, 1:50 pm, blackthorne  wrote:
>
> > > guys,
> > > if you have the same trouble I just did, this should work. Try it:
> > > {{=XML(note.content.replace('\\n',''),sanitize=True)}}
>
> > > Best regards
>
> > > On Feb 20, 9:35 pm, DenesL  wrote:
>
> > > > {{=XML(note.content.replace('\n',''),sanitize=True)}}
>
> > > > On Feb 20, 12:10 pm, Alexandre Strzelewicz
>
> > > >  wrote:
> > > > > Same :/ I've already tried to replace double quotes with nothing
>
> > > > > On Feb 20, 5:34 pm, Jonathan Lundell  wrote:
>
> > > > > > On Feb 20, 2011, at 8:13 AM, Alexandre Strzelewicz wrote:
>
> > > > > > > Rhm sorry for posting 4 times the same message...
>
> > > > > > > {{=XML(note.content, sanitize=True).xml().replace('\n','')}}
>
> > > > > > > replace '\n' with 'br' but web2py quote the content :
>
> > > > > > > "* Test1
> > > > > > > * Test2
> > > > > > > * Test3
> > > > > > > "
>
> > > > > > > and without replacing '\n' with 'br' it doesn't insert double 
> > > > > > > quotes.
>
> > > > > > > * Test1
> > > > > > > * Test2
> > > > > > > * Test3
>
> > > > > > > But without br there are no new line.
>
> > > > > > > It seems to be so simple but I've no passtrough to avoid this 
> > > > > > > problem.
>
> > > > > > Perhaps:
>
> > > > > > {{=XML(note.content, sanitize=True).xml().replace('\n',' > > > > > />').strip(")}}
>
> > > > > > > On Feb 20, 1:06 am, Bruno Rocha  wrote:
> > > > > > >> I guess it should be 'sanitize'
>
> > > > > > >> {{=XML(note.content, sanitize=True).xml().replace('\n',')}}
>
> > > > > > >> Bruno Rocha
> > > > > > >> [ About me:http://zerp.ly/rochacbruno]
>
> > > > > > >> 2011/2/19 Alexandre Strzelewicz 
>
> > > > > > >>> Thanks, but it doesn't work, it gives me the error "unexpected 
> > > > > > >>> keyword
> > > > > > >>> argument escape".
>
> > > > > > >>> Is there a way to remove double quotes when printing 
> > > > > > >>> {{=note.content}} ?
>
> > > > > > >>> On Sat, Feb 19, 2011 at 4:03 PM, Massimo Di Pierro <
> > > > > > >>> massimo.dipie...@gmail.com> wrote:
>
> > > > > >  try this:
>
> > > > > >  {{=XML(note.content,escape=True).xml().replace('\n',')}}
>
> > > > > >  On Feb 19, 8:18 am, Alexandre Strzelewicz
> > > > > >   wrote:
> > > > > > > In my view I display text with :
> > > > > > > {{=note.content}}
>
> > > > > > > But I didnt find a way to replace new line with .
> > > > > > > I tried directly with replace('\n', '') but it escapes 
> > > > > > > the br in
> > > > > > > html format
>
> > > > > > > Thanks
>
> > > > > > >>> --
> > > > > > >>> Cordialement,
> > > > > > >>> Alexandre Strzelewicz
>
> > > > > > >>>www.hemca.com


[web2py] Re: Displaying br instead new line in views

2011-02-27 Thread blackthorne
yes, because I've inserted some '\n' directly on the database and the
GUI used for that, did that for me. As I read that by using that it
still wasn't working for him, I wondered if his problem wasn't the
same as mine.

On Feb 27, 2:35 am, Massimo Di Pierro 
wrote:
> Actually I think Denes is right. If you have to use '\\n' instead of
> '\n' something is wrong with the data you have (it is escaped twice?)
>
> Massimo
>
> On Feb 26, 1:50 pm, blackthorne  wrote:
>
>
>
> > guys,
> > if you have the same trouble I just did, this should work. Try it:
> > {{=XML(note.content.replace('\\n',''),sanitize=True)}}
>
> > Best regards
>
> > On Feb 20, 9:35 pm, DenesL  wrote:
>
> > > {{=XML(note.content.replace('\n',''),sanitize=True)}}
>
> > > On Feb 20, 12:10 pm, Alexandre Strzelewicz
>
> > >  wrote:
> > > > Same :/ I've already tried to replace double quotes with nothing
>
> > > > On Feb 20, 5:34 pm, Jonathan Lundell  wrote:
>
> > > > > On Feb 20, 2011, at 8:13 AM, Alexandre Strzelewicz wrote:
>
> > > > > > Rhm sorry for posting 4 times the same message...
>
> > > > > > {{=XML(note.content, sanitize=True).xml().replace('\n','')}}
>
> > > > > > replace '\n' with 'br' but web2py quote the content :
>
> > > > > > "* Test1
> > > > > > * Test2
> > > > > > * Test3
> > > > > > "
>
> > > > > > and without replacing '\n' with 'br' it doesn't insert double 
> > > > > > quotes.
>
> > > > > > * Test1
> > > > > > * Test2
> > > > > > * Test3
>
> > > > > > But without br there are no new line.
>
> > > > > > It seems to be so simple but I've no passtrough to avoid this 
> > > > > > problem.
>
> > > > > Perhaps:
>
> > > > > {{=XML(note.content, sanitize=True).xml().replace('\n',' > > > > />').strip(")}}
>
> > > > > > On Feb 20, 1:06 am, Bruno Rocha  wrote:
> > > > > >> I guess it should be 'sanitize'
>
> > > > > >> {{=XML(note.content, sanitize=True).xml().replace('\n',')}}
>
> > > > > >> Bruno Rocha
> > > > > >> [ About me:http://zerp.ly/rochacbruno]
>
> > > > > >> 2011/2/19 Alexandre Strzelewicz 
>
> > > > > >>> Thanks, but it doesn't work, it gives me the error "unexpected 
> > > > > >>> keyword
> > > > > >>> argument escape".
>
> > > > > >>> Is there a way to remove double quotes when printing 
> > > > > >>> {{=note.content}} ?
>
> > > > > >>> On Sat, Feb 19, 2011 at 4:03 PM, Massimo Di Pierro <
> > > > > >>> massimo.dipie...@gmail.com> wrote:
>
> > > > >  try this:
>
> > > > >  {{=XML(note.content,escape=True).xml().replace('\n',')}}
>
> > > > >  On Feb 19, 8:18 am, Alexandre Strzelewicz
> > > > >   wrote:
> > > > > > In my view I display text with :
> > > > > > {{=note.content}}
>
> > > > > > But I didnt find a way to replace new line with .
> > > > > > I tried directly with replace('\n', '') but it escapes the 
> > > > > > br in
> > > > > > html format
>
> > > > > > Thanks
>
> > > > > >>> --
> > > > > >>> Cordialement,
> > > > > >>> Alexandre Strzelewicz
>
> > > > > >>>www.hemca.com


[web2py] Re: Small bug in gluon/widget.py and something more

2011-02-27 Thread José L .


On Sunday, February 27, 2011 3:32:36 AM UTC+1, Massimo Di Pierro wrote:
>
> OK. I only have one request. Can you define 
>
> gtk_presentation 
>
> in its own module in contrib and try import it from widget? 
>
> I am not sure how this plays out with py2exe and py2app 
>
>
Done. I have uploaded widget.py, widget.diff and  gtk_presentation.py (to be 
placed at gluon/contrib) again to http://people.debian.org/~jredrejo/web2py

update_canvas is also implemented now, so I consider it finished unless some 
bug arise.

Regards.
José L.


P.S.:  web2pyGtkDialog could also be taken to contrib if you like, but It 
seems it makes more sense having it inside the widget.py module.


Re: [web2py] Pass args to function with cron

2011-02-27 Thread Jonathan Lundell
On Feb 27, 2011, at 12:31 AM, Thadeus Burgess wrote:
> Using the following syntax...
> 
> */5 *   *   *   *root *default/do/arg1/arg2/arg3
> 
> It fails with "Invalid application name"
> 
> Is there a way to pass args to the functions when using the web2py cron?

It doesn't look like it; controller and function only. In your case, I think 
that shell.parse_path_info is failing. 

I don't see any compelling reason why args couldn't be supported, but they're 
not now.

[web2py] using oembed to embed videos in a web2py blog

2011-02-27 Thread JagChris
I have been trying to figure out how to do this, but i can't seem to
go anywhere with it. How do i use this to embed videos in a form


[web2py] Re: newb - a postgres database view

2011-02-27 Thread DenesL

I haven't used the extract scripts myself (there is one for mysql
too).
Let us know how it goes.


On Feb 26, 9:33 pm, darkblue_b  wrote:
> in case I wasnt clear, I used "extract_pgsql_models.py" to create the
> model..
> you have to re-arrange the output, from alpha by method to leaf tables
> first
> but it appears to work well..
>
> On Feb 26, 5:39 am, DenesL  wrote:
>
> > > Hi All-  making some progress here in week 1 with web2py...
> > > I wrote my postgres  database first, and generated the model from it..
> > > and that is working well ..
>
> > 1) build your models in Web2py and let it create your DB schema
>
> > > But I have one *postgres* view, which is about 5 joins.. I dont yet
> > > understand..
> > > Do i have to write this out in the web2py *QL, or can I execute sql
> > > and return it somehow ..
>
> > 2) try to first use Web2py DAL.
>
> > Maybe his answer was not what you expected but it is surely related
> > and correct.
>
> > > (I do not yet understand how I specify response._vars and such for
> > > web2py views...
> > >  - will re-read while researcing )
> > > the ideal interface would be something like :
> > >  choose a concat of date + company from a popup at the top..
> > >  or, heck, just the pkey for now
> > > get a collection of 250 formatted rows in a scrolling window below,
> > > per popup choice
> > > The rows are filled in by 3 joins from a central table to 3 fk_tables
> > > The popup choice fills in company info in the header..
>
> > I suggest posting the table details so that anyone willing to help can
> > reply with web2py specific code samples.
>
> > >  thanks in advance for leads on this..
> > >   -Brian
>
>


[web2py] Re: bug with type

2011-02-27 Thread villas
On Feb 26, 7:56 pm, LightOfMooN  wrote:
> Yes, it's so. I should be more careful with variable names :)

Yes indeed.  Please use the 'reserved key words' feature when
initially making your models.

All you have to do is temporarily add check_reserved=['all'] to your
connect string.  This small precaution will highlight almost every
problem immediately and can save you a lot of grief later.




[web2py] Re: plugin_wiki printing code

2011-02-27 Thread villas
Massimo

If you are working on plugin-wiki would you please give some thought
about the URL being hard-coded for the 'default' controller (in the
page function). It would be nice if we could have a setting for this.
I remember trying to route the urls once and that was one of the
obstacles.

Also don't forget the field names!  :)

Thanks! D

On Feb 27, 2:27 am, Massimo Di Pierro 
wrote:
> hmmm... could be a bug. I will check this asap. I was planning to post
> a revised plugin_wiki tomoromow anyway.
>
> On Feb 26, 1:10 pm, "Sebastian E. Ovide" 
> wrote:
>
> > Hi All,
>
> > I'm testing the widget of the plugin_wiki in a view.
>
> > I added
> > {{=plugin_wiki.widget('map',key='yrtable',table='auth_user',width=400,
> > height=200)}} after installing the plugin but instead of getting a map I'm
> > getting the JS code printed in the page !
>
> > If I see the page generated code, I can see:
>
> > 
> > > etc... > > > any ideas ? > > > thanks > > -- > > Sebastian E. Ovide > >

[web2py] Re: what's the average learning curve?

2011-02-27 Thread villas
On Feb 27, 1:56 am, Sean  wrote:
> "how sophisticated will the client-side be?"
>
> Are you talking about the JS, templates, css stuff?

Yes, I was thinking that a good price comparison site might use a lot
of ajax etc.  Having seen a couple of other sites, a good design may
take a lot of effort and be crucial to success. I think you would have
to allow quite a bit of time for testing to make sure your users are
getting the results they want presented in a clear way.

It is an interesting project. How do you intend to get the prices?
For example, will you get the prices from the suppliers' DBs via some
API and then cache them into your own datastore?  I think GAE might be
a great choice for this kind of thing and that makes web2py the
natural choice for your framework!

Regards, D



[web2py] widzard + janrain problem

2011-02-27 Thread Sebastian E. Ovide
Hi All,

I've just created a new account in google, facebook and janrain. Then I've
created a new application using the widzard and as login system I've
selected janrain. As configuration I've used "localhost:mykeyfromjanrain".
Now when I click "login" I can see the janrain login, I select google and I
login using my new google account (within web2py). From here I get a
"welcome back XX, signin" (if I click signin, it is an infinite loop) etc...
but in web2py I can still see the "login" and "forgot your username" links
(top right) where I would expect a "logout" link...

is there any problem using "localhost" with Janrain?

any ideas ?

Thanks
-- 
Sebastian E. Ovide


[web2py] Using multiprocessing in web2py

2011-02-27 Thread David Mitchell
Hello everyone,

I've read through the message archive and there seems to be a fairly clear
message: don't using the multiprocessing module within web2py.

However, I'm hoping I might have a use case that's a bit different...

I've got an app that basically does analytics on moderately large datasets.
 I've got a number of controller methods that look like the following:

def my_method():
# Note: all data of interest has previously been loaded into
'session.data'
results = []
d = local_import('analysis')
results += d.my_1st_analysis_method(session)
results += d.my_2nd_analysis_method(session, date=date)
results += d.my_3rd_analysis_method(session)
results += d.my_4th_analysis_method(session, date=date)
results += d.my_5th_analysis_method(session, date=date)
return dict(results=results)

The problem I have is that all of the methods in my 'analysis' module, when
run in sequence as per the above, simply take too long to execute and give
me a browser timeout.  I can mitigate this to some extent by extending the
timeout on my browser, but I need to be able to use an iPad's Safari browser
and it appears to be impossible to increase the browser timeout on the iPad.
 Even if it can be done, that approach seems pretty ugly and I'd rather not
have to do it.  What I really want to do is run all of these analysis
methods *simultaneously*, capturing the results of each analysis_method into
a single variable once they've finished.

All of the methods within the 'analysis' module are designed to run
concurrently - although they reference session variables, I've consciously
avoided updating any session variables within any of these methods.  While
all the data is stored in a database, it's loaded into a session variable
(session.data) before my_method is called; this data never gets changed as
part of the analysis.

Is it reasonable to replace the above code with something like this:

def my_method():
import multiprocessing
d = local_import('analysis')

tasks = [
('job': 'd.my_1st_analysis_method', 'params': ['session']),
('job': 'd.my_2nd_analysis_method', 'params': ['session',
'date=date']),
('job': 'd.my_3rd_analysis_method', 'params': ['session']),
('job': 'd.my_4th_analysis_method', 'params': ['session',
'date=date']),
('job': 'd.my_5th_analysis_method', 'params': ['session',
'date=date']),
]

task_queue = multiprocessing.Queue()
for t in tasks:
task_queue.put(t['job'])

result_queue = multiprocessing.Queue()

for t in tasks:
args = (arg for arg in t['params'])
worker = multiprocessing.Worker(work_queue, result_queue, args=args)
worker.start()

results = []
while len(results) < len(tasks):
result = result_queue.get()
results.append(result)

return dict(results=results)

Note: I haven't tried anything using the multiprocessing module before, so
if you've got any suggestions as to how to improve the above code, I'd
greatly appreciate it...

Is introducing multiprocessing as I've outlined above a reasonable way to
optimise code in this scenario, or is there something in web2py that makes
this a bad idea?  If it's a bad idea, do you have any suggestions what else
I could try?

Thanks in advance

David Mitchell


[web2py] Re: what's the average learning curve?

2011-02-27 Thread KMax
If no webdesing required from you , then web2py is what you need.
I was stunned, when I was able to create not just hello world web
application in one month.
I have basic programming skill from university, and this was my
acquaintance with python!

Some time ago I spent a year to making php web application, (i am not
much skilled) and most time was spent to make menus, forms, etc.
And just few lines of code for bussines.

With web2py things become contrary, most of code to app logic and few
lines of code to handle forms and etc.

The only doubt is about scalability for hugh amount of data to process
with low latency to lots of site visitors.
I belive this is matter of time, to create optimal configuration for
this.

My recomendation: just start with hello world and some screen cast to
learn.

On 27 фев, 03:46, Sean  wrote:
> for a basic shopping recommendation site, can a single newbie make a
> reasonably good one in 3 month (starting from scratch)?
>
> Any suggestion?


[web2py] Pass args to function with cron

2011-02-27 Thread Thadeus Burgess
Using the following syntax...

*/5 *   *   *   *root *default/do/arg1/arg2/arg3

It fails with "Invalid application name"

Is there a way to pass args to the functions when using the web2py cron?

--
Thadeus