[web2py] Getting Started...

2010-12-25 Thread David J
I recently started looking into web2py vs Django which I have been
using for the past few years.

I like this framework it seems very clean and simple; However, I am
little confused about getting started using a remote server;

It seems to tighten security web2py does not enable remote admin
functions so the only way to access the server is via localhost or by
setting up a proxy with ssl to the remote server.

This is a great security feature; however; makes it a bit difficult to
get started.

I was wondering if there is some advice on how I can deal with remote
development without dealing with these complexities.

2. Also is there some good documentation on getting started? It also
seems like so much is already done however; You lose some of the core
concepts. Its only been a few hours of learning; So I probably should
spend more time trying to learn this before asking for help.

Thanks in advance for any help.



Re: [web2py] Getting Started...

2010-12-25 Thread David J.

Thanks.

so if I start on my local machine;

Do I just start in my web2py root directory?

Do I have to use the web interface to create apps or can I just run some 
sort of "bootstrap" script that loads all the same stuff into a new 
project directory?


I see the "welcome" app is zipped or something into a w2p extensions; so 
I am not sure exactly where to start.


I dont want to use the browser; I prefer to use text editors; the 
browser is a frustrating distraction.



Thanks Again.

David.



On 12/25/10 11:18 PM, pbreit wrote:

In the beginning, I'd suggest just using programming on your local machine with the 
bundled web server and sqlite. When you're ready to deploy to a remote server setting up 
ssl isn't too bad. Or forwarding localhost with "ssh -L 8000:localhost:8000 
r...@server.ip.address".

For initial learning, the wb2py book is the best starting point.





Re: [web2py] Getting Started...

2010-12-25 Thread David J.

On a mac;

I was wondering if Could just create a folder in the web2py root and 
start from there?



On 12/25/10 11:47 PM, pbreit wrote:

On Mac or windows, just double-click the app. Maybe on *nix as well. Best to 
create the project in admin but after that you can do *all* of your editing in 
text editor.





Re: [web2py] Getting Started...

2010-12-25 Thread David J.

Thanks;

I am slowly understanding it. I created an app called app1; seems like 
when I go to the url localhost:8000/app1/default/index it redirects me 
to the welcome app?


I saw somewhere that the welcome app is the "Default" app; wondering why 
its not finding the app when I try the url?


Thanks


On 12/25/10 11:51 PM, pbreit wrote:

On Mac or windows, just double-click the app. Maybe on *nix as well. Best to 
create the project in admin but after that you can do *all* of your editing in 
text editor.

Chapter 3 of the books walks through getting started: 
http://web2py.com/book/default/chapter/03





Re: [web2py] Getting Started...

2010-12-26 Thread David J.

Yes its just the scaffolding of the app; I didn't realize it.

I am going to "play" more today. I really like what I see; It seems more 
and more intuitive as I go forward. Sometimes you over complicate things 
just because thats the way it works in other frameworks.


Thanks for your help.





On 12/26/10 10:18 AM, Anthony wrote:

On Sunday, December 26, 2010 12:05:59 AM UTC-5, David J wrote:

Thanks;

I am slowly understanding it. I created an app called app1; seems
like
when I go to the url localhost:8000/app1/default/index it
redirects me
to the welcome app?

I saw somewhere that the welcome app is the "Default" app;
wondering why
its not finding the app when I try the url?

Thanks

Are you saying it literally redirects you to 
localhost:8000/welcome/default/index (which shouldn't happen), or just 
that app1 looks like the welcome app? If you create a new app via the 
web-based admin interface, it will simply copy the welcome app, so 
your new app will start out looking like the welcome app (the purpose 
of the welcome app is to serve as a scaffolding app that you can modify).

Anthony




[web2py] Default Values.

2010-12-26 Thread David J.

How do  I specify Default DB values;

ie: I have a db field created_at which is datetime and should be a 
timestamp of when the user was created.


Normally in mysql; we use "created_at timestamp default now()"
where do I specify this default value? Or do I specify it when I create 
the object?



Thanks.



Re: [web2py] Default Values.

2010-12-26 Thread David J.

Thanks; just what I was looking for.



On 12/26/10 6:19 PM, Bruno Rocha wrote:

 Field  
<http://web2py.com/book/default/docstring/Field>('created_on','datetime',default=request
  <http://web2py.com/book/default/docstring/request>.now),

 Field  
<http://web2py.com/book/default/docstring/Field>('created_by',db.auth_user,default=auth.user_id),

 Field  
<http://web2py.com/book/default/docstring/Field>('updated_on','datetime',update=request
  <http://web2py.com/book/default/docstring/request>.now),

 Field  
<http://web2py.com/book/default/docstring/Field>('updated_by',db.auth_user,update=auth.user_id))

http://web2py.com/book/default/chapter/06#Table-Inheritance



2010/12/26 David J. mailto:da...@styleflare.com>>

How do  I specify Default DB values;

ie: I have a db field created_at which is datetime and should be a
timestamp of when the user was created.

Normally in mysql; we use "created_at timestamp default now()"
where do I specify this default value? Or do I specify it when I
create the object?


Thanks.




--

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




Re: [web2py] Default Values.

2010-12-26 Thread David J.

Thanks for the Tips;

Does this have sqlite have some sort of limitations?

I seem to get this exception;

Traceback (most recent call last):
  File 
"/Users/book/Desktop/python-projects/web2py/gluon/restricted.py", line 
188, in restricted

exec ccode in environment
  File 
"/Users/book/Desktop/python-projects/web2py/applications/app/models/db.py", 
line 97, in 

Field('updated_at','datetime',default=request.now,update=request.now),)
  File "/Users/book/Desktop/python-projects/web2py/gluon/dal.py", line 
3321, in define_table

polymodel=polymodel)
  File "/Users/book/Desktop/python-projects/web2py/gluon/dal.py", line 
410, in create_table

elif field.type[:10] == 'reference ':
TypeError: 'NoneType' object is unsubscriptable

ERROR SNAPSHOT
('NoneType' object is unsubscriptable)



On 12/26/10 6:19 PM, Bruno Rocha wrote:

db.auth_user,default=auth.user_id




Re: [web2py] Ajax pattern with Web2py

2010-12-27 Thread David J.

Hey Markus;

I am questioning the same thing; I am also trying to dig up this 
information.


maybe someone on this list has dealt with similar problems and wouldn't 
mind sharing?


If I find something I will be sure to post.

Thanks.



On 12/27/10 10:54 AM, Markus Schmitz wrote:

Good afternoon everybody,

I am trying my hand at a web2py based application and as long as I
stay with the good old postback pattern, everything works brilliantly
and coding is very efficient. In this style I programmed in the new
application the account management, a database logging feature, a FAQ
section, a feedback section, some import and export functionality.

Also the core functionality (with BI like functionality) works ok in a
post back manner, but is reaching performance and usability limits. I
would like to "ajaxify" the application and could obviously do so with
a corresponding amount of javascript+jquery. But suddenly the
efficiency gains of web2py are evaporating. I am aware of the ajax and
load functions in web2py, but they somehow do not fit my needs. So I
get the feeling, I either do not understand the ajax concept of web2py
or I am designing my app wrongly.

Here is an example, what I would like to do (one of many examples):

- display some data retrieved in a structured table like manner (easy
to be done with web2py).
- By clicking on an entry a modal popup window shall open and display
the data to be edited
- After editing and pressing 'save' the modal window closes and the
original table updates.

All of this without a postback. The wiki plugin works with a modal
window (the widget builder), but the result is taken with copy and
paste to the wiki text instead of being inserted automatically. So it
does not help me much.

Another example would be:

- I have on a page a tree, a form to search/filter data and a chart.
- When a node in the tree is clicked, than the filter selection
changes and the chart needs to reload accordingly
- When a node in the chart is selected, then again the filter changes
and the tree needs to reload
- Naturally if the filter form changes, both tree and chart needs to
reload.

I implemented this with javascript events on the tree and chart and
old fashioned postback, but which ajax pattern would you suggest for
this? Naturally I would like to minimize the javascript hacking on the
page as much as possible.

I am not looking for concrete coding tips here, more for the general
patterns of how to do ajax with web2py with minimal effort.

Regards

Markus





Re: [web2py] SQLFORM into a pop window

2010-12-28 Thread David J.

Can I have a peek at the app also? I am trying to get this working as well.

Thanks.



On 12/28/10 1:37 AM, Kenneth Lundström wrote:

Thank you Bruno,

my first thought when I tested it was that this doesn´t work at all, 
but now I see that it works quite nice.



Kenneth


Attached is an app which opens a form in a modal box.

2010/12/27 Kenneth Lundström >


Does anybody have a example of how to make a sqlform open up in a
popup window?


Kenneth




--

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






[web2py] FORM Generation Code.

2010-12-29 Thread David J.

Where is the code that Generates the FORMs?

What is the best way to modify this; Currently when it outputs the key name

It puts a colon; ex. "First Name:" instaead of just "First Name"

I simply want to remove that from the form.

Also on the links of the welcome app; That generate the "[ login | 
register | lost pasword? ]" links


I want to remove all those extra chars.

I checked the templates I dont see it in there;  I also see something in 
gluon.tools.py but I dont want to modify gluon code.


Thanks.





Re: [web2py] FORM Generation Code.

2010-12-29 Thread David J.

Bruno;

That just changes the value; but the problem is the form code adds an 
extra ":" to the end of the name.


so if you do as you suggested. db.auth_user.first_name.label='FName'

It outputs "FName:" not "FName" without the trailing colon ":"


Thanks.


On 12/29/10 2:02 PM, Bruno Rocha wrote:

you can set labels to auth_user table

db.auth_user.first_name.label = 'F Name'
db.auth_user.last_name.label = 'WHATEVER'

If you mean extra link in login/register form, simply edit 
/views/default/user.html




2010/12/29 David J. mailto:da...@styleflare.com>>

Where is the code that Generates the FORMs?

What is the best way to modify this; Currently when it outputs the
key name

It puts a colon; ex. "First Name:" instaead of just "First Name"

I simply want to remove that from the form.

Also on the links of the welcome app; That generate the "[ login |
register | lost pasword? ]" links

I want to remove all those extra chars.

I checked the templates I dont see it in there;  I also see
something in gluon.tools.py <http://gluon.tools.py> but I dont
want to modify gluon code.

Thanks.






--

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




Re: [web2py] FORM Generation Code.

2010-12-29 Thread David J.

Also if you look carefully this out put code is not consistent.

If you look at the "verify password" field it is not using 
class="w2p_fl|fw|fc"


Its just wrapped in a label.


Snippet from Register form.

for="auth_user_password" id="auth_user_password__label">Password: 
id="auth_user_password" name="password" type="password" value="" 
/>id="auth_user_password_two__row">Verify 
Password:/>please input your password againid="submit_record__row">class="w2p_fw">class="w2p_fc">type="hidden" value="/app/default/index" />type="hidden" value="2854b30e-a066-47c4-a9e2-f6902b899e7c" />name="_formname" type="hidden" value="register" />



On 12/29/10 2:02 PM, Bruno Rocha wrote:

you can set labels to auth_user table

db.auth_user.first_name.label = 'F Name'
db.auth_user.last_name.label = 'WHATEVER'

If you mean extra link in login/register form, simply edit 
/views/default/user.html




2010/12/29 David J. mailto:da...@styleflare.com>>

Where is the code that Generates the FORMs?

What is the best way to modify this; Currently when it outputs the
key name

It puts a colon; ex. "First Name:" instaead of just "First Name"

I simply want to remove that from the form.

Also on the links of the welcome app; That generate the "[ login |
register | lost pasword? ]" links

I want to remove all those extra chars.

I checked the templates I dont see it in there;  I also see
something in gluon.tools.py <http://gluon.tools.py> but I dont
want to modify gluon code.

Thanks.






--

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




[web2py] creating a new form RENDERER.

2010-12-30 Thread David J.

What is the best way to create a new FORM renderer?

How can I override or add a new form render type, ie instead of 
"table|div|ul"?


Thanks.


