Re: [web2py] Re: experimental in trunk... common_fields and precints

2011-06-26 Thread Jason (spot) Brower
I just found this thread.  This is an awesome feature I could see using a
lot in the future.
BR,
Jason

On Mon, Jun 27, 2011 at 12:09 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> correct
>
> On Jun 26, 4:05 pm, Chris S  wrote:
> > So does that mean tables defined before:
> >
> db._common_fields=[Field('request_precinct',default=request.env.http_host,w
> ritable=False,readable=False)]
> >
> > Don't get populated with the common field?
> > If so that's great, lets you define which tables get fields, or even
> > have several levels of "common fields".
> >
> > On Jun 26, 3:44 pm, villas  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > The tables defined with a request_tenant field have the multi-tenant
> > > feature.
> > > If you want a 'global' table,  then define it before you start using
> the
> > > request_tenant field.
>


[web2py] Re: LessCSS -- really interesting CSS "compiler"

2011-06-26 Thread Massimo Di Pierro
I agree. Moreover when we move stuff like this to the client our apps
get faster, when we move it to the server they get slower.

On Jun 26, 10:55 pm, Joe  Barnhart  wrote:
> I guess we could roll our own.  But I see it more like jQuery and
> other add-ins.  Life would be very difficult if we tried to duplicate
> _everything_ in Python!
>
> This looks easy to use, it's pretty small, and sort of... well...
> "elegant" for lack of a better word.  It is aesthetically pleasing as
> well as useful.
>
> I just thought others may like to know about it...
>
> -- Joe
>
> On Jun 27, 4:16 am, Jason Brower  wrote:
>
>
>
>
>
>
>
> > As nice and easy as it is (I love how easy the language is).  Couldn't
> > we just do this with python? That way we could just add our css file as
> > a dynamic file like the others.


[web2py] Re: LessCSS -- really interesting CSS "compiler"

2011-06-26 Thread Joe Barnhart
I guess we could roll our own.  But I see it more like jQuery and
other add-ins.  Life would be very difficult if we tried to duplicate
_everything_ in Python!

This looks easy to use, it's pretty small, and sort of... well...
"elegant" for lack of a better word.  It is aesthetically pleasing as
well as useful.

I just thought others may like to know about it...

-- Joe

On Jun 27, 4:16 am, Jason Brower  wrote:
> As nice and easy as it is (I love how easy the language is).  Couldn't
> we just do this with python? That way we could just add our css file as
> a dynamic file like the others.


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Pierre Thibault
2011/6/26 Sebastian E. Ovide 

> add info:
>
> from applications.soso.models import my_db_helper_here
>
> eclipse give this error:
>
> Unresolved import: my_db_helper_here
> Unused import: my_db_helper_here
>
>
Is the web2py folder in your path?

I guess you are missing a level. Try something like:

from applications.soso.models.some_module import my_db_helper_here

I'm sorry I forgot the "some_module" in my first example.


-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


[web2py] Re: web2py 1.97.1 is OUT

2011-06-26 Thread Massimo Di Pierro
I cannot reproduce this. I just tried this and it works:

def index():
load = LOAD(f='test.load',ajax=False,vars=dict(table='customer'))
return locals()

def test():
return 'hello world'

Would you send me a minimalist app so I can reproduce it. It is not a
good idea to call an action "list" because that is a python keyword,
but that should not causing your problem.



On Jun 26, 6:14 pm, apple  wrote:
> no difference. with ajax=True it works. with ajax=False it throws a
> restricted error.
>
> On Jun 26, 11:50 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > How about you specify the controller?
>
> > {{=LOAD('default','list.load', ajax=False,
> > vars=dict(table='customer'))}}
>
> > On Jun 26, 5:18 pm, apple  wrote:
>
> > > yes. works fine if I just type it in the url box.
>
> > > On Jun 26, 9:57 pm, Massimo Di Pierro 
> > > wrote:
>
> > > > Can you call the list.load action directly? Do you get a ticket?
>
> > > > On Jun 26, 3:01 pm, apple  wrote:
>
> > > > > {{=LOAD(f='list.load', ajax=True, vars=dict(table='customer'))}}
>
> > > > > Works fine but if I change to ajax=False then it gives a restricted
> > > > > error.
>
> > > > > On Jun 26, 7:29 pm, Massimo Di Pierro 
> > > > > wrote:
>
> > > > > > Not many changes but lots of small bug fixes that make things work
> > > > > > better.
> > > > > > generic fields are now disabled by default for old app and only
> > > > > > enabled on localhost for new apps.
> > > > > > This is a security improvement that was discussed extensively here,
> > > > > > was release in 1.96.x but was still not working as it should have.
>
> > > > > > Please upgrade and report any bug.
>
> > > > > > massimo


[web2py] Re: web2py 1.97.1 is OUT

2011-06-26 Thread apple
no difference. with ajax=True it works. with ajax=False it throws a
restricted error.

On Jun 26, 11:50 pm, Massimo Di Pierro 
wrote:
> How about you specify the controller?
>
> {{=LOAD('default','list.load', ajax=False,
> vars=dict(table='customer'))}}
>
> On Jun 26, 5:18 pm, apple  wrote:
>
>
>
>
>
>
>
> > yes. works fine if I just type it in the url box.
>
> > On Jun 26, 9:57 pm, Massimo Di Pierro 
> > wrote:
>
> > > Can you call the list.load action directly? Do you get a ticket?
>
> > > On Jun 26, 3:01 pm, apple  wrote:
>
> > > > {{=LOAD(f='list.load', ajax=True, vars=dict(table='customer'))}}
>
> > > > Works fine but if I change to ajax=False then it gives a restricted
> > > > error.
>
> > > > On Jun 26, 7:29 pm, Massimo Di Pierro 
> > > > wrote:
>
> > > > > Not many changes but lots of small bug fixes that make things work
> > > > > better.
> > > > > generic fields are now disabled by default for old app and only
> > > > > enabled on localhost for new apps.
> > > > > This is a security improvement that was discussed extensively here,
> > > > > was release in 1.96.x but was still not working as it should have.
>
> > > > > Please upgrade and report any bug.
>
> > > > > massimo


[web2py] Re: web2py 1.97.1 is OUT

2011-06-26 Thread Massimo Di Pierro
How about you specify the controller?

{{=LOAD('default','list.load', ajax=False,
vars=dict(table='customer'))}}


On Jun 26, 5:18 pm, apple  wrote:
> yes. works fine if I just type it in the url box.
>
> On Jun 26, 9:57 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Can you call the list.load action directly? Do you get a ticket?
>
> > On Jun 26, 3:01 pm, apple  wrote:
>
> > > {{=LOAD(f='list.load', ajax=True, vars=dict(table='customer'))}}
>
> > > Works fine but if I change to ajax=False then it gives a restricted
> > > error.
>
> > > On Jun 26, 7:29 pm, Massimo Di Pierro 
> > > wrote:
>
> > > > Not many changes but lots of small bug fixes that make things work
> > > > better.
> > > > generic fields are now disabled by default for old app and only
> > > > enabled on localhost for new apps.
> > > > This is a security improvement that was discussed extensively here,
> > > > was release in 1.96.x but was still not working as it should have.
>
> > > > Please upgrade and report any bug.
>
> > > > massimo


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Sebastian E. Ovide
add info:

from applications.soso.models import my_db_helper_here

eclipse give this error:

Unresolved import: my_db_helper_here
Unused import: my_db_helper_here

On Sun, Jun 26, 2011 at 11:43 PM, Sebastian E. Ovide <
sebastian.ov...@gmail.com> wrote:

> Thanks Pierr,
>
> I was trying to do that but it is not working... actually I have a bunch of
> imports insede that "if 0" trick that solve all the web2py dependencies
> errors...
>
> the only errors stil there are those due to functions in my model files (as
> for example the models of my plugins)
>
> I've tried also
>
> from applications.myapp.models import *
>
> and added a __init__.py inside the models folder
>
> any other ideas ?
>
>
>
> On Sun, Jun 26, 2011 at 8:39 PM, Pierre Thibault <
> pierre.thibau...@gmail.com> wrote:
>
>>
>> if 0:
>>   from applications.myapp.models import myfunc
>
>
>
>
> --
> Sebastian E. Ovide
>
>
>
>
>


-- 
Sebastian E. Ovide


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Sebastian E. Ovide
Thanks Pierr,

I was trying to do that but it is not working... actually I have a bunch of
imports insede that "if 0" trick that solve all the web2py dependencies
errors...

the only errors stil there are those due to functions in my model files (as
for example the models of my plugins)

I've tried also

from applications.myapp.models import *

and added a __init__.py inside the models folder

any other ideas ?


On Sun, Jun 26, 2011 at 8:39 PM, Pierre Thibault  wrote:

>
> if 0:
>   from applications.myapp.models import myfunc




-- 
Sebastian E. Ovide


[web2py] Re: web2py 1.97.1 is OUT

2011-06-26 Thread apple
yes. works fine if I just type it in the url box.

On Jun 26, 9:57 pm, Massimo Di Pierro 
wrote:
> Can you call the list.load action directly? Do you get a ticket?
>
> On Jun 26, 3:01 pm, apple  wrote:
>
>
>
>
>
>
>
> > {{=LOAD(f='list.load', ajax=True, vars=dict(table='customer'))}}
>
> > Works fine but if I change to ajax=False then it gives a restricted
> > error.
>
> > On Jun 26, 7:29 pm, Massimo Di Pierro 
> > wrote:
>
> > > Not many changes but lots of small bug fixes that make things work
> > > better.
> > > generic fields are now disabled by default for old app and only
> > > enabled on localhost for new apps.
> > > This is a security improvement that was discussed extensively here,
> > > was release in 1.96.x but was still not working as it should have.
>
> > > Please upgrade and report any bug.
>
> > > massimo


Re: [web2py] Re: Invalid Login after update to Trunk and Custom Auth Table:

2011-06-26 Thread David J
Still not working
I actually reset s password on a test account and it worked. So something
else must be causing this error
On Jun 26, 2011 5:33 PM, "villas"  wrote:
> Try changing the field name 'key' which is likely to cause issues because
it
> has been a reserved word.


[web2py] A mvc-mini-profiler for GAE

2011-06-26 Thread mikech
http://bjk5.com/post/6944602865/google-app-engine-mini-profiler


Re: [web2py] Re: Web2py plus standard LAMP server functionality?

2011-06-26 Thread villas
Windows:

C:\WINDOWS\system32\drivers\etc\hosts


Re: [web2py] Re: how strongly coupled are LOAD with web2py_ajax.html and web2py_ajax.js ?