Re: [web2py] Re: creating a new form RENDERER.

2010-12-30 Thread David J.

Thanks, I will look into.

Also how is the "verify password" field generated on the "Registration 
Form" seems like that is a "virtual field"


As I mentioned yesterday that field is missing its css class selector so 
the form does not view correctly once you modify the css.


You can check there. But I will re-post here.


Password:



Verify Password:
please input your password 
again




On 12/30/10 3:07 PM, mdipierro wrote:

these are the list lines in the SQLFORM constructor:

 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)

perhaps we can make this more general?

On Dec 30, 1:59 pm, "David J."  wrote:

What is the best way to create a new FORM renderer?

How can I override or add a new form render type, ie instead of
"table|div|ul"?

Thanks.




Re: [web2py] Re: comet for web2py (give it a try) - and happy new year

2010-12-31 Thread David J.

Setting up right now.

I need trunk web2py_ajax or will latest work?

Can I just copy that single file from trunk?

Thx.

On 12/31/10 2:21 PM, mdipierro wrote:

... and this requires the latest web2py_ajax.html from welcome in
trunk else it does not work.

Please give it a try, I have not tested it that much!

Massimo

On Dec 31, 1:19 pm, mdipierro  wrote:

Sorry Mistake:

http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_mes...

On Dec 31, 1:14 pm, mdipierro  wrote:


Should be self explanatory:
http://code.google.com/p/web2py/source/browse/scripts/comet_messaging.py






Re: [web2py] jQuery - need help !

2011-01-03 Thread David J
I think you don't have the full jquery ui  package. I see you have custom
On Jan 3, 2011 9:45 AM, "Martin Weissenboeck"  wrote:
> Hi,
> I want to use jQuery UI. I have tried a lot of things during the last two
> days, but nothing worked.
> I have read http://jqueryui.com/docs/Getting_Started and I have done the
> following steps:
>
> (1) Download jquery-ui-1.8.7.custom.zip from http://jqueryui.com/download
>
> (2) Unzip this file
>
> (3) Copy download\...\js\jquery_ui_1.8.7.custom.min.js to
> web2py: js/jquery_ui_1.8.7.custom.min.js
>
> (4) Copy download\...\css\smoothness\jquery_ui_1.8.7.custom.css to
> web2py: css/smoothness/jquery_ui_1.8.7.custom.css
>
> (5) Add the following lines in web2py_ajax.html after
> response.files.insert(2,URL('static','js/calendar.js'))
>
>
>
response.files.insert(3,URL('static','css/smoothness/jquery-ui-1.8.7.custom.css'))
> response.files.insert(4,URL('static','js/jquery-ui-1.8.7.custom.min.js'))
>
> (6) Change default/index.html to:
>
> {{extend 'layout.html'}}
> Date: 
> Hello
> World
>
>
> 
> jQuery('.one').click(function(){jQuery('.two').slideToggle()});
> jQuery('#date').datepicker();
> 
>
>
> (7) This is the new website:
>
> Date:
> Hello
> World
>
>
> A click on Hello makes World disappear, so this jQuery function works. But
> the other jQueery-function datepicker does not show any reaction. I have
> tried some other functions: neither of these functions did work.
>
> Maybe there is only a very small error - but I cannot find it.
> Any ideas?
>
> Regards, Martin


[web2py] Multi Tabbed Menu - Any Suggestions.

2011-01-05 Thread David J.
I was wondering if anyone on the list has seen an good multi-level 
horizontal tab menu.


I have




Company

Overview
Our People


Products

Product 1
Product 2







Obviously the second layer is visible on the "selected" tab.

I was hoping there might be something already made that does this.

I dont want a drop down menu;
I am looking for horizontal tabs.

Sorry I know its not web2py related; but my project is in web2py. =)



Re: [web2py] Re: Is there a way to remove application name from URL()?

2011-01-17 Thread David J.

The easy way is to use "init" as your application name;

It uses that by default.

HTH.



On 1/17/11 4:11 PM, howesc wrote:
i'm pretty sure there is a section in the book that covers this topic 
exactly.  there is also new versions of routing since i last wrote 
this.  anyhow, my routes info:


routes_in = (('/admin(?P.*)', '/admin$f' ),  #make the admin app work
 ('/','/ec'), #/ goes to the ec app
 ('.*:/favicon.ico','/ec/static/images/favicon.ico'), #fav 
icon for all things on this server
 ('/$c/(?P.*)', '/ec/$c/$f'), # remove the leading /ec 
from our URLs
 ('/$c', '/ec/$c')) #remove leading /ec, don't require a 
function name (default to index)


routes_out = (('/admin/(?P.*)', '/admin/$f' ), # don't rewrite 
admin links
  ('/$a/static/(?P.*)', '/$a/static/$f'), #don't 
rewrite static links
  ('/$a/$c/index.html', '/$c/'), # removing leading /ec, 
and the index function if there are no params
  ('/$a/$c/index', '/$c/'), # removing leading /ec, and 
the index function if there are no params

  ('/$a/$c/(?P.*)', '/$c/$f')) # remove leading /ec

note that your routes_out must remove the application from the URL 
generated by URL() for it to work.  "ec" is my application name in 
this example.  you may also wish to look at the more recent updates to 
the routing mechanism, they might be easier to use - i don't know 
myself yet.


cfh




[web2py] Cached Results Using a Module.

2011-01-19 Thread David J.

Perhaps I missed an important point;

I have an "api.py" which I loaded through the modules directory;

This "api.py" makes calls for data to external web services;

In my controller; I have

api = local_import('api')


def remote():
 api_result = api.xml_request({'id':'123456'})

 return dict(results=api_result)


What seems to happen is the first call to controller makes a call to the 
"api.py" script and I get the results; but lets say I change the 
parameters and reload the page; I see the same results returned. Only if 
I restart the wb2py server do I see the change on the first request and 
then same thing;


so I wonder if maybe this request is stored in cache and it re-uses this 
result on subsequent requests; or perhaps something else is causing this 
problem.


Thanks.





Re: [web2py] Re: Cached Results Using a Module.

2011-01-19 Thread David J.

Great Thanks I will try;

At what cost am I doing this; Does it add tremendous overhead?

Thanks



On 1/19/11 5:24 PM, ron_m wrote:
If you are editing the file in the modules directory then that is the 
problem. A module gets pulled in and kept by the server until restart 
unless you add a parameter to the local_import()


api = local_import('api', True) where the True says perform a module 
reload on each request.




Re: [web2py] Re: Cached Results Using a Module.

2011-01-19 Thread David J.

As you said; It worked;

Thanks for the pointer; I appreciate it;

And will set to false in production.

Thanks again.



On 1/19/11 5:27 PM, Massimo Di Pierro wrote:

Yes. In production set the second argument to False

On Jan 19, 4:27 pm, "David J."  wrote:

Great Thanks I will try;

At what cost am I doing this; Does it add tremendous overhead?

Thanks

On 1/19/11 5:24 PM, ron_m wrote:








If you are editing the file in the modules directory then that is the
problem. A module gets pulled in and kept by the server until restart
unless you add a parameter to the local_import()
api = local_import('api', True) where the True says perform a module
reload on each request.




Re: [web2py] Another question about Powertable

2011-01-21 Thread David J.
Have you tried returning your rows using an SQL order by clause to see 
if that worked...


Just a suggestion; I never used powertable.



On 1/21/11 10:29 AM, Kenneth Lundström wrote:

Hi again Bruno,

another stupid question about powertable. How do I select in what 
order the rows are shown. For do moment they are shown in ID order, 
I´d like to select anoter column.



Kenneth






[web2py] Adding fields to the default register form;

2011-01-25 Thread David J.

How can I extend the default register form to add custom fields?

I am not extending the Database; I just want to append more fields for 
validation.


Thanks.




Re: [web2py] Adding fields to the default register form;

2011-01-25 Thread David J.

Thanks

But I am confused by this;

I am using the welcome app;

I dont see these files (sample view default/user.html); so I am sure 
they loaded in web2py somewhere


Excerpt from the book:
web2py also includes a sample view "default/user.html" to render this 
function properly that looks like this:


1.
2.
3.
4.
5.
6.
7.