2011-06-26 Thread Sebastian E. Ovide
great !

On Sun, Jun 26, 2011 at 10:01 PM, Anthony  wrote:

> In general, when you upgrade to a new web2py version, you shouldn't need to
> update your applications, though you may want to in order to take advantage
> of some new features (or bug/security fixes).




-- 
Sebastian E. Ovide


[web2py] Re: Invalid Login after update to Trunk and Custom Auth Table:

2011-06-26 Thread villas
Try changing the field name 'key' which is likely to cause issues because it 
has been a reserved word.  


[web2py] Re: experimental in trunk... common_fields and precints

2011-06-26 Thread Massimo Di Pierro
correct

On Jun 26, 4:05 pm, Chris S  wrote:
> So does that mean tables defined before:
> db._common_fields=[Field('request_precinct',default=request.env.http_host,w 
> ritable=False,readable=False)]
>
> Don't get populated with the common field?
> If so that's great, lets you define which tables get fields, or even
> have several levels of "common fields".
>
> On Jun 26, 3:44 pm, villas  wrote:
>
>
>
>
>
>
>
> > The tables defined with a request_tenant field have the multi-tenant
> > feature.
> > If you want a 'global' table,  then define it before you start using the
> > request_tenant field.


[web2py] Re: experimental in trunk... common_fields and precints

2011-06-26 Thread Chris S
So does that mean tables defined before:
db._common_fields=[Field('request_precinct',default=request.env.http_host,writable=False,readable=False)]

Don't get populated with the common field?
If so that's great, lets you define which tables get fields, or even
have several levels of "common fields".

On Jun 26, 3:44 pm, villas  wrote:
> The tables defined with a request_tenant field have the multi-tenant
> feature.
> If you want a 'global' table,  then define it before you start using the
> request_tenant field.


[web2py] Re: how strongly coupled are LOAD with web2py_ajax.html and web2py_ajax.js ?

2011-06-26 Thread Anthony
The new version of web2py_ajax.html/web2py_ajax.js should work the same as 
the old web2py_ajax.html, so you shouldn't need to update if you don't want 
to. Most of the original file was separated into a .js file in static (a) 
so the content can be cached by browsers instead of being sent on every 
request and (b) to make the JS more portable and easier to use outside the 
context of web2py_ajax.html (i.e., without requiring web2py template 
processing to generate).
 
In general, when you upgrade to a new web2py version, you shouldn't need to 
update your applications, though you may want to in order to take advantage 
of some new features (or bug/security fixes).
 
Anthony

On Sunday, June 26, 2011 4:36:37 PM UTC-4, sebastian wrote:

> Hi All,
>
> just wondering how strongly coupled are the web2py LOAD with the ajax 
> componetnts present in the applications... (web2py_ajax.html and 
> web2py_ajax.js for example)
>
> I mean, would an old application that works fine with an old web2py, still 
> work on a newer web2py version which has changed also LOAD,  
> web2py_ajax.html and web2py_ajax.js ?
>
> Just wondering how difficult would  maintaining one (many) application(s) 
> be as everytime that I've update I need to update web2py and update all the 
> applications static files related to web2py...
>
> Thanks
> -- 
> Sebastian E. Ovide
>
>
>
>
>

[web2py] Re: how strongly coupled are LOAD with web2py_ajax.html and web2py_ajax.js ?

2011-06-26 Thread Massimo Di Pierro
There should be no coupling at all. Anyway all changes to LOAD and or
web2py_ajax (and I mean intentional changes, not bugs) are implemented
with backward compatibility in mind.

On Jun 26, 3:36 pm, "Sebastian E. Ovide" 
wrote:
> Hi All,
>
> just wondering how strongly coupled are the web2py LOAD with the ajax
> componetnts present in the applications... (web2py_ajax.html and
> web2py_ajax.js for example)
>
> I mean, would an old application that works fine with an old web2py, still
> work on a newer web2py version which has changed also LOAD,
> web2py_ajax.html and web2py_ajax.js ?
>
> Just wondering how difficult would  maintaining one (many) application(s) be
> as everytime that I've update I need to update web2py and update all the
> applications static files related to web2py...
>
> Thanks
> --
> Sebastian E. Ovide


[web2py] Re: web2py 1.97.1 is OUT

2011-06-26 Thread Massimo Di Pierro
Can you call the list.load action directly? Do you get a ticket?

On Jun 26, 3:01 pm, apple  wrote:
> {{=LOAD(f='list.load', ajax=True, vars=dict(table='customer'))}}
>
> Works fine but if I change to ajax=False then it gives a restricted
> error.
>
> On Jun 26, 7:29 pm, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Not many changes but lots of small bug fixes that make things work
> > better.
> > generic fields are now disabled by default for old app and only
> > enabled on localhost for new apps.
> > This is a security improvement that was discussed extensively here,
> > was release in 1.96.x but was still not working as it should have.
>
> > Please upgrade and report any bug.
>
> > massimo


[web2py] Re: experimental in trunk... common_fields and precints

2011-06-26 Thread villas
The tables defined with a request_tenant field have the multi-tenant 
feature.
If you want a 'global' table,  then define it before you start using the 
request_tenant field.

[web2py] how strongly coupled are LOAD with web2py_ajax.html and web2py_ajax.js ?

2011-06-26 Thread Sebastian E. Ovide
Hi All,