{{extend'layout.html'}}
{{=request  
<http://web2py.com/book/default/docstring/request>.args(0)}}
{{=form}}
{{ifrequest  
<http://web2py.com/book/default/docstring/request>.args(0)=='login':}}
http://web2py.com/book/default/docstring/URL>(args='register')}}">register
http://web2py.com/book/default/docstring/URL>(args='request_reset_password')}}">lost 
password
{{pass}}

Notice that this function simply displays a |form| and therefore it can 
customized using normal custom form syntax. The only caveat is that the 
displayed form depends on the value of |request.args(0)| therefore you 
may need if statement like this:




On 1/25/11 8:24 AM, contatogilson...@gmail.com wrote:

http://web2py.com/book/default/chapter/08#Customizing-Auth
_________
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/1/25 David J. mailto:da...@styleflare.com>>

How can I extend the default register form to add custom fields?

I am not extending the Database; I just want to append more fields
for validation.

Thanks.







Re: [web2py] Adding fields to the default register form;

2011-01-25 Thread David J.

I still cant seem to change the default view from 'table3cols' to 'divs'

I tried editing the controller and

form = auth()
form.formstyle = 'divs'

But I still get the table 3 cols layout.

Thanks.




On 1/25/11 9:25 AM, Anthony wrote:
You should find user.html in /applications/welcome/views/default/. 
It's a view file, so it's in the 'views' folder.

Anthony

On Tuesday, January 25, 2011 8:47:25 AM UTC-5, David J wrote:

Thanks

But I am confused by this;

I am using the welcome app;

I dont see these files (sample view default/user.html); so I am
sure they loaded in web2py somewhere

Excerpt from the book:
web2py also includes a sample view "default/user.html" to render
this function properly that looks like this:

1.
2.
3.
4.
5.
6.
7.



{{extend'layout.html'}}
{{=request  
<http://web2py.com/book/default/docstring/request>.args(0)}}
{{=form}}
{{ifrequest  
<http://web2py.com/book/default/docstring/request>.args(0)=='login':}}
http://web2py.com/book/default/docstring/URL>(args='register')}}">register
http://web2py.com/book/default/docstring/URL>(args='request_reset_password')}}">lost 
password
{{pass}}

Notice that this function simply displays a |form| and therefore
it can customized using normal custom form syntax. The only caveat
is that the displayed form depends on the value of
|request.args(0)| therefore you may need if statement like this:



On 1/25/11 8:24 AM, contatog...@gmail.com wrote:

http://web2py.com/book/default/chapter/08#Customizing-Auth
<http://web2py.com/book/default/chapter/08#Customizing-Auth>
_
*Gilson Filho*
*Web Developer
http://gilsondev.com*



2011/1/25 David J. 

How can I extend the default register form to add custom fields?

I am not extending the Database; I just want to append more
fields for validation.

Thanks.









[web2py] Add objects through Shell not committing;

2011-01-25 Thread David J.

I am trying to add objects from the shell

The objects are static so I didnt feel the need to make any web 
interface for it;


python ./web2py.py -S app -M -P

Interactive shell>>

db.numbers.insert(number='100');
1
db.numbers(0).number
100

This all works;

I exit out of shell and then go back in; but seems like the data is lost?

What am I doing wrong?

Thanks.




[web2py] Escaping entities.

2011-01-26 Thread David J.

How do I display HTML entities;

ie; © Copyright

I am doing response.title = '© Copyright 2011';

I see that text exactly in the title bar;

I should see "© Copyright 2011"

Thanks



[web2py] Overwriting the default "register" action

2011-01-26 Thread David J.


Currently I have a session variable called site_id;

Its a read only variable we set when the user comes to one of the sites;

ON the default register pages; I am trying to store this variable when 
the user registers;


I am trying to figure out how to "extend" the default "register" command;

Basically what I am trying to do is store site_id into the databases 
after a user registers;


In a separate table; I read that I can add fields to the default auth 
table; I do not want to take this approach;


Theoretically there can be a many to one relationship;

I see this in the docs;

defregister():
form=SQLFORM  
.factory(db.client,db.address)
ifform.accepts(request  
.vars):
id=db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id=db.address.insert(**db.address._filter_fields(form.vars))
response  
.flash='Thanks for filling 
the form'
returndict(form=form)

Also not sure why you use the ** in front of **db.address

Thanks.




Thanks.




Re: [web2py] Re: Adding fields to the default register form;

2011-01-27 Thread David J.


The fact that auth is so tightly coupled with the view is very frustrating;

It would be better if auth return an object that was wrappable; in 
FORM(); rather than the rendered form


This way you can do things like addfield() to the form before it is 
rendered or just render it as it is;


I asked before "what is the easiest way to add a non-database field to 
the registration form"



Right now I dont see an easy way to do this;



On 1/27/11 11:55 AM, Anthony wrote:

On Thursday, January 27, 2011 11:00:45 AM UTC-5, viniciusban wrote:

On Thu, Jan 27, 2011 at 3:27 AM, Bruno Rocha 
wrote:
> Thinking a bit more, taking the Vinicius comment and some
examples of
> another O.O frameworks.
> I was wondering about...
> #2
> auth.settings.formstyle = 'divs'
> form = auth()
> print form #  return the HTML with divs

OK, but formstyle isn't related to auth in anyway, but it is to
form, right?
If auth wouldn't be showed (rendered) as a form, this property never
needed to be used.

Auth does a number of things, one of which is to generate various 
forms related to authentication (e.g., registration, login, recover 
password, etc.), so it seems relevant for it to have settings telling 
it how to render the forms it generates.


> ...
> form.formstyle = 'divs' # sets the self.formstyle to 'divs'
> and immediately raises a redraw method
> #alternatively call explicitly the form.redraw() method
> print form # should now return HTML with 'divs'
>
> I think Vinicius are talking about the case #3, which I think it
is possible
> to implement, but I don't know the caveats,

Yes Bruno. You catched my mind.

Actually, formstyle='divs' is a SQLFORM form property. It is the way
print will show the generated HTML for this form instance.

When you create a SQLFORM form, it actually generates the HTML for the 
form, which is then passed to the view. There isn't a separate 
HTML-generation step at "print" time. So any properties that affect 
the HTML have to be set before the form is created (so, 'formstyle' is 
passed as an argument to the SQLFORM __init__ method).


So, conceptually it is a form property.

Your 3rd example show an intuitive method do implement this feature.

I didn't have time to see the source code yet (I plan to do this
tonight), but I see no reason to generate HTML code before the print
call.

At what point would you prefer to generate the HTML? Would you 
prefer an explicit extra step to call a render method on the form 
sometime after it is initially created (either before or after passing 
it to the view)? What are the benefits of that approach?

Best,
Anthony




[web2py] Possible DB bug on update;

2011-01-27 Thread David J.

I am using 1.9.1.4

I see a strange behavior

I am doing this simple test;

def update():
rows = db((db.nums.hold==False) & (db.nums.active==False)).select()
for row in rows.find(lambda row: row.num[len(row.num)-2:]=='55'):
row.update(hold=True)
db.commit()

return locals()

The view I have this

{{=rows }}

I see the row 55 has been updated with the "hold" status as True;

However this update does not persist to the DB;

after I have run the above code; I change to...


def update():
rows = db((db.nums.hold==False) & (db.nums.active==False)).select()
for row in rows.find(lambda row: row.num[len(row.num)-2:]=='56'):
row.update(hold=True)
db.commit()

return locals()


I will see row 55 with the "hold" status of False (which should be True 
as per our previous update) and then 56 should show True as well.



I am not sure why I am experiencing this;


The only thing I can think of is that perhaps because I specify this 
value as false in the table definition it keeps returning to false?


db.define_table('nums',signature,
Field('num','string'),
Field('active','boolean',default=False),
Field('hold','boolean',default=False),
)





Re: [web2py] Re: Possible DB bug on update;

2011-01-27 Thread David J.

Darn; I missed that;

Thanks for the help;

I really thought I read the chapter through.

Thanks.



On 1/27/11 11:44 PM, ron_m wrote:

>From the DAL chapter of the manual


  |update_record|

update_record
web2py also allows updating a single record that is already in memory 
using |update_record|

1.
2.
3.

>>>  rows=db(db.person.id>  2).select()
>>>  row=rows[0]
>>>  row.update_record(name='Curt')

This should not be confused with

1.

>>>  row.update(name='Curt')

because for a single row, the method |update| updates the row object 
but not the database record, as in the case of |update_record|.



  |
  |






[web2py] Disabling the error page in production.

2011-01-28 Thread David J.

How do I disable the error page in production?

I would ideally like to replace it with a Nicer page same for 404 errors;

I searched the book for error page; but I must have missed the part 
where it says disabling.


Thanks.


[web2py] Forcing SSL on certain requests;

2011-01-29 Thread David J.
Is there a utility available to force requests to SSL? (ex: Login, 
Register, etc..)


I see one option in reCaptcha section;

use_ssl=True

But I looked in the FORM docs and don't see that as an option;







Re: [web2py] Forcing SSL on certain requests;

2011-01-30 Thread David J.

Philip;

Yes; I suppose that would work;

Thanks for the advice;

It is appreciated.

Have a good day.



On 1/30/11 2:41 AM, Philip Kilner wrote:

Hi David,

On 30/01/2011 01:02, David J. wrote:

Is there a utility available to force requests to SSL? (ex: Login,
Register, etc..)



Are you behind a web server? That may be a better place to manage that 
than on the web2py side, depending on you needs of course.


You can do this with an Apache rewrite rule, see: -

http://www.whoopis.com/howtos/apache-rewrite.html

...for some examples.

HTH






Re: [web2py] Web2Py on Raspberry Pi?

2012-07-12 Thread David J
For sure. You can probably run the embedded rocket webserver
On Jul 12, 2012 7:29 PM, "Ron K Jeffries"  wrote:

> Raspberry Pi is an inexpensive $35 ARM based Linux board that has 256MB of
> RAM and Ethernet as network connectivity.
> They are shipping in volume, maybe a million by end of 2012.
>
> Anybody thinking about trying Web2Py on a Raspberry Pi? I don't have the
> chops myself.
>
> Debian is running fine on it, and that image includes a working Python.
> So... it needs a web server compiled for ARM, and a database.
> Anything else?
>
> And thoughts on whether 256MB of RAM might work for a lightly-loaded
> Web2Py server?
>
> --ron k jeffries
>


Re: [web2py] Re: Auth form custom errors

2012-05-07 Thread David J
You have a typo "acton"
On May 7, 2012 7:32 AM, "Rhys"  wrote:

> Hey Massimo,
>
> The
>
> {{form=auth()}}
> {{form['_acton'] = "/user/login"}}
> {{=form.custom.begin}}
>
>
> spat out the html without the updated action
>
> 
>
>
> Cheers,
>
> Rhys
>
>
> On Monday, May 7, 2012 12:52:20 AM UTC+10, Massimo Di Pierro wrote:
>>
>> Interesting. When you say it did not work. What html did it generate?
>>
>> On Sunday, 6 May 2012 03:25:41 UTC-5, Rhys wrote:
>>>
>>> Hey Massimo,
>>>
>>> You've steered me in the right direction.
>>>
>>> Basically I've had to put in a pure opening html form element in, and
>>> then use the custom form widgets afterwards. Works now. Resulting in:
>>>
>>> 
>>> {{=form.custom.widget.email}}
>>> {{=form.custom.widget.**password}}
>>> {{=form.custom.end}}
>>>
>>> The
>>>
>>> form['_action'] = URL('user/login')
>>>
>>> or
>>>
>>> form.attributes['_action'] = URL('user/login')
>>>
>>>
>>> for some reason didn't want to work.
>>>
>>> Cheers,
>>>
>>> Rhys
>>>
>>> On Sunday, May 6, 2012 3:50:52 PM UTC+10, Massimo Di Pierro wrote:

 This is because of the mechanism to prevent CSRF attacks.
 There are supposed to be two hidden fields, one is the formname. The
 other is the formkey (a unique onetime token).

 Try:

 {{
 form=auth.login()
 form['_action']=URL('user/**login')
 }}
 {{=form.custom.begin}}
 {{=form.custom.widget.email}}
 {{=form.custom.widget.**password}}
 
 
 {{=form.custom.end}}


 On Saturday, 5 May 2012 23:37:57 UTC-5, Rhys wrote:
>
> Hey Alan,
>
> I don't want to redirect. I'll try and to explain it a bit more.
>
> Basically I have two forms. One which is a drop down, in pure html
>
> 
> 
> 
>
> 
> 
> 
>
>
>
> ^ this Form is on every page which the user is not logged into. When
> they fill out this form and click submit I want the /user/login page to
> process it, but it is not doing so. When the page finds there is an error
> with the login or the user is not authorised, I would like the /user/login
> form which is exactly the same form as above but on another page with the
> drop down one removed, to present there was an error with the login.
>
> Both forms I've done in html so there is no form key to process. I'm
> trying to figure out why auth.login() doesn't process it as the
> form.accepts() method in auth.login() has the same formname. What is
> preventing it from being processed. It's driving me in sane. I'm stepping
> through the code in debug mode and can't find why it would not process it.
> It is basically a SQL form in html like described in the web2py book.
>
> Any insight would be great by any!
>
> On Sunday, May 6, 2012 12:19:49 AM UTC+10, Alan Etkin wrote:
>>
>> *auth.is_logged_in()* will return a bool object. True for
>> authenticated user and I belive *auth.user_id* attribute is None for
>> the non authenticated user. *auth *being the Auth class instance
>> created by the welcome scaffolding application.
>>
>> You could use the returned values to catch unsuccessful
>> authentication and redirect to the correct action
>>
>> There is an Auth setting for failed authentication (for example, it's
>> possible to call a function on failed login)
>> ("Settings and Messages", web2py book 4th edition, 9.3.7)
>>
>> auth.settings.on_failed_**authentication = lambda url: redirect(url)
>>
>> On Saturday, May 5, 2012 9:51:23 AM UTC-3, Rhys wrote:
>>>
>>> I'm creating a custom drop down login form for all pages where the
>>> user isn't logged in. Once they try and login through this form if it
>>> is unsuccessful it redirects to the /user/login page with the auth.login
>>> form. How do I get a error if the login has resulted in an invalid 
>>> login.
>>> As there are two forms I've tried also tried to do a form out of html so
>>> there is no form key. Still no luck. Is it s simple variable I can use 
>>> to
>>> determine if it is successful?
>>
>>


Re: [web2py] Re: error class proposal

2012-01-17 Thread David J
Massimo added this to trunk.

Please see .inputinvalid class
On Jan 17, 2012 8:47 PM, "Alex"  wrote:

> I've created a function getFormFields which I call for every form I'm
> using. In this function I go through all inputs of the form with
> form.elements('input, select, textarea')
>
> and then I check if the name of the input field exists in form.errors.
> If there is an error I add a css error class. At the end of the
> function I return all input fields as a dict.
>
> On 16 Jan., 23:56, Massimo Di Pierro 
> wrote:
> > I understand. Let me think about this the problem is some some
> > widgets do not have a single input fiels (think if lists and
> > checkboxes). Please open a ticket in google code so we do not forget.
> >
> > On Jan 16, 2:25 pm, David  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Sorry for not being clear;
> >
> > > I meant if the field has an error obviously.
> >
> > > After form validation, the ie. input would have an error class
> >
> > > This would be useful for styling the fields with say "red borders"
> >
> > > Alternatively if there is generic way to handle this I would
> appreciate it.
> >
> > > Thanks.
> >
> > > On 1/16/12 2:26 PM, Massimo Di Pierro wrote:
> >
> > > > Why do you want to add an "error" class to the input? The error class
> > > > is normally used for inputs. Perhaps I do not understand.
> >
> > > > On Jan 15, 7:40 pm, David  wrote:
> > > >> I was thinking about the form validation.
> >
> > > >> I thought that it may be useful to include an "error" class on the
> input
> > > >> widget when the form is submitted and has invalid data.
> >
> > > >> ie.
> >
> > > >> from
> >
> > > >> 
> > > >>
>  assword">
> > > >> too
> short
> > > >> 
> >
> > > >> to
> >
> > > >> 
> > > >>  > > >> error"type="password"value=""name="password">
> > > >> too
> short
> > > >> 
> >
> > > >> Notice the error is the class of the input.
> >
> > > >> I think this would be very useful and don't think it would break any
> > > >> backwards compatibility.
> >
> > > >> Thanks.
>


Re: [web2py] Re: web2py with twitter bootstrap - very clean interface ...

2012-01-24 Thread David J
Yeah setup bs2 today and its really sweet. Just need to make some class
changes from v1.4
On Jan 24, 2012 6:47 PM, "pbreit"  wrote:

> Looks like Twitter Bootstrap 2 is ready. I've seen some positive comments
> about it in regards to the switch to 12 columns and responsiveness.


Re: [web2py] auth

2012-02-23 Thread David J
Yes please look in docs.
On Feb 23, 2012 5:33 AM, "Prakhar Srivastava"  wrote:

> is there any way to change the path after Login by default in direct
> to the index
>


Re: [web2py] Re: password storage with per-user salt

2011-09-21 Thread David J
Why double salt. That's the point of SSL. we should only be concerned with
application level details not transport
On Sep 21, 2011 10:27 AM, "Anthony"  wrote:
> Yes, I think the salting and hashing we're discussing is meant to protect
> the passwords once on the server (i.e., if the server/database is
> compromised). We'd need additional protection to protect them in transit.
> Another option would be login over SSL, no?
>
> Anthony
>
> On Wednesday, September 21, 2011 9:02:07 AM UTC-4, mcm wrote:
>>
>> Plain WRONG. Even the guy knows it: " Note that a hacker could still
sniff
>> the hashed password going over the network, and use that hash later to
send
>> to the server and impersonate you. But at least the hacker can't use your

>> real password for other purposes."
>>
>> You can try with two salts. One of them must be one time random for each
>> auth request. Then you apply the hashing twice with the 2 salts on the
>> client and once on the server with the one time only.
>>
>> mic
>> Il giorno 21/set/2011 14:48, "Anthony"  ha scritto:
>> > +1
>> >
>> > On Wednesday, September 21, 2011 2:43:20 AM UTC-4, pbreit wrote:
>> >>
>> >> It might not be a bad idea to improve password handling at this time.
I
>> >> think the biggest problem is that password hases are not currently
>> salted.
>> >> The hmac_hash function appears to take a salt but I didn't see any
>> evidence
>> >> that is ever actually used.
>> >>
>> >> The Django model seems sufficient:
>> >> https://docs.djangoproject.com/en/dev/topics/auth/#passwords
>> >>
>> >> I think this is the code:
>> >>
>> https://github.com/django/django/blob/master/django/contrib/auth/utils.py
>> >>
>> >> Passwords would be stored like this:
>> >> sha1$a1976$a36cc8cbf81742a8fb52e221aaeab48ed7f58ab4
>> >> (ie, algo$salt$hash)
>> >>
>> >> The hash algo is stored with the password. This makes it easier to
>> switch
>> >> algos in the future. The salt is also stored with the password which
>> many
>> >> people mistakenly think is unsecure. Also note that the salt is just a

>> >> simple random string and does not have to be particularly long to be
>> >> effective.
>> >>
>> >> If we did implement this approach, the next question is, could we also

>> >> implement a scheme whereby if the algo is changed, when someone goes
to
>> >> change their password, the system can confirm that the old password is

>> >> provided correctly and then store the new password under the new
scheme?
>> >>
>>


[web2py] Returning the Row after insert;

2011-01-31 Thread David J.

currently;

I am doing a select after an insert to look up the values of a row;

For example; the registration key when using the default "register" 
application;


But I think there must be an easier way;

If anyone has a "best practice" suggestion I would appreciate it;

currently the code looks like this;

if form.accepts(request.vars):
id = form.vars.id;
row = db(db.auth_user.id=id).select();
session.flash= row.registration_key




[web2py] onaccept after user registers;

2011-02-02 Thread David J.

Is there an example of using "onaccept" after a user registers?




Re: [web2py] Re: Cloud hosting company

2011-02-07 Thread David J.

You can run on Rackspace cloud as well;


On 2/7/11 11:32 AM, stargate wrote:

Where is the prices on hosting?

On Feb 7, 11:10 am, Bruno Rocha  wrote:

I am running in dotcloud (but it is in beta)

http://www.web2py.dotcloud.com/

  also Pydra is announcing they will run
web2py very soon.

For now, I know only Google App Engine and Amazon ECM running well on a
cloud.

Bruno Rochahttp://about.me/rochacbruno/bio

2011/2/7 stargate


Does anybody know of a hosting company that will run web2py in a cloud
hosting environment?






[web2py] Overriding the Default "verify_email"

2011-02-07 Thread David J.

I was wondering how I can execute a custom action on "verify_email"

I have an external system that I want to notify once a user has 
confirmed their email address;


Thanks.


[web2py] onaccept

2011-02-07 Thread David J.


Is there an example of how to use "onaccept" handler?

I tried

auth.settings.verify_email_onaccept = lambda f:_create_account(f)



def _create_account(f):
session.account  = f
return


I tried on my index page to display

{{= session.account }}

But I dont think it worked.

Thanks.




[web2py] URL secure flag.

2011-02-08 Thread David J.

I was wondering why URL does not include a secure flag?

I think it should be able to set "secure" url's

For example if you do URL("function",secure=True)

We generate a complete URL

https://example.com/welcome/default/function




Re: [web2py] Re: URL secure flag.

2011-02-08 Thread David J.

Well than maybe someone could inform them; ;)

It would be useful; My current work around is to make the whole site 
secure cringe;



On 2/8/11 2:36 PM, Massimo Di Pierro wrote:

Because the URL function does not know the "https://example.com";. Only
the web server knows it.

We do have a URL(,sign=) option to digitally sign URLs.

On Feb 8, 12:58 pm, "David J."  wrote:

I was wondering why URL does not include a secure flag?

I think it should be able to set "secure" url's

For example if you do URL("function",secure=True)

We generate a complete URL

https://example.com/welcome/default/function




Re: [web2py] Re: URL secure flag.

2011-02-08 Thread David J.

Thanks Jonathan;

This works too;

Thanks;


On 2/8/11 3:11 PM, Jonathan Lundell wrote:

On Feb 8, 2011, at 11:41 AM, David J. wrote:

Well than maybe someone could inform them; ;)

It would be useful; My current work around is to make the whole site secure 
cringe;

If you know that the host info is valid, you could write:

'https://%s%s' % (request.env.http_host, URL("function"))

web2py has no guarantee of knowing the host name; that depends on how it's 
deployed (consider the case of a proxy).



On 2/8/11 2:36 PM, Massimo Di Pierro wrote:

Because the URL function does not know the "https://example.com";. Only
the web server knows it.

We do have a URL(,sign=) option to digitally sign URLs.

On Feb 8, 12:58 pm, "David J."   wrote:

I was wondering why URL does not include a secure flag?

I think it should be able to set "secure" url's

For example if you do URL("function",secure=True)

We generate a complete URL

https://example.com/welcome/default/function







Re: [web2py] Re: URL secure flag.

2011-02-08 Thread David J.
This is what I thought "could" have been done and was wondering why it 
has not?


It would make sens that this type of utility function would come in very 
handy;


Today many sites use a mix of http and https; while I know that web2py 
could not force out of a particular scheme the links could at least be 
written so that you can switch between the two rather easily;


for example on login; you would probably always want that using https




On 2/8/11 3:59 PM, Jonathan Lundell wrote:

On Feb 8, 2011, at 12:24 PM, David J. wrote:

Thanks Jonathan;

This works too;

Good.

This *could* be an option to URL, since it has internal access to request. 
Suppose we added arguments URL(..., secure=None, host=None).

This case would mean the current behavior. Secure could be True or False for 
https/http. Host could be a string.

Specifying just a host would mean: use scheme from request.env.

Specifying just secure True/False would mean: use host from request.env.

The host&  scheme would be prepended after all rewriting.


Thanks;


On 2/8/11 3:11 PM, Jonathan Lundell wrote:

On Feb 8, 2011, at 11:41 AM, David J. wrote:

Well than maybe someone could inform them; ;)

It would be useful; My current work around is to make the whole site secure 
cringe;

If you know that the host info is valid, you could write:

'https://%s%s' % (request.env.http_host, URL("function"))

web2py has no guarantee of knowing the host name; that depends on how it's 
deployed (consider the case of a proxy).


On 2/8/11 2:36 PM, Massimo Di Pierro wrote:

Because the URL function does not know the "https://example.com";. Only
the web server knows it.

We do have a URL(,sign=) option to digitally sign URLs.

On Feb 8, 12:58 pm, "David J."wrote:

I was wondering why URL does not include a secure flag?

I think it should be able to set "secure" url's

For example if you do URL("function",secure=True)

We generate a complete URL

https://example.com/welcome/default/function









Re: [web2py] auth.signature

2011-02-08 Thread David J.

This is long overdue; although it was in the book;

I was using the default auth_user table; I really dont know when the 
user was registered?


Whoops; this will solve this problem

Thanks.


On 2/8/11 4:04 PM, Bruno Rocha wrote:

2011/2/8 pbreit mailto:pbreitenb...@gmail.com>>

Hmmm, still don't really understand. What's the use case?


Very useful when you want to know who is the creator of a record, when 
the record was created, and the same for updates.




Re: [web2py] Kind of e-commerce but maybe not

2011-02-08 Thread David J.

The other problem your going to have is Peripheral support;

They are probably going to want to work with cash drawer, printers and 
scanners.


I am not sure how well the browser can interact with those things.


It would be nice to try I personally would love to make a POS work with 
web2py



On 2/8/11 4:53 PM, Kenneth Lundström wrote:

Hello list,

yesterday I got an question from an customer about finding a new 
cashier system for them. They have three separate place of sales that 
have completly different products. Only reporting needs to be done to 
one place.


Would it be possible to build a cashier system with web2py.

I guess it would be best to have web2py installed locally in every 
place. They have ADSL to every place but it would be bad if cashier 
isn´t working because of network problems.



Kenneth






[web2py] Additional Queries on Login.

2011-02-08 Thread David J.


I am using the default web2py login mechanism;

I am not sure where I can run additional queries after a successful login?

I tried doing

def load_settings(f):
settings = db.settings(db.settings.user == f.id)
session.settings = settings
return


auth.settings.login_onaccept = lambda f:load_settings(f)

This anyway throws an exception;

Even if this were to work; would this be the best place to do this?

I want to store the settings on the "Profile" page

The settings are read only on that page they click a link to modify the 
setting which handles all the CRUD methods.


Any advice would be greatly appreciated.

Thanks.




Re: [web2py] Re: Additional Queries on Login.

2011-02-09 Thread David J.

Fantastic;

I got it working another way; but I will change to this much more concise;

I called auth.user.id instead which worked;

Is there any drawbacks to the way I did it? I think one uses the 
authenticated user while yours passes the form that was just submitted...


Thanks.




On 2/9/11 10:09 AM, Massimo Di Pierro wrote:

The idea is correct but f should be the form and you should not save a
record in session without converting to a python dict.

def load_settings(form):
  settings = db.settings(db.settings.user == form.vars.id)
  session.settings = settings.as_dict()

auth.settings.login_onaccept = lambda form:load_settings(form)

On Feb 8, 11:33 pm, "David J."  wrote:

I am using the default web2py login mechanism;

I am not sure where I can run additional queries after a successful login?

I tried doing

def load_settings(f):
  settings = db.settings(db.settings.user == f.id)
  session.settings = settings
  return

auth.settings.login_onaccept = lambda f:load_settings(f)

This anyway throws an exception;

Even if this were to work; would this be the best place to do this?

I want to store the settings on the "Profile" page

The settings are read only on that page they click a link to modify the
setting which handles all the CRUD methods.

Any advice would be greatly appreciated.

Thanks.




Re: [web2py] Re: URL secure flag.

2011-02-09 Thread David J.

how about "secure" or "enable_ssl" or "transport" or "is_secure"

Although "secure" is probably the most intuitive;



On 2/9/11 11:20 AM, Jonathan Lundell wrote:

On Feb 9, 2011, at 6:58 AM, Massimo Di Pierro wrote:

No objection. I would take the patch.

I'll work one up. Input on the exact argument syntax is welcome.


On Feb 8, 2:59 pm, Jonathan Lundell  wrote:

On Feb 8, 2011, at 12:24 PM, David J. wrote:




Thanks Jonathan;
This works too;

Good.

This *could* be an option to URL, since it has internal access to request. 
Suppose we added arguments URL(..., secure=None, host=None).

This case would mean the current behavior. Secure could be True or False for 
https/http. Host could be a string.

Specifying just a host would mean: use scheme from request.env.

Specifying just secure True/False would mean: use host from request.env.

The host&  scheme would be prepended after all rewriting.










Thanks;
On 2/8/11 3:11 PM, Jonathan Lundell wrote:

On Feb 8, 2011, at 11:41 AM, David J. wrote:

Well than maybe someone could inform them; ;)
It would be useful; My current work around is to make the whole site secure 
cringe;

If you know that the host info is valid, you could write:
'https://%s%s' % (request.env.http_host, URL("function"))
web2py has no guarantee of knowing the host name; that depends on how it's 
deployed (consider the case of a proxy).

On 2/8/11 2:36 PM, Massimo Di Pierro wrote:

Because the URL function does not know the "https://example.com";. Only
the web server knows it.
We do have a URL(,sign=) option to digitally sign URLs.
On Feb 8, 12:58 pm, "David J."wrote:

I was wondering why URL does not include a secure flag?
I think it should be able to set "secure" url's
For example if you do URL("function",secure=True)
We generate a complete URL
https://example.com/welcome/default/function







Re: [web2py] Re: how may I do this (block and unblock buttons for admin dashboard)

2011-02-09 Thread David J.

I was wondering about that too;;

Is BUTTON a new addition?

I didn't see it in the docs;



On 2/9/11 3:24 PM, Richard Vézina wrote:

Get it to work like this in view.py :

{{=T('block 
access')}}


Thanks Massimo

Is BUTTON helper in trunk??

Richard

On Wed, Feb 9, 2011 at 3:17 PM, Richard Vézina 
mailto:ml.richard.vez...@gmail.com>> wrote:


BUTTON not working, but it works without redirection
with A(T('block access'),_onclick="ajax('%s',[],null);" %
URL('block_access'))... I don't think that it validate with no
_href... With _href='' it seems to point on default/index

Richard


On Wed, Feb 9, 2011 at 2:49 PM, Richard Vézina
mailto:ml.richard.vez...@gmail.com>>
wrote:

BUTTON Helper do not appear in the book actually...

Richard


On Wed, Feb 9, 2011 at 2:29 PM, Massimo Di Pierro
mailto:massimo.dipie...@gmail.com>> wrote:

Replace


block_access=A(T('block
access'),_href=URL(r=request,c='default',
f='block_access'))

with


block_access=BUTTON(T('block
access'),_onclick="ajax('%s',[],null);" %
URL('block_access'))

Mind this will only block login, not users already
logged-in, unless
you also clear session.

On Feb 9, 11:39 am, Richard Vézina
mailto:ml.richard.vez...@gmail.com>>
wrote:
> Hello,
>
> I would create button to block or unblock user access,
so I made those
> function :
>
> def block_access():
> """
> UPDATE auth_user
> SET registration_key='blocked'
> WHERE auth_user.registration_key = ''
>   AND auth_user.email <> 'myem...@mydomain.com
'
> """
> db((db.auth_user.registration_key == '') &
(db.auth_user.email != '
> myem...@mydomain.com
')).update(registration_key='blocked')
> db.commit()
>
> def unblock_access():
> """
> UPDATE auth_user
> SET registration_key=''
> WHERE auth_user.registration_key <> 'pending'
> """
> db(db.auth_user.registration_key !=
> 'pending').update(registration_key='')
> db.commit()
>
> Now I would call those function from a link or a button
from index or admin
> dashboard...
>
> I would know if there is a other way except this :
>
> def index():
> block_access=A(T('block
access'),_href=URL(r=request,c='default',
> f='block_access'))
> unblock_access=A(T('unblock
access'),_href=URL(r=request,c='default',
> f='unblock_access'))
> return dict(block_access=block_access,
unblock_access=unblock_access)
>
> Since I will need to modify the block and unblock
function like this :
>
> def block_access():
> """
> UPDATE auth_user
> SET registration_key='blocked'
> WHERE auth_user.registration_key = ''
>   AND auth_user.email <> 'myem...@mydomain.com
'
> """
> db((db.auth_user.registration_key == '') &
(db.auth_user.email != '
> myem...@mydomain.com
')).update(registration_key='blocked')
> db.commit()
> redirect(URL(r=request,c='default', f='index'))
>
> Is there an other way by not utilising redirection?
>
> Thanks
>
> Richard








Re: [web2py] Re: URL secure flag.

2011-02-09 Thread David J.

So then we would use scheme='https' for secure and forget the secure flag?



On 2/9/11 6:26 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:24 PM, Anthony wrote:
Do we want to handle websocket URLs as well (i.e., ws and wss 
schemes instead of http and https)?


I don't know. Is there an RFC yet?

I've sent Massimo a patch already, but I could redo it to directly 
specify scheme= instead of secure=, and allow an arbitrary string.


Now would be the time...


OK, I made the change. scheme='wss' (for example) works.

scheme=True uses the scheme from request.env





On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell wrote:

On Feb 9, 2011, at 1:24 PM, howesc wrote:
> good, bad, or indifferent, because of varied testing and
deployment setups, and using multiple ports, i have the function
below in my app.  note that i have database configuration for
HTTPS scheme and port.  It's my hack not not run internal test
and development servers on port 443. :)

Thanks. I'd forgotten about port; I'll add that as well.

>
> def full_url(scheme="http",
> a=None,
> c=None,
> f=None,
> r=None,
> args=[],
> vars={},
> anchor='',
> path = None
> ):
> """
> Create a fully qualified URL.  The URL will use the same
host as the
> request was made from, but will use the specified scheme.
 Calls
> C{gluon.html.URL()} to construct the relative path to the
host.
>
> if _port is set in the settings table, append the
port to the
> domain of the created URL
>
> @param scheme: scheme to use for the fully-qualified URL.
>(default to 'http')
> @param a: application (default to current if r is given)
> @param c: controller (default to current if r is given)
> @param f: function (default to current if r is given)
> @param r: request
> @param args: any arguments (optional)
> @param vars: any variables (optional)
> @param anchor: anchorname, without # (optional)
> @param path: the relative path to use.  if used overrides
a,c,f,args, and
>   vars (optional)
> """
> port = ''
> if sitesettings.has_key(scheme+"_port") and
sitesettings[scheme+"_port"]:
> port = ":" + sitesettings[scheme+"_port"]
> if scheme == 'https' and sitesettings.has_key("https_scheme"):
> scheme = sitesettings.https_scheme
> url = scheme +'://' + \
> r.env.http_host.split(':')[0] + port
> if path:
> url = url + path
> else:
> url = url+URL(a=a, c=c, f=f, r=r, args=args,
vars=vars, anchor=anchor)
> return url
>














Re: [web2py] Re: URL secure flag.

2011-02-09 Thread David J.

Is the code available in the repo yet?



On 2/9/11 6:37 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 3:34 PM, David J. wrote:
So then we would use scheme='https' for secure and forget the secure 
flag?


Right. It's a little more general, since 'secure' could also imply 'wss'.





On 2/9/11 6:26 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:54 PM, Jonathan Lundell wrote:

On Feb 9, 2011, at 2:24 PM, Anthony wrote:
Do we want to handle websocket URLs as well (i.e., ws and wss 
schemes instead of http and https)?


I don't know. Is there an RFC yet?

I've sent Massimo a patch already, but I could redo it to directly 
specify scheme= instead of secure=, and allow an arbitrary string.


Now would be the time...


OK, I made the change. scheme='wss' (for example) works.

scheme=True uses the scheme from request.env





On Wednesday, February 9, 2011 5:02:38 PM UTC-5, Jonathan Lundell 
wrote:


On Feb 9, 2011, at 1:24 PM, howesc wrote:
> good, bad, or indifferent, because of varied testing and
deployment setups, and using multiple ports, i have the
function below in my app.  note that i have database
configuration for HTTPS scheme and port.  It's my hack not not
run internal test and development servers on port 443. :)

Thanks. I'd forgotten about port; I'll add that as well.

>
> def full_url(scheme="http",
> a=None,
> c=None,
> f=None,
> r=None,
> args=[],
> vars={},
> anchor='',
> path = None
> ):
> """
> Create a fully qualified URL.  The URL will use the same
host as the
> request was made from, but will use the specified
scheme.  Calls
> C{gluon.html.URL()} to construct the relative path to
the host.
>
> if _port is set in the settings table, append
the port to the
> domain of the created URL
>
> @param scheme: scheme to use for the fully-qualified URL.
>(default to 'http')
> @param a: application (default to current if r is given)
> @param c: controller (default to current if r is given)
> @param f: function (default to current if r is given)
> @param r: request
> @param args: any arguments (optional)
> @param vars: any variables (optional)
> @param anchor: anchorname, without # (optional)
> @param path: the relative path to use.  if used
overrides a,c,f,args, and
>   vars (optional)
> """
> port = ''
> if sitesettings.has_key(scheme+"_port") and
sitesettings[scheme+"_port"]:
> port = ":" + sitesettings[scheme+"_port"]
> if scheme == 'https' and
sitesettings.has_key("https_scheme"):
> scheme = sitesettings.https_scheme
> url = scheme +'://' + \
> r.env.http_host.split(':')[0] + port
> if path:
> url = url + path
> else:
> url = url+URL(a=a, c=c, f=f, r=r, args=args,
vars=vars, anchor=anchor)
> return url
>



















Re: [web2py] custom form without using database?

2011-02-10 Thread David J.


Side Question;
How can you add validators this way?


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

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


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





[web2py] change_password form

2011-02-10 Thread David J.

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

in gluon tools.py

If you see the change_password() function

you see

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

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

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

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

form.formstyle = self.settings.formstyle




[web2py] Gluon tools.py - form style

2011-02-13 Thread David J
The change password and lost password forms are missing the "formstyle "
attribute.

If you look in gluon tools.py you see both methods call the form_factory,
the last line of these 2 methods should be
.",formstyle=self.settings.formstyle)" this way it maintains consistency
between forms.
Please commit to trunk.

Thx.


Re: [web2py] Re: Gluon tools.py - form style

2011-02-14 Thread David J.

Not sure how to do that; If you could tell me so I know for the future.

Thanks.



On 2/14/11 10:38 AM, howesc wrote:

the diff from trunk for what i think this change is attached

david - do you mind adding this as a ticket in google code so that the 
code owners can track it?


thanks,

christian





Re: [web2py] Re: Gluon tools.py - form style

2011-02-14 Thread David J.

Thanks;

I guess someone else added it;

But I will reference this for the future;



On 2/14/11 11:25 AM, villas wrote:

You can add an issue here:
http://code.google.com/p/web2py/issues/list

But search first to make sure not already reported.  In this case I
think it has (~issue 190/191).  I think you can add comments to the
issue,  which is good if you have a suggested fix etc.

On Feb 14, 3:47 pm, "David J."  wrote:

Not sure how to do that; If you could tell me so I know for the future.

Thanks.

On 2/14/11 10:38 AM, howesc wrote:


the diff from trunk for what i think this change is attached
david - do you mind adding this as a ticket in google code so that the
code owners can track it?
thanks,
christian






Re: [web2py] using routes_onerror

2011-02-17 Thread David J.

I did notice one 'race' condition;

If you have an app that has an error in models/db.py

and you have */400 in routes.py your going to continuously be 
redirecting your self to the same page until the browsers own error 
handling kicks in and notifies of the problem;


Because in any page load your going to be throwing a 400 including the 
page you want to be redirect to; Unless of course your redirecting to a 
static page;






On 2/17/11 10:45 AM, Jonathan Lundell wrote:

A couple of questions have come up about routes_onerror in routes.py. 
Refreshing our memory, here's a fragment of routes.example.py:

# Error-handling redirects all HTTP errors (status codes>= 400) to a specified
# path.  If you wish to use error-handling redirects, uncomment the tuple
# below.  You can customize responses by adding a tuple entry with the first
# value in 'appName/HTTPstatusCode' format. ( Only HTTP codes>= 400 are
# routed. ) and the value as a path to redirect the user to.  You may also use
# '*' as a wildcard.
#
# The error handling page is also passed the error code and ticket as
# variables.  Traceback information will be stored in the ticket.
#
# routes_onerror = [
# (r'init/400', r'/init/default/login')
#,(r'init/*', r'/init/static/fail.html')
#,(r'*/404', r'/init/static/cantfind.html')
#,(r'*/*', r'/init/error/index')
# ]

If you want to follow along in the source, this is used by 
rewrite.try_redirect_on_error, which is called at the end of a request by 
main.wsgibase.

One thing I just noticed from looking at the path through the source is that, if the 
incoming URL doesn't conform to the main URL regex (and I'm talking about 
"normal" URL handling here, not the new URL router), routes_onerror is used 
when request.application is still set to None, which is now it's initialized. The status 
code will be 400.

So if you want routes_onerror to be effective in this case, you'll need to have 
at least one entry with the application field set to '*' or to 'None' (the 
string representation of the None object).

   'init/400', ...
   'init/404', ...
   'None'/400' ...

Unless you have a specific reason not to, it's probably best to have a '*/*' 
catch-all case at the end as well. You never know...

I'll be looking over the new router code with this in mind, but it's likely 
similar in operation.




Re: [web2py] Subclass navbar() ?

2011-02-21 Thread David J
You only have to override the methods you want to override.
On Feb 20, 2011 11:43 PM, "pbreit"  wrote:
> I can't seem to figure out the correct way to subclass navbar(). Does this

> look close?
>
> === db.y ==
> from gluon.tools import *
>
> class MyAuth(Auth):
>
> def __init__(self, environment, db):
> pass
>
> def navbar(self,prefix='Welcome',action=None):
> ...
> return bar
>
> auth = MyAuth(globals(),db)
>
>


Re: [web2py] Subclass navbar() ?

2011-02-21 Thread David J
Sorry didn't see it was answered. I apologize.
On Feb 21, 2011 4:02 PM, "David J"  wrote:
> You only have to override the methods you want to override.
> On Feb 20, 2011 11:43 PM, "pbreit"  wrote:
>> I can't seem to figure out the correct way to subclass navbar(). Does
this
>
>> look close?
>>
>> === db.y ==
>> from gluon.tools import *
>>
>> class MyAuth(Auth):
>>
>> def __init__(self, environment, db):
>> pass
>>
>> def navbar(self,prefix='Welcome',action=None):
>> ...
>> return bar
>>
>> auth = MyAuth(globals(),db)
>>
>>


Re: [web2py] Dreampie as web2py shell

2011-02-21 Thread David J
Can't you just view the source if web2py.py in root directory? I would
imagine if you add that if you add that to your python_path as well as all
gluon you could accomplish that.
On Feb 21, 2011 2:54 PM, "Bruno Rocha"  wrote:
> Hi,
>
> I am trying to use DreamPie [ http://dreampie.sourceforge.net/ ] as web2py
> shell, but $dreampie from command line does not have the ability to catch
> command line arguments.
>
> Is there a trick to get it working with django
> http://www.roryhart.net/code/django-and-dreampie/ and I am wondering how
can
> I do the same with web2py ?
>
> Anybody knows how to start web2py environment form python console? (not
O.S
> console)
>
> --
> Bruno Rocha
> [ About me: http://zerp.ly/rochacbruno ]


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] Log the user out

2011-03-01 Thread David J.

Ed you have to use session.flash;

Anytime you redirect your not in request scope anymore so request.flash 
wont help;




On 3/1/11 2:12 PM, Ed Greenberg wrote:

At the end of my controller function, I'd like to log the user out and
send him back to the login screen, hopefully with a response.flash on
the screen.

I've tried several things, none of which work.

I tried sending him to URL(c='default',f='user',args=('logout')) which
got close. One was summarily dropped to the home page, with no
feedback as to how one got there.

Any suggestions?





[web2py] Socket Error Using FCGI;

2011-03-03 Thread David J.

Traceback (most recent call last):
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 664, in run
self.process_input()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 700, in 
process_input

self._do_params(rec)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 799, in 
_do_params

self._start_request(req)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 783, in 
_start_request

req.run()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 592, in run
self._flush()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 599, in 
_flush

self.stdout.close()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 358, in 
close

self._conn.writeRecord(rec)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 715, in 
writeRecord

rec.write(self._sock)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 552, in 
write

self._sendall(sock, header)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 529, in 
_sendall

sent = sock.send(data)
socket.error: [Errno 32] Broken pipe
Unhandled exception in thread started by >

Traceback (most recent call last):
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 664, in run
self.process_input()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 700, in 
process_input

self._do_params(rec)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 799, in 
_do_params

self._start_request(req)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 783, in 
_start_request

req.run()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 592, in run
self._flush()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 599, in 
_flush

self.stdout.close()
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 358, in 
close

self._conn.writeRecord(rec)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 715, in 
writeRecord

rec.write(self._sock)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 552, in 
write

self._sendall(sock, header)
  File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 529, in 
_sendall

sent = sock.send(data)
socket.error: [Errno 32] Broken pipe



Re: [web2py] Re: Socket Error Using FCGI;

2011-03-03 Thread David J.

I'll watch it;

It seems like the server is hanging for bit;

I see it in the console as I am running

python fcgihandler.py &

so I guess when that exception is thrown it writes to the console;



On 3/3/11 4:42 PM, Massimo Di Pierro wrote:

How often? is this occasional? reproducible? Do you find it in the
logs or bothers users?

On Mar 3, 3:29 pm, "David J."  wrote:

Traceback (most recent call last):
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 664, in run
  self.process_input()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 700, in
process_input
  self._do_params(rec)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 799, in
_do_params
  self._start_request(req)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 783, in
_start_request
  req.run()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 592, in run
  self._flush()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 599, in
_flush
  self.stdout.close()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 358, in
close
  self._conn.writeRecord(rec)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 715, in
writeRecord
  rec.write(self._sock)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 552, in
write
  self._sendall(sock, header)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 529, in
_sendall
  sent = sock.send(data)
socket.error: [Errno 32] Broken pipe
Unhandled exception in thread started by>
Traceback (most recent call last):
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 664, in run
  self.process_input()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 700, in
process_input
  self._do_params(rec)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 799, in
_do_params
  self._start_request(req)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 783, in
_start_request
  req.run()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 592, in run
  self._flush()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 599, in
_flush
  self.stdout.close()
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 358, in
close
  self._conn.writeRecord(rec)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 715, in
writeRecord
  rec.write(self._sock)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 552, in
write
  self._sendall(sock, header)
File "/apps/web/web2py/gluon/contrib/gateways/fcgi.py", line 529, in
_sendall
  sent = sock.send(data)
socket.error: [Errno 32] Broken pipe




Re: [web2py] Re: python tutorial video

2011-03-09 Thread David J.
No it not ok: I dont think that will be Massimo's intention; When he 
releases the update it will kept a BIG secret and he will not notify 
anyone; as he usually does!


Only kidding; you will be the first to know!



On 3/9/11 11:42 AM, Vinicius Assef wrote:

Let us know when new version will be available, ok?


On Wed, Mar 9, 2011 at 9:43 AM, Massimo Di Pierro
  wrote:

will fix typos, change music and redo it.

On Mar 8, 4:10 pm, Stefaan Himpe  wrote:

   My suggestion ->Konstantin Scherbakov, maybe


Liszt's transcriptions of Beethoven symphonies for the Piano

His Lyapunov etudes are well worth listening to as well :)




Re: [web2py] Mint 9 and Python2.7

2011-03-14 Thread David J.

Strange I just ran python 2.7 and it worked for me...



On 3/14/11 6:54 PM, Erik Vandamme wrote:

I've just downloaded both Python2.7 (and installed it) and Web2Py,
then tried the python2.7 web2py.py -h and it says: it requires 2.5. or
2.6
under 2.6 nothing much more happens





Re: [web2py] Re: video about new RESTful APIs

2011-03-17 Thread David J.
For clarification; This gets put in the model code not controller code 
correct?


So for example in "db.py"

Thanks.



On 3/17/11 3:58 PM, Massimo Di Pierro wrote:

This is now in trunk. Some API changes are still possible.

Right now it supports fiels of type, id, integer, double, date,
datetime, time, boolean, reference, list and string fields with "slug"
in the name.

If you have a model like this

db.define_table('person',Field('name'),Field('birthdate','date'),Field('age','integer'),Field('married','boolean'),Field('tags','list:string'))
db.define_table('dog',Field('name'),Field('owner',db.person),Field('info','text'))

simply add this to your model

@request.restful()
def api():
 def GET(*args,**vars):
 parsed = db.parse_as_rest('auto',args,vars)
 if parsed.status==200: return dict(content=parsed.response)
 raise HTTP(parsed.status,parsed.error)
 return locals()

and it will expose APIs like

/yourapp/default/api/person/id/5
/yourapp/default/api/person/married/true
/yourapp/default/api/person/birthdate/2008
/yourapp/default/api/person/age/10/30 # notice it is a range
/yourapp/default/api/person/id/5/name # notice a field
/yourapp/default/api/person/id/5/dog  # notice a reference (his
dogs)

Here is a complete list of the APIs automatically generated.

/person/id/{person.id}
/person/id/{person.id}/:field
/person/id/{person.id}/dog[dog.owner]
/person/id/{person.id}/dog[dog.owner]/id/{dog.id}
/person/id/{person.id}/dog[dog.owner]/id/{dog.id}/:field
/person/id/{person.id}/dog[dog.owner]/owner/{dog.owner}
/person/id/{person.id}/dog[dog.owner]/owner/{dog.owner}/:field
/person/name/dog[dog.owner]
/person/name/dog[dog.owner]/id/{dog.id}
/person/name/dog[dog.owner]/id/{dog.id}/:field
/person/name/dog[dog.owner]/owner/{dog.owner}
/person/name/dog[dog.owner]/owner/{dog.owner}/:field
/person/birthdate/{person.birthdate.year}
/person/birthdate/{person.birthdate.year}/:field
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}
/person/birthdate/{person.birthdate.year}/
{person.birthdate.month}/:field
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}/:field
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}/dog[dog.owner]
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}/dog[dog.owner]/id/{dog.id}
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}/dog[dog.owner]/id/{dog.id}/:field
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}/dog[dog.owner]/owner/{dog.owner}
/person/birthdate/{person.birthdate.year}/{person.birthdate.month}/
{person.birthdate.day}/dog[dog.owner]/owner/{dog.owner}/:field
/person/age/{person.age.ge}/{person.age.lt}
/person/age/{person.age.ge}/{person.age.lt}/:field
/person/age/{person.age.ge}/{person.age.lt}/dog[dog.owner]
/person/age/{person.age.ge}/{person.age.lt}/dog[dog.owner]/id/{dog.id}
/person/age/{person.age.ge}/{person.age.lt}/dog[dog.owner]/id/
{dog.id}/:field
/person/age/{person.age.ge}/{person.age.lt}/dog[dog.owner]/owner/
{dog.owner}
/person/age/{person.age.ge}/{person.age.lt}/dog[dog.owner]/owner/
{dog.owner}/:field
/person/married/{person.married}
/person/married/{person.married}/:field
/person/married/{person.married}/dog[dog.owner]
/person/married/{person.married}/dog[dog.owner]/id/{dog.id}
/person/married/{person.married}/dog[dog.owner]/id/{dog.id}/:field
/person/married/{person.married}/dog[dog.owner]/owner/{dog.owner}
/person/married/{person.married}/dog[dog.owner]/owner/
{dog.owner}/:field
/person/tags/{person.tags.contains}
/person/tags/{person.tags.contains}/:field
/person/tags/{person.tags.contains}/dog[dog.owner]
/person/tags/{person.tags.contains}/dog[dog.owner]/id/{dog.id}
/person/tags/{person.tags.contains}/dog[dog.owner]/id/{dog.id}/:field
/person/tags/{person.tags.contains}/dog[dog.owner]/owner/{dog.owner}
/person/tags/{person.tags.contains}/dog[dog.owner]/owner/
{dog.owner}/:field
/dog/id/{dog.id}
/dog/id/{dog.id}/:field
/dog/owner/{dog.owner}
/dog/owner/{dog.owner}/:field

You can cut and paste the output of

/yourapp/default/api/patterns

back in the code as patterns and change them.


You can disable some by making the corresponding fields readable=False
in the api action.

Hope this is useful. Please send comments.


On Mar 16, 6:32 pm, Massimo Di Pierro
wrote:

http://vimeo.com/21133657




Re: [web2py] How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread David J.


Look at the routes; you can do this;

Chapter 4 of the book.


On 3/22/11 2:12 PM, Keith Pettit wrote:
Web2py works great for me through Apache and mod_wsgi.  All seems fast 
and clean.  But now that I'm creating multiple web2py applications. 
 How can I deploy multiple web2py applications as separate virtualhosts?


Basically I want to do something like:

app1.mydomain.com goes to App1
app2.mydomain.com goes to App2
etc

Normally in Apache I would create separate virtualhost directives and 
point them to the directory where the code is.  But I wasn't sure how 
to do that with web2py without copying the entire web2py directory and 
renaming the application I want to show as "init".  What's the best 
way to do things when you need to update code and develop frequently?


Thanks,





Re: [web2py] Re: How do I set web2py applications as separate virtualhosts?

2011-03-22 Thread David J.

Look at the routes.py in chapter 4 of the book.

I just did it this morning and it work using the that latest version of 
web2py


(Know that you have to name the file routes.py even though its in the 
router.py.example; and you might think to name it router.py and thus 
think it does not work.)


I think it says in the book it is interchangeable;




On 3/22/11 2:17 PM, Ross Peoples wrote:

I tried this once and it failed terribly. I would also like to know
how this would work.

On Mar 22, 6:12 pm, Keith Pettit  wrote:

Web2py works great for me through Apache and mod_wsgi.  All seems fast and
clean.  But now that I'm creating multiple web2py applications.  How can I
deploy multiple web2py applications as separate virtualhosts?

Basically I want to do something like:

app1.mydomain.com goes to App1
app2.mydomain.com goes to App2
etc

Normally in Apache I would create separate virtualhost directives and point
them to the directory where the code is.  But I wasn't sure how to do that
with web2py without copying the entire web2py directory and renaming the
application I want to show as "init".  What's the best way to do things when
you need to update code and develop frequently?

Thanks,




Re: [web2py] static subdirectories

2011-03-22 Thread David J.

The former is semantically more correct;

$user/app/controller/etc...

It seems the domain is obviously the root of any app; then the "user" 
selected name should be the next logical level; then any functions that 
user has access to should be listed;




On 3/22/11 2:12 PM, pbreit wrote:

Would there be any way to support something like:

/$user/app/controller/function

Where $user is available to controllers as some sort of arg?

I could see your idea about re-formatting the URL to: 
/app/controller/function/$user but am wondering if that will be hard 
to manage?




Re: [web2py] IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread David J.

I suppose to override;

The example you gave would be pointless to have both;

Clearly if you define it once at the model; then again in the controller;

shouldn't the one define in the controller take precedence;

How else would you override?



On 3/23/11 11:45 AM, Jaunx wrote:

In Example 29 of the "Database Examples" of the Quick Examples
tutorial, the last line of the model definition file (db.py) puts the
following constraint on the purchases.quantity field:

   db.purchases.quantity.requires=IS_INT_IN_RANGE(0,10)

In Example 33, the controller for the purchase form (forth line of the
buy method in database_examples.py) defines the following constraint
on the quantity:


TR("Quantity:",INPUT(_type="text",_name="quantity",requires=IS_INT_IN_RANGE(1,100))),

When you actually test the example application, the form accepts
values between 1 and 99 inclusive and the database is updated with the
appropriate value.

What is the point of the constraint in the model definition if it is
not enforced?  Seems like the model would be the ideal place to set
this constraint so that it doesn't need to be repeated for every form
that uses it.  However it would be nice to be able to override the
default per form if necessary.





Re: [web2py] Re: Lacking nginx deployment guide

2011-03-26 Thread David J.

I don't know about running web2py using uwsgi;

However;

When I run web2py with nginx I use the fastcgi module;

I configure nginx like described in the stackoverflow article;

except I use fastcgi;

In nginx config I have

location / {
include fascgi_params;
fastcgi_pass unix:/tmp/fcgi.sock

}

then go to web2py root and run the python fastcgihandler.py script;

The caveat is that you have to change the permissions on the 
/tmp/fcgi.sock file because when web2py runs it; its run under the user 
that started the process;


so you do

chown nginx:nginx /tmp/fcgi.sock

and then your done;

You wont get and 502 errors or anything; its really quite simple;

I am not sure if the uwsgi implementation is better as I am trying that 
tonight; but fastcgi has be running very stable for the past few months.


I apologize for the lack of detailed instructions (I am not in front of 
the configs) but if you have any questions I can look into it further 
and try to help.


Thanks.



On 3/26/11 6:04 PM, LightOfMooN wrote:

Hi
I follow this guide 
http://stackoverflow.com/questions/5335153/how-to-deply-web2py-using-nginx
I have ubuntu 10.4 + nginx + web2py, installed in var

And the result is 502 Bad Gateway.
Any suggestions?





[web2py] dashes in url

2011-03-31 Thread David J.

Seeing that using a "-" in function names is invalid in python;

I was wondering how I define in my controller "get-started" url;

If I define in my controller

def get-started():
 return dict()

Its invalid; so I have to maybe use routes.py to rewrite it to just 
getstarted()?


Is this the right approach;

Thanks


Re: [web2py] Re: dashes in url

2011-03-31 Thread David J.

Thanks I will try that;

I get invalid request; but I will check again; perhaps I have a typo.



On 3/31/11 10:31 AM, Ross Peoples wrote:
web2py will automatically convert dashes to underscores for the 
function names, so:


getting-started

will become:

def getting_started():
return dict()




Re: [web2py] Re: dashes in url

2011-03-31 Thread David J.

I checked this;

I am using trunk;

I am defining

def get_started():
 return dict()

def features():
 return dict()


when I call /app/default/get-started

I get invalid request;

when I call

/app/default/features

It works perfectly;

Maybe a bug?

On 3/31/11 10:31 AM, Ross Peoples wrote:
web2py will automatically convert dashes to underscores for the 
function names, so:


getting-started

will become:

def getting_started():
return dict()




Re: [web2py] Re: dashes in url

2011-03-31 Thread David J.

I missed that

calling app/default/get_started

works also;



On 3/31/11 10:31 AM, Ross Peoples wrote:
web2py will automatically convert dashes to underscores for the 
function names, so:


getting-started

will become:

def getting_started():
return dict()




Re: [web2py] Re: dashes in url

2011-03-31 Thread David J
Thanks I will rename router.py.example to routes.py in the web 2 py root and
then I can also make a copy in my app to do specific routing?
On Mar 31, 2011 10:58 AM, "Jonathan Lundell"  wrote:
> On Mar 31, 2011, at 7:46 AM, David J. wrote:
>>
>> I missed that
>>
>> calling app/default/get_started
>>
>> works also;
>
> The hyphen-underscore translation works only if you're running the new
router.
>
>>
>>
>>
>> On 3/31/11 10:31 AM, Ross Peoples wrote:
>>> web2py will automatically convert dashes to underscores for the function
names, so:
>>>
>>> getting-started
>>>
>>> will become:
>>>
>>> def getting_started():
>>> return dict()
>>
>
>


Re: [web2py] Re: routing maps underscore to hyphens

2011-03-31 Thread David J.


That is correct; you can not use a hyphen in a python function name.

On 3/31/11 12:18 PM, VP wrote:

I am curious.  I don't think people can define Python functions
(controllers) that have hyphens.  Right?  If their controllers can not
have hyphens, then why would web2py have to worry about mapping
hyphens to underscores in function names(which appears to have
undesirable side effects)?


On Mar 31, 10:06 am, Jonathan Lundell  wrote:

On Mar 30, 2011, at 11:35 PM, pbreit wrote:


Perhaps at least it can be fixed to accept hyphens in the app name? The only 
problem is with function names, correct?

I'm pretty sure that controller names are a problem, too, and I'm not certain 
about application names.

Function names are the most obvious problem, because they're directly used as 
Python identifiers. But application and controller names get used in a variety 
of ways (not just as file names), so I've been wary of allowing them.

The new router allows more than the old system did (even without the regex 
router enabled).

If you want to experiment with it, in the new router you can redefine the 
parameter acfe_match, which is used to validate a/c/f. By default it's r'\w+$'; 
try setting it to r'[\w\-]+$' instead, and be sure to set map_hyphen=False.

If you do experiment, be sure to try compiling an app and running the compiled 
version.




Re: [web2py] Re: dashes in url

2011-03-31 Thread David J.

It is optional; read the router.py docs.

Jonathan mentioned that in his post.



On 3/31/11 12:24 PM, VP wrote:

Unless I misunderstand the issue at hand here, seriously, I do not
think this is web2py's scope to do this automatic mapping hyphens or
dashes to underscores.

Hyphen/dash is a minus sign.  You can't define a Python variable or
function that has a hyphen/dash.  It's syntactically incorrect.  I do
not think it's web2py's place to automatically fix this syntactical
error.   (For one thing, it seems the side effect of this is that
underscores are automatically converted to hyphens, which is clearly
undesirable).

Perhaps, the best thing is letting people turn on this mapping
optionally.



On Mar 31, 9:31 am, Ross Peoples  wrote:

web2py will automatically convert dashes to underscores for the function
names, so:

getting-started

will become:

def getting_started():
 return dict()




[web2py] Setting secure in A

2011-03-31 Thread David J.

A while back I inquired about adding scheme to URL;
It works great; Thank you;

I was wondering if it could be added to 'A()' as well;
(Unless I missed something in the docs; I need to set scheme to 'https';)

I think this is important; For example in Auth() there is a helper 
method call 'navbar()'


This helper method outputs the links for 'Login, Register and Lost 
Password';
This method uses A() to define the links; I would like to define the 
register and login links in 'https'


Thanks in advance for any ideas.




[web2py] Re: Setting secure in A

2011-03-31 Thread David J.

I made a mistake it is defined in the 'action' parameter;



On 3/31/11 3:12 PM, David J. wrote:

A while back I inquired about adding scheme to URL;
It works great; Thank you;

I was wondering if it could be added to 'A()' as well;
(Unless I missed something in the docs; I need to set scheme to 'https';)

I think this is important; For example in Auth() there is a helper 
method call 'navbar()'


This helper method outputs the links for 'Login, Register and Lost 
Password';
This method uses A() to define the links; I would like to define the 
register and login links in 'https'


Thanks in advance for any ideas.






Re: [web2py] Re: MongoDB and Web2Py

2011-04-01 Thread David J.

While DAL might not support MongDB; you can still use it via mongoengine;




On 4/1/11 10:41 AM, Marcel Luethi wrote:

Despite a lot of time, I'd like to help as well.
MongoDB looks promising.




On 1 Apr., 04:58, Massimo Di Pierro
wrote:

Lots of people asked for support but nobody volunteered to help test
it.
If you are interested and can help with some regular tests we can make
it work in relatively short time.

Massimo

On Mar 31, 9:09 pm, luckysmack  wrote:








I have read a few older messages about mongoDB being made to work with
the DAL. But they all seem to be pretty dated and have not specified
what was working and what wasnt. massimo menitoned that it may be
ready by january of this year. But under the supported list it wasnt
listed. So im just curious as to what the status of using mongoDB is
with web2py and if anyone has a basic example on how I would use it.
Thanks




Re: [web2py] Re: MongoDB and Web2Py

2011-04-04 Thread David J.


Thanks Massimo;

I never thought to even try this;
I will make a sample project and test this;
(For me the other way works; so I wouldn't ask that you implement it in 
DAL; (but I am happy to test it;)


Thanks for your great software.

David.





On 4/4/11 9:24 AM, Massimo Di Pierro wrote:

DAL allows to do:

db=DAL('mongodb://127.0.0.1:5984/db')

it allows to define_table and allows db.table.insert(...) other
methods have not been implemented because the above was never tested.
If you help us with testing I can implement the other methods (select,
count, update).

On Apr 1, 9:55 am, "David J."  wrote:

While DAL might not support MongDB; you can still use it via mongoengine;

On 4/1/11 10:41 AM, Marcel Luethi wrote:








Despite a lot of time, I'd like to help as well.
MongoDB looks promising.
On 1 Apr., 04:58, Massimo Di Pierro
wrote:

Lots of people asked for support but nobody volunteered to help test
it.
If you are interested and can help with some regular tests we can make
it work in relatively short time.
Massimo
On Mar 31, 9:09 pm, luckysmackwrote:

I have read a few older messages about mongoDB being made to work with
the DAL. But they all seem to be pretty dated and have not specified
what was working and what wasnt. massimo menitoned that it may be
ready by january of this year. But under the supported list it wasnt
listed. So im just curious as to what the status of using mongoDB is
with web2py and if anyone has a basic example on how I would use it.
Thanks




Re: [web2py] New Slice: Create a Form Wizard

2011-04-04 Thread David J.

Just one issue;

On step 2 it asks for email again;

But email was already filled in...

But the data is not in the form;

Either the filed should be removed or the data should be there;

The data does appear if you submit the form even if it is blank.



On 4/4/11 4:06 PM, Bruno Rocha wrote:


I Just forked a post[0] in to a slice[1]

[0] http://motanet.com.br/python/form-wizard-com-web2py/

[1] http://web2pyslices.com/main/slices/take_slice/127



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





[web2py] Attribute Error

2011-04-10 Thread David J.

In my controller I am defining a class

class  Employee:
pass

john  =  Employee()  # Create an empty employee record

# Fill the fields of the record
john.name  =  'John Doe'
john.dept  =  'computer lab'
john.salary  =  1000

and in my view

I am trying {{=employee.name}}

It throws an attribute exception

'p23 S'("name \'name\' is not defined",)'


I am using trunk version; Perhaps I am doing something wrong.

Thanks.




[web2py] Re: Attribute Error - Passing Objects to View (Exception)

2011-04-10 Thread David J.
Sorry I would like to be a little more clear about what I am trying to 
accomplish;


I am trying to pass an object to the view;

I have this 'Employee' class listed below;

when I try creating alit of employees; and sending that list to he view;

I cant seem to output properties; for example {{= employee.name }}

I am not sure if this is the right way to achieve this;

I am tried a few variations such as defining  the attributes in the 
class rather than making it empty.


I am not sure what else to try;

Could anyone please guide me as to the right way to achieve this.

Thank you.

David.


On 4/10/11 5:53 AM, David J. wrote:

In my controller I am defining a class

class  Employee:
pass

john  =  Employee()  # Create an empty employee record

# Fill the fields of the record
john.name  =  'John Doe'
john.dept  =  'computer lab'
john.salary  =  1000

and in my view

I am trying {{=employee.name}}

It throws an attribute exception

'p23 S'("name \'name\' is not defined",)'


I am using trunk version; Perhaps I am doing something wrong.

Thanks.






Re: [web2py] Re: Attribute Error

2011-04-10 Thread David J.

I am passing a list of employees

so in my view I have

{{ for n in employees:}

{{= n.name }}

{{pass}}

On 4/10/11 9:10 AM, DenesL wrote:


On Apr 10, 5:53 am, "David J."  wrote:

In my controller I am defining a class

class  Employee:
  pass

john  =  Employee()  # Create an empty employee record

# Fill the fields of the record
john.name  =  'John Doe'
john.dept  =  'computer lab'
john.salary  =  1000

and in my view

I am trying {{=employee.name}}

How are you setting employee?.


It throws an attribute exception

'p23 S'("name \'name\' is not defined",)'

I am using trunk version; Perhaps I am doing something wrong.

Thanks.




Re: [web2py] web2py posterity and mail man

2011-04-29 Thread David J.

Please check out experts4solutions.com for commercial projects.


On 4/29/11 7:27 AM, yarden...@gmail.com wrote:

Hi

I need someone to help us setup on an Amazon web Services micro
instance

1. web2py
2. mysql
3, postifx
4. posterity
5. mailman

Will need to embed posterity and mailman into web2py

Will need to permit user to backup 1, some or all email in posterity
to HDD or S3.

Let us know if you can or know someone who can help us

Thanks






Re: [web2py] Re: MongoDBAdapter -- in DAL

2011-05-04 Thread David J.

Is this in trunk;

I will start a new project today and use Mongo For DB

I think I tried it last month and I had some problems; I didnt have the 
time to look into it.


I will update and try again.

Thanks.

On 5/4/11 9:30 AM, Massimo Di Pierro wrote:

fixing it now. Looks like not many people testing it. :-)

On May 3, 9:56 pm, joseph simpson  wrote:

The current dal.py file contains the following code, between lines
3381 and 3404:

ADAPTERS = {
 'sqlite': SQLiteAdapter,
 'sqlite:memory': SQLiteAdapter,
 'mysql': MySQLAdapter,
 'postgres': PostgreSQLAdapter,
 'oracle': OracleAdapter,
 'mssql': MSSQLAdapter,
 'mssql2': MSSQL2Adapter,
 'db2': DB2Adapter,
 'informix': InformixAdapter,
 'firebird': FireBirdAdapter,
 'firebird_embedded': FireBirdAdapter,
 'ingres': IngresAdapter,
 'ingresu': IngresUnicodeAdapter,
 'sapdb': SAPDBAdapter,
 'jdbc:sqlite': JDBCSQLiteAdapter,
 'jdbc:sqlite:memory': JDBCSQLiteAdapter,
 'jdbc:postgres': JDBCPostgreSQLAdapter,
 'gae': GoogleDatastoreAdapter, # discouraged, for backward
compatibility
 'google:datastore': GoogleDatastoreAdapter,
 'google:sql': GoogleSQLAdapter,
 'couchdb': CouchDBAdapter,
 'mongodb': CouchDBAdapter,

}

The last line:
   'mongodb': CouchDBAdapter,

Maybe should be ---  'mongodb': MongoDBAdapter,




Re: [web2py] Re: MongoDBAdapter -- in DAL

2011-05-04 Thread David J.

Ahh; Ok;

Perhaps I will use MongEngine for now and then come back to DAL once we 
have time for it;


I think its not worth your time to build in support for something not so 
many people are using;


Besides anyone can use MongoEngine with Web2py without much difficulty;

I did some simple tests before just to see; I am going to spend more 
time with it now and see what problems I run into;


Thanks.






On 5/4/11 10:30 AM, Massimo Di Pierro wrote:

mongodb with DAL does not currently work but, if you help with tests,
we could make it work


On May 4, 8:56 am, "David J."  wrote:

Is this in trunk;

I will start a new project today and use Mongo For DB

I think I tried it last month and I had some problems; I didnt have the
time to look into it.

I will update and try again.

Thanks.

On 5/4/11 9:30 AM, Massimo Di Pierro wrote:








fixing it now. Looks like not many people testing it. :-)
On May 3, 9:56 pm, joseph simpsonwrote:

The current dal.py file contains the following code, between lines
3381 and 3404:
ADAPTERS = {
  'sqlite': SQLiteAdapter,
  'sqlite:memory': SQLiteAdapter,
  'mysql': MySQLAdapter,
  'postgres': PostgreSQLAdapter,
  'oracle': OracleAdapter,
  'mssql': MSSQLAdapter,
  'mssql2': MSSQL2Adapter,
  'db2': DB2Adapter,
  'informix': InformixAdapter,
  'firebird': FireBirdAdapter,
  'firebird_embedded': FireBirdAdapter,
  'ingres': IngresAdapter,
  'ingresu': IngresUnicodeAdapter,
  'sapdb': SAPDBAdapter,
  'jdbc:sqlite': JDBCSQLiteAdapter,
  'jdbc:sqlite:memory': JDBCSQLiteAdapter,
  'jdbc:postgres': JDBCPostgreSQLAdapter,
  'gae': GoogleDatastoreAdapter, # discouraged, for backward
compatibility
  'google:datastore': GoogleDatastoreAdapter,
  'google:sql': GoogleSQLAdapter,
  'couchdb': CouchDBAdapter,
  'mongodb': CouchDBAdapter,
}
The last line:
'mongodb': CouchDBAdapter,
Maybe should be ---  'mongodb': MongoDBAdapter,




Re: [web2py] Re: Install sqlite3 driver for web2py

2011-05-04 Thread David J.

I am having the same issue;

I think it is the python installation

you can try on yours 'easy_install pysqlite'

providing you have setuptools installed

I am trying to rebuild my python from SRC.

Not on solaris; Redhat.




On 5/4/11 5:10 PM, PlanetUnknown wrote:

Interesting..
On a plain python shell when I do "import sqlite3" I get ->

"File "/var/opt/python2.6.2/usr/local/lib/python2.6/sqlite3/
dbapi2.py", line 27, in
 from _sqlite3 import *
ImportError: No module named _sqlite""

Something wrong with the python installation itself ?

On May 4, 5:03 pm, PlanetUnknown  wrote:

Now I see that sqlite does come with python-2.6.2.
I do see "../usr/local/lib/python2.6/sqlite3" directory inside by
python installation.
Wonder why web2py doesn't see it.

I'm on Solaris 10

On May 4, 4:46 pm, PlanetUnknown  wrote:








I'm using python-2.6.2 and the latest stable web2py.
When I start web2py, it says :

Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.95.1 (2011-04-25 15:04:14)
Database drivers available: pymysql
Starting hardcron...

Which I think means that it only has the driver for MySQL and nothing
else.
How do I install the driver for sqlite3 ?




[web2py] New Exception in Trunk.

2011-05-18 Thread David J.

I just upgraded my trunk;

I get this exception

S"('define_table argument is not a Field or Table: .first_name',)"

Any ideas?


[web2py] Re: New Exception in Trunk.

2011-05-18 Thread David J.

More Info...

S'Traceback (most recent call last):\n  File 
"/apps/www/web2py.trunk/gluon/restricted.py", line 184, in 
restricted\nexec ccode in environment\n  File 
"/apps/www/web2py.trunk/applications/app/models/db.py", line 92, in 
\nauth.define_tables()   # creates 
all needed tables\n  File "/apps/www/web2py.trunk/gluon/tools.py", line 
1179, in define_tables\nformat=\'%(first_name)s %(last_name)s 
(%(id)s)\')\n  File "/apps/www/web2py.trunk/gluon/dal.py", line 4089, in 
define_table\nlimits = 
(int(vars.get(\'min\',0)),int(vars.get(\'max\',1000)))\n  File 
"/apps/www/web2py.trunk/gluon/dal.py", line 4392, in __init__\n
\'define_table argument is not a Field or Table: %s\' % 
field\nSyntaxError: define_table argument is not a Field or Table: table>.first_name\n'

p6516


On 5/18/11 10:48 AM, David J. wrote:

I just upgraded my trunk;

I get this exception

S"('define_table argument is not a Field or Table: table>.first_name',)"


Any ideas?




  1   2   3   >