just wondering how strongly coupled are the web2py LOAD with the ajax
componetnts present in the applications... (web2py_ajax.html and
web2py_ajax.js for example)

I mean, would an old application that works fine with an old web2py, still
work on a newer web2py version which has changed also LOAD,
web2py_ajax.html and web2py_ajax.js ?

Just wondering how difficult would  maintaining one (many) application(s) be
as everytime that I've update I need to update web2py and update all the
applications static files related to web2py...

Thanks
-- 
Sebastian E. Ovide


Re: [web2py] Bounties

2011-06-26 Thread Jason Brower

In email
On 06/24/2011 02:00 PM, villas wrote:
I notice that group member Dwayne was offering a 'bounty' to the 
project for information etc.  I really like this idea and I wonder 
what others thought.


It provides an incentive to provide more functionality and gives 
people an excuse to donate towards this wonderful framework and 
encourage Massimo


Could the concept be broadened and the bounty split;  one half going 
to the person that provides the best answer, and the other to the project?
Splitting it good.  But I think 20% to the project is better.  We have 
to make it worth the bounty hunters money.
Should there be a standard bounty amount to stop people outbidding 
each other?
I think there should be varying bounty amount.  Free markets free 
software. :)


Should there be a 'Bounty App' to list the bounties on offer or maybe 
we can include bounties in Web2pySlices slice requests?
I think bounties are a nice way to get things done, but sadly, many 
don't work.  We tend to think very big on the project and think the 
hunter will just fill in the gaps.  If we have an application to do 
this, I think it should be motorated by people that know how to manage 
in an agile development way.  that way the project can be declared done 
and the bounty can be closed by a modorater.  But then, at this point 
20% to the project 20% to the mod and 60% to the Hunter. I am willing to 
mod if we did something like this. :)

BR,
Jason



There is of course nothing to stop people doing their own thing.  But 
it would be nice to know that such an initiative is considered by the 
group generally as being a 'good thing' and welcomed by Massimo.  I do 
not wish to undermine the concept of open-source,  but economic 
incentives are powerful tools and I think we could embrace this 
concept to encourage development especially in design areas like 
layouts, jQueryUI widgets and such.


Thanks for reading...
-David





Re: [web2py] LessCSS -- really interesting CSS "compiler"

2011-06-26 Thread Jason Brower
As nice and easy as it is (I love how easy the language is).  Couldn't 
we just do this with python? That way we could just add our css file as 
a dynamic file like the others. I am personally planning to use the 
python code in my css generation as I need to do a bit of math and want 
variables and functions. Makes for very clean css if you build the css 
for each page. (But much harder work for us programmers.)

BR,
Jason

On 06/25/2011 02:50 PM, Joe Barnhart wrote:

http://lescss.org/

The crux of this js library is to preprocess your CSS files so you can
use a few carefully-chosen extensions to make your CSS files smaller
and more powerful (kind of like web2py).

For example, VARIABLES.  How many times have you wished you could just
assign a name to a color and then use it over and over and over inside
your CSS file?  Another example, NESTING.  You can actually use a
class, id, or element definition within another and its definition
nests.  And you can even pass parameters to tailor the nested CSS.

For something as simple in concept, it's a little overwhelming at how
it can transform a complicated CSS file.  I'm still wrapping my head
around it.

-- Joe B.




Re: [web2py] Re: Remote Interfacing with Web2Py

2011-06-26 Thread Jason Brower
Massimo is right and I support him.  No exec unless ABSOLUTELY needed, 
and I mean it. :P

Running the web2py as a service does a good job.
From what you say, you could do as massimo says and create a service to 
handle that special communication.

Basically, I am just seconding Massimo cause he is awesome.
---
Jason


On 06/26/2011 08:32 PM, Massimo Di Pierro wrote:

Please do not use exec_environment. Can you tell us more what kind of
interface you need? What is the purpose?

There are various way to interface and which one you use depend on the
purpose:

1)
web2py.py -S app -M -N -R yourcode.py

2)
 From your code
db = DAL(...,path='/path/to/db',auto_import=True)

3)
expose a service, access the service (XML-RPC)

4)
queue tasks in db, access db and process tasks


On Jun 26, 12:08 pm, Arnon Marcus  wrote:

Hi everybody,

I'm searching for a way to interface into a web2py application, that
does not use any of the built-in function-decorators.
I want to write a service that would run locally, and interact with
the web2py server, located on our company server, and serve as a
common bridge for multiple local applications running on a user's
machine.
On the back-end sides of the service I got things covered.
On it's front-side, the side that would talk to the web2py
application, I was hoping to use something more flexible and open then
xml-rpc or any of the rpc's...
I was thinking on the lines of running an RPyC server along-side the
web2py server, that would serve as a hub into the running process of
the web2py application.
I was also looking at Pyro, but the opinions about it where not great,
compared to RPyC.
I tried using the shell.py functionality, with no success.
I couldn't even interface with the welcome application on a fresh code
of web2py, via the web2py shell... It seems that something is broken
there...
I'm running from a command line, on the web2py folder:
   "python web2py.py -S welcome -M -N"
The console/shell appears (the ">>>" stuff...)
Then I do:
   "from gluon.shell import exec_environment"
Then I tried:
   "cas = exec_environment('applications/welcome/models/db.py')"
and
   "other = exec_environment('applications/welcome/controllers/
other.py')"
And they both throw me errors...

And also, even if it did work, even though it should, theoretically,
allow me to remotely use the DAL, it would be even more inefficient
then using xml-rpc, as every user would have to remotely invoke an
additional separate partial-web2py server process (if I understand the
mechanism correctly...).

Is there any efficient way to do what I need?




[web2py] Re: web2py 1.97.1 is OUT

2011-06-26 Thread apple
{{=LOAD(f='list.load', ajax=True, vars=dict(table='customer'))}}

Works fine but if I change to ajax=False then it gives a restricted
error.

On Jun 26, 7:29 pm, Massimo Di Pierro 
wrote:
> Not many changes but lots of small bug fixes that make things work
> better.
> generic fields are now disabled by default for old app and only
> enabled on localhost for new apps.
> This is a security improvement that was discussed extensively here,
> was release in 1.96.x but was still not working as it should have.
>
> Please upgrade and report any bug.
>
> massimo


[web2py] Re: Invalid Login after update to Trunk and Custom Auth Table:

2011-06-26 Thread David J.
I noticed the password in the last user I added is in plain text and no 
longer encrypted/hashed?



On 6/26/11 3:50 PM, David J. wrote:

I just updated to trunk;

I also modified the auth table and added an extra few fields,

I added

Field('key','string')
as well I added
auth.signature

Each time I try to login now Login fails with invalid login.

Is there something I have to do enable this?

Thanks.

David





[web2py] Re: Invalid Login after update to Trunk and Custom Auth Table:

2011-06-26 Thread David J.

By the way I forgot to mention this is only for existing users;

Not new ones; I created a new user and I can login with that account.



On 6/26/11 3:50 PM, David J. wrote:

I just updated to trunk;

I also modified the auth table and added an extra few fields,

I added

Field('key','string')
as well I added
auth.signature

Each time I try to login now Login fails with invalid login.

Is there something I have to do enable this?

Thanks.

David





[web2py] Invalid Login after update to Trunk and Custom Auth Table:

2011-06-26 Thread David J.

I just updated to trunk;

I also modified the auth table and added an extra few fields,

I added

Field('key','string')
as well I added
auth.signature

Each time I try to login now Login fails with invalid login.

Is there something I have to do enable this?

Thanks.

David



Re: [web2py] Re: Cannot operate on a closed database

2011-06-26 Thread Manuele Pesenti

On 26/06/2011 20:03, Massimo Di Pierro wrote:

Hope this makes sense.


thanks a lot
I got it now :)

Manuele


Re: [web2py] Re: web2py with Eclipse

2011-06-26 Thread Pierre Thibault
2011/6/26 sebastian 

> what about the functions defined in the models ? (global functions)
>


Pydev won't see them because they are imported implicitly by web2py. You can
use the if 0: trick so the static code analyzer will not complain:

if 0:
  from applications.myapp.models import myfunc

In the preferences of Pydev you can make "if" fold-able to be able to fold
the noisy code: Window > Preferences > Pydev > Editor > Folding

There is not much you can do because this is not a standard way to do things
in Python. Breaking from the standard has his part of ugly.
-- 


A+

-
Pierre
My blog and profile
(http://pierrethibault.posterous.com)
YouTube page 
(http://www.youtube.com/user/tubetib)
Twitter (http://twitter.com/pierreth2) 


[web2py] Re: how to use contrib/login_methods/linkedin_account.py

2011-06-26 Thread Luis Goncalves
One more clue:

In the infinite loop,  every loop through the linkedin "grant access" 
(/oas/oauth/authorize) page  has a new oauth_token, such as

https://www.linkedin.com/uas/oauth/authorize?oauth_token=f9eef16e-4f45-4f5e-aa5f-82ab18ad3a16

L.


[web2py] Re: how to download an audio file

2011-06-26 Thread Anthony
On Sunday, June 26, 2011 1:10:48 AM UTC-4, weheh wrote: 
>
> p.s. Massimo - is this anywhere in the doc? If not, I can put it in 
> there for the community. Which chapter should it be in? I would never 
> have figured this out without your response!!!

 
For static file requests, it looks like wsgibase() checks for "attachment" 
at the beginning of the URL query string and then sets the 
"Content-Disposition" HTTP header to "attachment". I went ahead and added 
some documentation about this to the "Dispatching" section of ch. 4, where 
static files are discussed (
http://web2py.com/book/default/chapter/04#Dispatching).
 
Note, you can also set HTTP headers directly via response.headers (e.g., 
response.headers['Content-Disposition']='attachment').
 
Also, if you use the response.download() method to download files that have 
been uploaded (as the download() controller function does), it takes a 
boolean "attachment" argument, which defaults to True.
 
Anthony


[web2py] Re: how to use contrib/login_methods/linkedin_account.py

2011-06-26 Thread Luis Goncalves
An update (getting closer, but still problems):

It seems there are a couple more errors in linkedin_account.py:

There is an extraneous command which must have been left over from sample 
code:

profile = self.api.GetProfile(profile).public_url = 
"http://www.linkedin.com/in/ozgurv";

This line  overwrites the reading of the current user's profile, and should 
be removed.

Also, the call 

return 
self.api.getAuthorizeURL(self.token)



should be

return 
self.api.getAuthorizeURL()  
  


according to the python-linkedin module README instructions.

With those fixes, I now no longer get the error "We were unable to find the 
authorization token".

However, now I am stuck in an infinite loop:
I am always stuck on the linkedin "Grant access"  page, and pressing the 
"continue" button keeps returning to the same page.

I realize that given the existing bugs in the code, it is unlikely that 
anyone has actually used it,  but does anyone have a clue as to why after 
granting access on linkedin I am not logged in and back to the app?   It 
seems web2py does not respond properly to the access grant.   

If anyone can help, it will be greatly appreciated!!!  Trying to debug 
Auth() is going to be quite slow and painful to a web2py newbie like me!!!

Thanks!!!

Luis.


[web2py] web2py 1.97.1 is OUT

2011-06-26 Thread Massimo Di Pierro
Not many changes but lots of small bug fixes that make things work
better.
generic fields are now disabled by default for old app and only
enabled on localhost for new apps.
This is a security improvement that was discussed extensively here,
was release in 1.96.x but was still not working as it should have.

Please upgrade and report any bug.

massimo


[web2py] Re: URGENT: Clarification on Auth

2011-06-26 Thread Pystar
Still awaiting my response
thanks guys

On Jun 26, 8:36 am, Pystar  wrote:
> I am using Facebook's "Registration plugin" which allows users to
> either register or login into a 3rd party site using their facebook
> account. I would like to know if its possible to get the signed data
> from facebook and do a manual insert into the "user" table and still
> have auth working? or in other words can I get my user data from
> anywhere apart from the auth form, do a manual insert and have auth
> work sitewide across my app?
> Thanks for your prompt response.


[web2py] Re: Cannot operate on a closed database

2011-06-26 Thread Massimo Di Pierro
I found the cause it this problem. It is not a bug in web2py but
something to be careful about in your programs.

You have a models/meteo.py which imports modules/meteo.py.

models/meteo.py does

   current.database = db

and modules/mete.py does

   db = current.database

the problem is that the latter statement is done at top leve therefor
it is only executed once when the module is imported by the first http
request. The module is then cached in ram and that line is no longer
executed. Therefore db is not the current thread local database
object but it is a reference to the db object of the first http
request which by now may be closed. You cannot extract objects from
the thread local "current" when you import the module, you have to do
it inside functions called when a controller is executed.

Hope this makes sense.



On Jun 24, 10:31 am, Manuele Pesenti 
wrote:
> dear all,
> I've added a unique field to some existing tables and w2p gave me an
> error saing that he cannot add unique fields to a table so I deleted my
> db and restarted as a new application but I obtained this:
>
> ProgrammingError: Cannot operate on a closed database.
>
> it's sufficient to comment out the property unique=True and no errors
> occurs.
>
> Here under you can find the complete traceback.
> Any suggestion??
>
> Thanks a lot
>
>         Manuele
>
> Traceback (most recent call last):
>    File
> "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/restricted.py", line
> 192, in restricted
>      exec ccode in environment
>    File
> "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/applications/wind2pow2/contro 
> llers/appadmin.py",
> line 410, in 
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/globals.py",
> line 137, in 
>      self._caller = lambda f: f()
>    File
> "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/applications/wind2pow2/contro 
> llers/appadmin.py",
> line 126, in insert
>      form = SQLFORM(db[table], ignore_rw=ignore_rw)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/sqlhtml.py",
> line 817, in __init__
>      inp = self.widgets.options.widget(field, default)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/sqlhtml.py",
> line 206, in widget
>      options = requires[0].options()
>    File
> "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/validators.py", line
> 438, in options
>      self.build_set()
>    File
> "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/validators.py", line
> 426, in build_set
>      records = self.dbset.select(*fields, **dd)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.py",
> line 5382, in select
>      return self.db._adapter.select(self.query,fields,attributes)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.py",
> line 1159, in select
>      rows = response(sql)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.py",
> line 1149, in response
>      self.execute(sql)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.py",
> line 1234, in execute
>      return self.log_execute(*a, **b)
>    File "/home/manuele/Dropbox/sviluppo/web2py-1.96.4/gluon/dal.py",
> line 1229, in log_execute
>      ret = self.cursor.execute(*a,**b)
> ProgrammingError: Cannot operate on a closed database.


[web2py] Re: Remote Interfacing with Web2Py

2011-06-26 Thread Massimo Di Pierro
Please do not use exec_environment. Can you tell us more what kind of
interface you need? What is the purpose?

There are various way to interface and which one you use depend on the
purpose:

1)
web2py.py -S app -M -N -R yourcode.py

2)
>From your code
db = DAL(...,path='/path/to/db',auto_import=True)

3)
expose a service, access the service (XML-RPC)

4)
queue tasks in db, access db and process tasks


On Jun 26, 12:08 pm, Arnon Marcus  wrote:
> Hi everybody,
>
> I'm searching for a way to interface into a web2py application, that
> does not use any of the built-in function-decorators.
> I want to write a service that would run locally, and interact with
> the web2py server, located on our company server, and serve as a
> common bridge for multiple local applications running on a user's
> machine.
> On the back-end sides of the service I got things covered.
> On it's front-side, the side that would talk to the web2py
> application, I was hoping to use something more flexible and open then
> xml-rpc or any of the rpc's...
> I was thinking on the lines of running an RPyC server along-side the
> web2py server, that would serve as a hub into the running process of
> the web2py application.
> I was also looking at Pyro, but the opinions about it where not great,
> compared to RPyC.
> I tried using the shell.py functionality, with no success.
> I couldn't even interface with the welcome application on a fresh code
> of web2py, via the web2py shell... It seems that something is broken
> there...
> I'm running from a command line, on the web2py folder:
>   "python web2py.py -S welcome -M -N"
> The console/shell appears (the ">>>" stuff...)
> Then I do:
>   "from gluon.shell import exec_environment"
> Then I tried:
>   "cas = exec_environment('applications/welcome/models/db.py')"
> and
>   "other = exec_environment('applications/welcome/controllers/
> other.py')"
> And they both throw me errors...
>
> And also, even if it did work, even though it should, theoretically,
> allow me to remotely use the DAL, it would be even more inefficient
> then using xml-rpc, as every user would have to remotely invoke an
> additional separate partial-web2py server process (if I understand the
> mechanism correctly...).
>
> Is there any efficient way to do what I need?


[web2py] Remote Interfacing with Web2Py

2011-06-26 Thread Arnon Marcus
Hi everybody,

I'm searching for a way to interface into a web2py application, that
does not use any of the built-in function-decorators.
I want to write a service that would run locally, and interact with
the web2py server, located on our company server, and serve as a
common bridge for multiple local applications running on a user's
machine.
On the back-end sides of the service I got things covered.
On it's front-side, the side that would talk to the web2py
application, I was hoping to use something more flexible and open then
xml-rpc or any of the rpc's...
I was thinking on the lines of running an RPyC server along-side the
web2py server, that would serve as a hub into the running process of
the web2py application.
I was also looking at Pyro, but the opinions about it where not great,
compared to RPyC.
I tried using the shell.py functionality, with no success.
I couldn't even interface with the welcome application on a fresh code
of web2py, via the web2py shell... It seems that something is broken
there...
I'm running from a command line, on the web2py folder:
  "python web2py.py -S welcome -M -N"
The console/shell appears (the ">>>" stuff...)
Then I do:
  "from gluon.shell import exec_environment"
Then I tried:
  "cas = exec_environment('applications/welcome/models/db.py')"
and
  "other = exec_environment('applications/welcome/controllers/
other.py')"
And they both throw me errors...

And also, even if it did work, even though it should, theoretically,
allow me to remotely use the DAL, it would be even more inefficient
then using xml-rpc, as every user would have to remotely invoke an
additional separate partial-web2py server process (if I understand the
mechanism correctly...).

Is there any efficient way to do what I need?


[web2py] Re: Populate a simple form (without a database)

2011-06-26 Thread Martin Weissenboeck
Thank you very much!
Martin

2011/6/25 Anthony 

> First, I think you want FORM(INPUT(_name='n')), otherwise you'll have an
> empty form.
>
> If you want to pre-populate a form using form.vars.fieldname=somevalue, you
> have to do that after the form is created, but *before* you call
> form.accepts (the form.accepts method adds the form.vars value to the INPUT
> element). See
> http://web2py.com/book/default/chapter/07#Pre-populating-the-form.
>
> If you only want to pre-populate the field after a failed form submission
> (but not when the form is initially loaded), then you could use an
> alternative method:
>
> form.element(_name='n').update(_value='MY DYNAMIC VALUE')
>
> That updates the html INPUT element directly instead of relying on
> form.accepts to add the form.vars value to the element.
>
> Anthony
>
> On Saturday, June 25, 2011 2:15:57 AM UTC-4, mweissen wrote:
>
>> Hi,
>>
>> let's say I have a simple form like the following:
>>
>> def one():
>>
>> form = FORM(_name='n')
>>
>>  if form.accepts(request.vars, session):
>>
>>  # do something
>> redirect(URL('two'))
>>
>> else:
>>
>>  *# what I want to do is something like*
>>
>>  *form.vars.n = 'MY DYNAMIC VALUE'*
>>
>>
>> return dict(form=form)
>>
>>
>>  Regards, Martin
>>
>>


Re: [web2py] vhosts - apache - multiple domains - virtual hosts

2011-06-26 Thread Kenneth Lundström

Hello,

I think the best way is to let Apache take care of sort out web2py 
domains and non web2py domains. If you want to have a PHP site on one 
vhost and the rest are web2py then you need two vhost files. All web2py 
domains are pointed towards webpy.


Web2py with routes.py takes care of which domain belongs to which app.
This is my routes.py

routers = dict(
BASE = dict(
#abc = None,
domains = {
'economy.example.com' : 'economy',
'www.test.com' : 'test',
'test.com' : 'test'
}
),
)


Kenneth


Hi,

I have one server and one IP address. I use Ubuntu 10.04 with Apache
and Web2py.
I have the default installation working.

I have the following domain names:

castle.example.com
www.demonstration.com

So here is my problem... I want to use Apache and Virtual Hosts for
multiple domains. I want to map the "myapp2" to www.demonstration.com.
It does work but it seems the user controller gets an error [invalid
controller (user/index) ]

Here are my vhosts:



#  castle.example.com




   ServerName castle.example.com
   WSGIDaemonProcess web2py user=www-data group=www-data
   WSGIProcessGroup web2py
   WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py

   
 AllowOverride None
 Order Allow,Deny
 Deny from all
 
   Allow from all
 
   

   AliasMatch ^/([^/]+)/static/(.*) \
/home/www-data/web2py/applications/$1/static/$2
   
 Options -Indexes
 Order Allow,Deny
 Allow from all
   

   
   Deny from all
   

   
   Deny from all
   

   CustomLog /var/log/apache2/access.log common
   ErrorLog /var/log/apache2/error.log



   ServerName rhegium.elitism.net
   SSLEngine on
   SSLCertificateFile /etc/apache2/ssl/self_signed.cert
   SSLCertificateKeyFile /etc/apache2/ssl/self_signed.key

   WSGIProcessGroup web2py

   WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py

   
 AllowOverride None
 Order Allow,Deny
 Deny from all
 
   Allow from all
 
   

   AliasMatch ^/([^/]+)/static/(.*) \
 /home/www-data/web2py/applications/$1/static/$2

   
 Options -Indexes
 ExpiresActive On
 ExpiresDefault "access plus 1 hour"
 Order Allow,Deny
 Allow from all
   

   CustomLog /var/log/apache2/access.log common
   ErrorLog /var/log/apache2/error.log







#  www.demonstration.com




   ServerName demonstration.com
   ServerAlias www.demonstration.com
   WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py/myapp2

   
 AllowOverride None
 Order Allow,Deny
 Deny from all
 
   Allow from all
 
   

   AliasMatch ^/([^/]+)/static/(.*) \
/home/www-data/web2py/applications/$1/static/$2
   
 Options -Indexes
 Order Allow,Deny
 Allow from all
   

   
   Deny from all
   

   
   Deny from all
   

   CustomLog /var/log/apache2/www_demonstration_com-access.log common
   ErrorLog /var/log/apache2/www_demonstration_com-error.log










Going to castle.example.com works perfectly.

Going to www.demonstration.com works and the default index controller
shows
"1. You visited the url /myapp2/"

Whenever I click on a controller/view that requires auth_login I get
an invalid request error.
It takes me directly to the following:
http://www.demonstration.com/myapp2/default/user/login

If I fanangle with the url, the following works:
http://www.demonstration.com/default/user/login

Do I need to do something with my vhost file? Maybe something with
routes?
Is there an auth.settings I need to change?

my request.env.http_host did come up with "www.demonstration.com"
I think I need to override an Auth setting but I don't know if I am on
the right track.

Any help would be greatly appreciated...




[web2py] Re: web2py with Eclipse

2011-06-26 Thread sebastian
what about the functions defined in the models ? (global functions)


[web2py] vhosts - apache - multiple domains - virtual hosts

2011-06-26 Thread Olympus Runner
Hi,

I have one server and one IP address. I use Ubuntu 10.04 with Apache
and Web2py.
I have the default installation working.

I have the following domain names:

castle.example.com
www.demonstration.com

So here is my problem... I want to use Apache and Virtual Hosts for
multiple domains. I want to map the "myapp2" to www.demonstration.com.
It does work but it seems the user controller gets an error [invalid
controller (user/index) ]

Here are my vhosts:



#  castle.example.com




  ServerName castle.example.com
  WSGIDaemonProcess web2py user=www-data group=www-data
  WSGIProcessGroup web2py
  WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) \
   /home/www-data/web2py/applications/$1/static/$2
  
Options -Indexes
Order Allow,Deny
Allow from all
  

  
  Deny from all
  

  
  Deny from all
  

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log



  ServerName rhegium.elitism.net
  SSLEngine on
  SSLCertificateFile /etc/apache2/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/apache2/ssl/self_signed.key

  WSGIProcessGroup web2py

  WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) \
/home/www-data/web2py/applications/$1/static/$2

  
Options -Indexes
ExpiresActive On
ExpiresDefault "access plus 1 hour"
Order Allow,Deny
Allow from all
  

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log







#  www.demonstration.com




  ServerName demonstration.com
  ServerAlias www.demonstration.com
  WSGIScriptAlias / /home/www-data/web2py/wsgihandler.py/myapp2

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) \
   /home/www-data/web2py/applications/$1/static/$2
  
Options -Indexes
Order Allow,Deny
Allow from all
  

  
  Deny from all
  

  
  Deny from all
  

  CustomLog /var/log/apache2/www_demonstration_com-access.log common
  ErrorLog /var/log/apache2/www_demonstration_com-error.log










Going to castle.example.com works perfectly.

Going to www.demonstration.com works and the default index controller
shows
"1. You visited the url /myapp2/ "

Whenever I click on a controller/view that requires auth_login I get
an invalid request error.
It takes me directly to the following:
http://www.demonstration.com/myapp2/default/user/login

If I fanangle with the url, the following works:
http://www.demonstration.com/default/user/login

Do I need to do something with my vhost file? Maybe something with
routes?
Is there an auth.settings I need to change?

my request.env.http_host did come up with "www.demonstration.com"
I think I need to override an Auth setting but I don't know if I am on
the right track.

Any help would be greatly appreciated...


[web2py] Re: I created a little app to be able to share some files over the net without authentication

2011-06-26 Thread szimszon
Code updated to support python2.5 in generating the md5 checksum. Thanks 
Peter.


[web2py] URGENT: Clarification on Auth

2011-06-26 Thread Pystar
I am using Facebook's "Registration plugin" which allows users to
either register or login into a 3rd party site using their facebook
account. I would like to know if its possible to get the signed data
from facebook and do a manual insert into the "user" table and still
have auth working? or in other words can I get my user data from
anywhere apart from the auth form, do a manual insert and have auth
work sitewide across my app?
Thanks for your prompt response.