Re: [web2py] web2py Newbie

2020-02-09 Thread Lovedie JC
Probably your default python is 2.7. You need to download the latest
Web2py. Use python 3 since we are moving from python 2.7
For example, in terminal use :
>>cd web2py
Then once in the folder:
>>python3 web2py.py
Support for python 2.7 ended.
Regards

On Mon, Feb 10, 2020, 08:58 Tim Polimeni  wrote:

> Hello, I am new to web2py I am looking forward to hitting the ground and
> get running with this cool tool. Im fairly new to python and know prel good
> enough to be dangerous. Im here to ask is my current server is running both
> python 3 and python 2. When reaching the welcome site for my server, I see
> that it show python 2.7 opposed to python 3. Can anyone help me out on how
> to point web2py to the most recent version of python?
>
>
> Version
>
> 2.18.5-stable+timestamp.2019.04.08.04.22.03
> (Running on Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_wsgi/3.4
> Python/2.7.5 PHP/7.3.14 mod_apreq2-20090110/2.8.0 mod_perl/2.0.11
> Perl/v5.16.3, Python 2.7.5)
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/e9d57ddb-5926-4ee8-a349-ae8f4a419ed4%40googlegroups.com
> 
> .
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAAcHJF8ugqjQxUnUPQ2qPK_u%2Bp-ecZfu_zrztx%3DDa-9erV6O4A%40mail.gmail.com.


[web2py] web2py Newbie

2020-02-09 Thread Tim Polimeni
Hello, I am new to web2py I am looking forward to hitting the ground and 
get running with this cool tool. Im fairly new to python and know prel good 
enough to be dangerous. Im here to ask is my current server is running both 
python 3 and python 2. When reaching the welcome site for my server, I see 
that it show python 2.7 opposed to python 3. Can anyone help me out on how 
to point web2py to the most recent version of python?


Version

2.18.5-stable+timestamp.2019.04.08.04.22.03
(Running on Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_wsgi/3.4 
Python/2.7.5 PHP/7.3.14 mod_apreq2-20090110/2.8.0 mod_perl/2.0.11 
Perl/v5.16.3, Python 2.7.5)

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/e9d57ddb-5926-4ee8-a349-ae8f4a419ed4%40googlegroups.com.


[web2py] Newbie question about github / trunk

2017-06-21 Thread Karoly Kantor
I raised an issue in github about Google Cloud SQL ( 
https://github.com/web2py/web2py/issues/1613 ), and I received a request to 
test the new code in trunk. I have never used trunk and I have no idea 
where to find it, can someone point me to the right direction, please?

Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Newbie to Web2Py...Integration with Bootstrap3...PyCharm How-To's

2017-05-13 Thread 'Christopher' via web2py-users
Greetings,

I'm a WEB2PY newbie and I'm looking to quickly prototype a web application.

I'm hoping to use http://www.layoutit.com/ with Bootstrap 3 for the page 
design.

I'm going through the training videos on the Web2Py site now to get up to 
speed.

I have a few questions...

*1.*  Are there any issues with Web2Py and Bootstrap 3 (using LayoutIt.com) 
that I should be aware of?  (as a newbie)

*2.*  As a newbie should I use PyCharm as an IDE or would you recommend I 
use the embedded Web2Py editor?

*3.*  When using PyCharm, is there any HOW-TO documents on how to get 
PyCharm working with Web2Py?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Newbie questions about Apache & Web2PY

2017-02-12 Thread Scott ODonnell
All ,

I've only used the native web2py webserver in the past.
I've recently had to move to Apache as a requirement for the environment 
the apps need to live in.

I was able to get things up and running but ran into a problem where the 
default system python is 2.7.6 and I need a minimum of 2.7.9 for some of 
the libraries I need to use in the app.

I'm unable to upgrade the system python.

There is an alternate install of python in /opt/python-2.7.9

A couple of questions:

- Once the Apache configuration is done, the native Web2Py process (i.e. 
python ./web2py.py) is no longer needed correct?

- I've been looking at the following config directives, but I need to 
confirm they should be added to the default.conf file in 
/etc/apache2/sites-enabled
WSGIPythonExecutable /opt/python-2.7.9/bin/python
WSGIPythonHome /opt/python-2.7.9
WSGIPythonPath /opt/python-2.7.9/lib/python2.7/site-packages

Attempting to add these to default.conf causes apache to fail on restart.

Thank you in advance for pushing me in the right direction.
I'm a bit over my head and working under a deadline.

-Scott


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Newbie question regarding controllers and views

2016-08-06 Thread Scott ODonnell
I'm trying to understand the relationship between controllers and views and 
the general flow of code.

Per the documentation , the display_form() function will run and then feed 
the "view" with the dict(form=form)
At that point the view "default/display_form.html" would be processed and 
sent to the client browser to be rendered.

Questions :
1.) Unless the display_form() is run again after the form is returned to 
the client browser , how would "if form.accepts(request,session) ever be 
executed?
1a.) Is execution of the display_form() function paused while the {{=form}} 
is executed?

2.)  Given "the default/display_form.html" , what logic prevents all the 
content after {{=form}} from being sent to the client browser ?
2a.) What logic prevents the  for "submitted variables", "Accepted 
Variables" and "Errors in form" from being sent immediately while 
processing the view html file?


Thank you in advance for helping me understand this. I'm sure I'm just 
thinking about it all incorrectly.
-Scott


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] [Newbie] Generally accepted method for a Select statement

2016-03-27 Thread Anthony
Your choice. If you want all records and all fields, the first is probably more 
common, but either way is fine.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] [Newbie] Generally accepted method for a Select statement

2016-03-27 Thread Eamonn
Both of these return the same result, my question:

Are they both consider equally valid or is one better than the other?

The reason I ask is, the first is what I currently use, the second is from 
a tutorial dated 2008.

def showall():
x = db(db.twitch).select()
#x = db().select(db.twitch.ALL)
return locals()

I'm a web dev hobbyist, so the details may be lost on me.

Thanks!

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] newbie question about login

2014-11-03 Thread Rodrigo Cesar
Hi all, i'm new to web2py,i was wondering if it's possibly to use the same 
authentication for various apps,my idea is to write my application modular 
where each part of the sistem will ne a stand alone aplication. But the user 
should loggin only once.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Newbie Web2Py Questions

2014-05-18 Thread Christopher Power
Hi all,

I'm a relatively new user of Web2Py.  I looked at it about a year ago and 
loved a lot of its features, but ended up having to teach PHP to my 
undergrads for a variety of reasons that are too boring to go into.  Blech.

Anyways ... this year I'm insisting on using Web2Py for my course. I'm also 
going to be using it on a few of my own projects to get up to speed on the 
idiosyncrasies on the framework.  I've been successful doing some 
relatively complex queries and pulling data from some ugly legacy database, 
so that has all gone pretty well.

With all of that boring information out of the way - I'm looking for a bit 
of advice on a few things (probably the first of many).  Hopefully these 
questions aren't too basic - I did a search and didn't find anything.

1) Is there a way that I can return multiple dict's from a Controller to a 
View?  I have a situation where I need to return the results of two 
different queries back to the
view for display.  I certainly can do that by manipulating the dict's and 
slamming them together - but is there a way to return multiple dicts as in 
regular python?  When I tried the python way or returning multiple dicts 
the server just couldn't return anything (even an error) - I just got a 303.

2) I currently have information pulling from a collection of documents 
called a cartulary (long story on that project).  So when I select from 
default/index the name
of a collection I go from:
http://127.0.0.1:8000/deeds/default/index
to
http://127.0.0.1:8000/deeds/default/cartulary/0001

As expected, where 0001 is the identifier for the cartulary.

Now, on that page is a list of documents.  I would like to have the 
situation where if the user selects a document id, the system displays a 
page of the document at
the URL:
http://127.0.0.1:8000/deeds/default/cartulary/0001/document/1

Where 1 is the id of the document in the collection.  How is the best way 
to do this?  Right now I have it directing to /default/documents/1 through 
the default controller and that is okay - but not quite what I want.

3) I teach my students test driven development.  Before I start diving into 
it myself - is there anything built into Web2Py that I've missed for doing 
test driven development or the related behaviour driven development?  

Cheers
Chris

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Newbie - SQLFORM ordering of reference fields

2014-04-24 Thread M Bailey
I'm trying to migrate a django project to web2py. I have defined a search 
form with selectoption fields populated from the database and using 
code similar to below, but I can't see a way of changing the ordering of 
the SQLFORM fields:

db.define_table('pet_type',
Field('description', 'string', required=True, notnull=True, length=75),
format = '%(description)s')

db.define_table('colour_type',
Field('description', 'string', required=True, notnull=True, length=75),
format = '%(description)s')


db.define_table('search_form',
Field('pet_type_ref', 'reference pet_type', label='Pet'),
Field('colour_type_ref', 'reference colour_type', label='Pet colour'))

In index controller:
form = SQLFORM(db.search_form)
return dict(form=form)

In the view:
{{=form}}


In the admin section, I add some pets into the pet_type table but not in 
alphabetical order, e.g. Dog, Budgie, Cat

All works brilliantly in the view with select controls being used for the 
reference fields. 

However I can't see a way of changing the ordering of the pets for the 
select. Currently it defaults to pet_type.description ASC but how would I 
change it to the pet_type.id so that the records are displayed in the order 
they are inserted?

Thanks for any advice
Mark

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Newbie print question

2014-04-17 Thread jimbo
Right, I have made a simple database which works well and looks nice on 
screen. That is in 'edit' everything looks as it should, everything in nice 
neat boxes and that is how I would like it to print.

However when I print the page a lot of other stuff appears which I gather 
are link details, a Google lead me to believe that this is caused by some 
code in the css of web2py. I have looked through the css but can't see 
which bit I could alter/remove.


Any ideas, explained simply please?

Thanks, Jimmy

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
If you are sure that the user that will be manage by other user is 1 to
many (many users that can declared which user is their manager), you can do
that (self-reference). But this is only one part of the problem, I think
you need to create a group of admin_user that are allow to manage other
users, the one that reference them, so you can get the list of users that
are mananagable by a given admin user like so : db(db.auth_user.id ==
auth.user_id).select(db.auth_user.id) in this case the auth.user_id is the
admin user that is authenticated.

You better have a group of admin and user web2py RBAC to make sure you have
a better controller over the users allowed to manage other users. That way,
you can user the web2py tool to make sure only the users that have right
can access you manage_user function, something like that :

@auth.requires_login()
@auth.requires(lambda: auth.has_membership('admin'))
def manage_user():
rows = db(db.auth_user.id == auth.user_id).select(db.auth_user.id)
id_of_users_to_be_managed = [row.id for row in rows]
if request.vars.user_id in id_of_users_to_be_managed:
form = SQLFORM(db.auth_user, user_id)
...
else:
 form = 'You can't manage this user'
return dict(form=form)


:)

Richard






On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg mcederb...@gmail.comwrote:

 Hi there and thanks for a stellar project - really cool.  I am trying to
 solve an issue that arose and was hoping for a pointer so I can solve it.

 I am wanting to use the authentication mechanism of web2py pretty much as
 is, but I need to be able to have one registered user, in some cases, be
 given the ability to administrate and act as other registered users.
 My thoughts were along the lines of adding a column parent_of to auth_user
 and if an id is specified here pointing towards another user, the specified
 id can administrate as that user. Would this be a proper way to go about
 it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Newbie authentication question

2013-10-28 Thread raferbop
Richard, I was about to post a similar question, but let me just ask you. I 
am also new to web2py, and I am not able to find any good resources in 
relation to creating multiple groups or assigning roles to users. For 
example, lets say I have a group of users that I want to categorize as 
company, drivers, and passengers. Can you shed some light of how I can take 
the built-in auth_user function and create these various groups.

Rafer

On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:

 If you are sure that the user that will be manage by other user is 1 to 
 many (many users that can declared which user is their manager), you can do 
 that (self-reference). But this is only one part of the problem, I think 
 you need to create a group of admin_user that are allow to manage other 
 users, the one that reference them, so you can get the list of users that 
 are mananagable by a given admin user like so : db(db.auth_user.id == 
 auth.user_id).select(db.auth_user.id) in this case the auth.user_id is 
 the admin user that is authenticated.

 You better have a group of admin and user web2py RBAC to make sure you 
 have a better controller over the users allowed to manage other users. That 
 way, you can user the web2py tool to make sure only the users that have 
 right can access you manage_user function, something like that :

 @auth.requires_login()
 @auth.requires(lambda: auth.has_membership('admin'))
 def manage_user():
 rows = db(db.auth_user.id == auth.user_id).select(db.auth_user.id)
 id_of_users_to_be_managed = [row.id for row in rows]
 if request.vars.user_id in id_of_users_to_be_managed:
 form = SQLFORM(db.auth_user, user_id)
 ...
 else:
  form = 'You can't manage this user'
 return dict(form=form)


 :)

 Richard






 On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg 
 mcede...@gmail.comjavascript:
  wrote:

 Hi there and thanks for a stellar project - really cool.  I am trying to 
 solve an issue that arose and was hoping for a pointer so I can solve it.

 I am wanting to use the authentication mechanism of web2py pretty much as 
 is, but I need to be able to have one registered user, in some cases, be 
 given the ability to administrate and act as other registered users.
 My thoughts were along the lines of adding a column parent_of to 
 auth_user and if an id is specified here pointing towards another user, the 
 specified id can administrate as that user. Would this be a proper way to 
 go about it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
I am not sure exactly what you want.

You can create group by the appadmin, and you only need to do it once for
each group. For the assignation of user to a given group, with the appadmin
you have to do it many time (one for each group member, one at a time), if
you have to review/add new group member frequently you can create a
controller function for this...

The access to this function should be restrict as above.

You will need a custom widget I guess to make the user membre picking
easier (not having to populate the membership table one at a time), maybe
SQLFORM.factory() is a better choice then SQLFORM() in this case to
construct custom field for the user member picking... Sorry, I don't have
any pseudo or code that come to mind rapidly, but for sure you can find and
reuse code available here on the list... Also, there is a better appadmin
admi interface call badmin or badadmin, you could maybe find code for this,
or see how it is programmed. There is also web2pyslice where it may be
possible to find code snippet for this.

Hopes it helps

Richard


On Mon, Oct 28, 2013 at 12:13 PM, raferbop rafer...@gmail.com wrote:

 Richard, I was about to post a similar question, but let me just ask you.
 I am also new to web2py, and I am not able to find any good resources in
 relation to creating multiple groups or assigning roles to users. For
 example, lets say I have a group of users that I want to categorize as
 company, drivers, and passengers. Can you shed some light of how I can take
 the built-in auth_user function and create these various groups.

 Rafer


 On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:

 If you are sure that the user that will be manage by other user is 1 to
 many (many users that can declared which user is their manager), you can do
 that (self-reference). But this is only one part of the problem, I think
 you need to create a group of admin_user that are allow to manage other
 users, the one that reference them, so you can get the list of users that
 are mananagable by a given admin user like so : db(db.auth_user.id ==
 auth.user_id).select(db.auth_**user.id http://db.auth_user.id) in this
 case the auth.user_id is the admin user that is authenticated.

 You better have a group of admin and user web2py RBAC to make sure you
 have a better controller over the users allowed to manage other users. That
 way, you can user the web2py tool to make sure only the users that have
 right can access you manage_user function, something like that :

 @auth.requires_login()
 @auth.requires(lambda: auth.has_membership('admin'))
 def manage_user():
 rows = db(db.auth_user.id == 
 auth.user_id).select(db.auth_**user.idhttp://db.auth_user.id
 )
 id_of_users_to_be_managed = [row.id for row in rows]
 if request.vars.user_id in id_of_users_to_be_managed:
 form = SQLFORM(db.auth_user, user_id)
 ...
 else:
  form = 'You can't manage this user'
 return dict(form=form)


 :)

 Richard






 On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg mcede...@gmail.comwrote:

 Hi there and thanks for a stellar project - really cool.  I am trying to
 solve an issue that arose and was hoping for a pointer so I can solve it.

 I am wanting to use the authentication mechanism of web2py pretty much
 as is, but I need to be able to have one registered user, in some cases, be
 given the ability to administrate and act as other registered users.
 My thoughts were along the lines of adding a column parent_of to
 auth_user and if an id is specified here pointing towards another user, the
 specified id can administrate as that user. Would this be a proper way to
 go about it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/**web2py 
 http://github.com/web2py/web2py(Source code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report
  Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
https://github.com/elcio/badmin




On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 I am not sure exactly what you want.

 You can create group by the appadmin, and you only need to do it once for
 each group. For the assignation of user to a given group, with the appadmin
 you have to do it many time (one for each group member, one at a time), if
 you have to review/add new group member frequently you can create a
 controller function for this...

 The access to this function should be restrict as above.

 You will need a custom widget I guess to make the user membre picking
 easier (not having to populate the membership table one at a time), maybe
 SQLFORM.factory() is a better choice then SQLFORM() in this case to
 construct custom field for the user member picking... Sorry, I don't have
 any pseudo or code that come to mind rapidly, but for sure you can find and
 reuse code available here on the list... Also, there is a better appadmin
 admi interface call badmin or badadmin, you could maybe find code for this,
 or see how it is programmed. There is also web2pyslice where it may be
 possible to find code snippet for this.

 Hopes it helps

 Richard


 On Mon, Oct 28, 2013 at 12:13 PM, raferbop rafer...@gmail.com wrote:

 Richard, I was about to post a similar question, but let me just ask you.
 I am also new to web2py, and I am not able to find any good resources in
 relation to creating multiple groups or assigning roles to users. For
 example, lets say I have a group of users that I want to categorize as
 company, drivers, and passengers. Can you shed some light of how I can take
 the built-in auth_user function and create these various groups.

 Rafer


 On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:

 If you are sure that the user that will be manage by other user is 1 to
 many (many users that can declared which user is their manager), you can do
 that (self-reference). But this is only one part of the problem, I think
 you need to create a group of admin_user that are allow to manage other
 users, the one that reference them, so you can get the list of users that
 are mananagable by a given admin user like so : db(db.auth_user.id ==
 auth.user_id).select(db.auth_**user.id http://db.auth_user.id) in
 this case the auth.user_id is the admin user that is authenticated.

 You better have a group of admin and user web2py RBAC to make sure you
 have a better controller over the users allowed to manage other users. That
 way, you can user the web2py tool to make sure only the users that have
 right can access you manage_user function, something like that :

 @auth.requires_login()
 @auth.requires(lambda: auth.has_membership('admin'))
 def manage_user():
 rows = db(db.auth_user.id == 
 auth.user_id).select(db.auth_**user.idhttp://db.auth_user.id
 )
 id_of_users_to_be_managed = [row.id for row in rows]
 if request.vars.user_id in id_of_users_to_be_managed:
 form = SQLFORM(db.auth_user, user_id)
  ...
 else:
  form = 'You can't manage this user'
 return dict(form=form)


 :)

 Richard






 On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg mcede...@gmail.comwrote:

 Hi there and thanks for a stellar project - really cool.  I am trying
 to solve an issue that arose and was hoping for a pointer so I can solve 
 it.

 I am wanting to use the authentication mechanism of web2py pretty much
 as is, but I need to be able to have one registered user, in some cases, be
 given the ability to administrate and act as other registered users.
 My thoughts were along the lines of adding a column parent_of to
 auth_user and if an id is specified here pointing towards another user, the
 specified id can administrate as that user. Would this be a proper way to
 go about it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/**web2py 
 http://github.com/web2py/web2py(Source code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report
  Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit 

Re: [web2py] Newbie authentication question

2013-10-28 Thread Richard Vézina
https://groups.google.com/d/msg/web2py/xeSxEu4xfA0/qDN6V4_BqK0J

http://rochacbruno.com.br/web2py-manage-users-and-membership-in-the-same-form/



Little research...



On Mon, Oct 28, 2013 at 1:25 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 https://github.com/elcio/badmin




 On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I am not sure exactly what you want.

 You can create group by the appadmin, and you only need to do it once for
 each group. For the assignation of user to a given group, with the appadmin
 you have to do it many time (one for each group member, one at a time), if
 you have to review/add new group member frequently you can create a
 controller function for this...

 The access to this function should be restrict as above.

 You will need a custom widget I guess to make the user membre picking
 easier (not having to populate the membership table one at a time), maybe
 SQLFORM.factory() is a better choice then SQLFORM() in this case to
 construct custom field for the user member picking... Sorry, I don't have
 any pseudo or code that come to mind rapidly, but for sure you can find and
 reuse code available here on the list... Also, there is a better appadmin
 admi interface call badmin or badadmin, you could maybe find code for this,
 or see how it is programmed. There is also web2pyslice where it may be
 possible to find code snippet for this.

 Hopes it helps

 Richard


 On Mon, Oct 28, 2013 at 12:13 PM, raferbop rafer...@gmail.com wrote:

 Richard, I was about to post a similar question, but let me just ask
 you. I am also new to web2py, and I am not able to find any good resources
 in relation to creating multiple groups or assigning roles to users. For
 example, lets say I have a group of users that I want to categorize as
 company, drivers, and passengers. Can you shed some light of how I can take
 the built-in auth_user function and create these various groups.

 Rafer


 On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:

 If you are sure that the user that will be manage by other user is 1 to
 many (many users that can declared which user is their manager), you can do
 that (self-reference). But this is only one part of the problem, I think
 you need to create a group of admin_user that are allow to manage other
 users, the one that reference them, so you can get the list of users that
 are mananagable by a given admin user like so : db(db.auth_user.id ==
 auth.user_id).select(db.auth_**user.id http://db.auth_user.id) in
 this case the auth.user_id is the admin user that is authenticated.

 You better have a group of admin and user web2py RBAC to make sure you
 have a better controller over the users allowed to manage other users. That
 way, you can user the web2py tool to make sure only the users that have
 right can access you manage_user function, something like that :

 @auth.requires_login()
 @auth.requires(lambda: auth.has_membership('admin'))
 def manage_user():
 rows = db(db.auth_user.id == 
 auth.user_id).select(db.auth_**user.idhttp://db.auth_user.id
 )
 id_of_users_to_be_managed = [row.id for row in rows]
 if request.vars.user_id in id_of_users_to_be_managed:
 form = SQLFORM(db.auth_user, user_id)
  ...
 else:
  form = 'You can't manage this user'
 return dict(form=form)


 :)

 Richard






 On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg 
 mcede...@gmail.comwrote:

 Hi there and thanks for a stellar project - really cool.  I am trying
 to solve an issue that arose and was hoping for a pointer so I can solve 
 it.

 I am wanting to use the authentication mechanism of web2py pretty much
 as is, but I need to be able to have one registered user, in some cases, 
 be
 given the ability to administrate and act as other registered users.
 My thoughts were along the lines of adding a column parent_of to
 auth_user and if an id is specified here pointing towards another user, 
 the
 specified id can administrate as that user. Would this be a proper way to
 go about it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/**web2py 
 http://github.com/web2py/web2py(Source code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report
  Issues)
 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You 

Re: [web2py] Newbie authentication question

2013-10-28 Thread raferbop
Thanks Richard,

I am having a look right now.

On Monday, October 28, 2013 12:34:34 PM UTC-5, Richard wrote:

 https://groups.google.com/d/msg/web2py/xeSxEu4xfA0/qDN6V4_BqK0J


 http://rochacbruno.com.br/web2py-manage-users-and-membership-in-the-same-form/



 Little research...



 On Mon, Oct 28, 2013 at 1:25 PM, Richard Vézina 
 ml.richa...@gmail.comjavascript:
  wrote:

 https://github.com/elcio/badmin




 On Mon, Oct 28, 2013 at 1:23 PM, Richard Vézina 
 ml.richa...@gmail.comjavascript:
  wrote:

 I am not sure exactly what you want.

 You can create group by the appadmin, and you only need to do it once 
 for each group. For the assignation of user to a given group, with the 
 appadmin you have to do it many time (one for each group member, one at a 
 time), if you have to review/add new group member frequently you can create 
 a controller function for this...

 The access to this function should be restrict as above.

 You will need a custom widget I guess to make the user membre picking 
 easier (not having to populate the membership table one at a time), maybe 
 SQLFORM.factory() is a better choice then SQLFORM() in this case to 
 construct custom field for the user member picking... Sorry, I don't have 
 any pseudo or code that come to mind rapidly, but for sure you can find and 
 reuse code available here on the list... Also, there is a better appadmin 
 admi interface call badmin or badadmin, you could maybe find code for this, 
 or see how it is programmed. There is also web2pyslice where it may be 
 possible to find code snippet for this.

 Hopes it helps

 Richard


 On Mon, Oct 28, 2013 at 12:13 PM, raferbop rafe...@gmail.comjavascript:
  wrote:

 Richard, I was about to post a similar question, but let me just ask 
 you. I am also new to web2py, and I am not able to find any good resources 
 in relation to creating multiple groups or assigning roles to users. For 
 example, lets say I have a group of users that I want to categorize as 
 company, drivers, and passengers. Can you shed some light of how I can 
 take 
 the built-in auth_user function and create these various groups.

 Rafer


 On Monday, October 28, 2013 9:21:58 AM UTC-5, Richard wrote:

 If you are sure that the user that will be manage by other user is 1 
 to many (many users that can declared which user is their manager), you 
 can 
 do that (self-reference). But this is only one part of the problem, I 
 think 
 you need to create a group of admin_user that are allow to manage other 
 users, the one that reference them, so you can get the list of users that 
 are mananagable by a given admin user like so : db(db.auth_user.id == 
 auth.user_id).select(db.auth_**user.id http://db.auth_user.id) in 
 this case the auth.user_id is the admin user that is authenticated.

 You better have a group of admin and user web2py RBAC to make sure you 
 have a better controller over the users allowed to manage other users. 
 That 
 way, you can user the web2py tool to make sure only the users that have 
 right can access you manage_user function, something like that :

 @auth.requires_login()
 @auth.requires(lambda: auth.has_membership('admin'))
 def manage_user():
 rows = db(db.auth_user.id == auth.user_id).select(db.auth_**
 user.id http://db.auth_user.id)
 id_of_users_to_be_managed = [row.id for row in rows]
 if request.vars.user_id in id_of_users_to_be_managed:
 form = SQLFORM(db.auth_user, user_id)
  ...
 else:
  form = 'You can't manage this user'
 return dict(form=form)


 :)

 Richard






 On Sun, Oct 27, 2013 at 7:05 PM, Mikael Cederberg 
 mcede...@gmail.comwrote:

 Hi there and thanks for a stellar project - really cool.  I am trying 
 to solve an issue that arose and was hoping for a pointer so I can solve 
 it.

 I am wanting to use the authentication mechanism of web2py pretty 
 much as is, but I need to be able to have one registered user, in some 
 cases, be given the ability to administrate and act as other registered 
 users.
 My thoughts were along the lines of adding a column parent_of to 
 auth_user and if an id is specified here pointing towards another user, 
 the 
 specified id can administrate as that user. Would this be a proper way 
 to 
 go about it, and how could this be implemented?

 Any thoughts or ideas would be welcome.

 Tnx, Mikael

 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/**web2py 
 http://github.com/web2py/web2py(Source code)
 - 
 https://code.google.com/p/**web2py/issues/listhttps://code.google.com/p/web2py/issues/list(Report
  Issues)
 --- 
 You received this message because you are subscribed to the Google 
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, 
 send an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .


  -- 
 Resources:
 - 

[web2py] Newbie authentication question

2013-10-27 Thread Mikael Cederberg
Hi there and thanks for a stellar project - really cool.  I am trying to 
solve an issue that arose and was hoping for a pointer so I can solve it.

I am wanting to use the authentication mechanism of web2py pretty much as 
is, but I need to be able to have one registered user, in some cases, be 
given the ability to administrate and act as other registered users.
My thoughts were along the lines of adding a column parent_of to auth_user 
and if an id is specified here pointing towards another user, the specified 
id can administrate as that user. Would this be a proper way to go about 
it, and how could this be implemented?

Any thoughts or ideas would be welcome.

Tnx, Mikael

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] web2py newbie question

2013-08-30 Thread Mirko
Hi all,
I am really new to web2py and I find this python framework really exciting.

I am currently reading the whole online book chapter database validators, 
and while I was reading at the example given, I was wondering if there is a 
difference between this :

db.define_table('person', Field('name', unique=True))
db.define_table('dog', Field('name'), Field('owner', db.person))
db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')

and this :

db.define_table('person', Field('name', unique=True), format='%(name)s')
db.define_table('dog', Field('name'), Field('owner', type='reference 
person', required=True))

Thanks a lot,

Mirko

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py newbie question

2013-08-30 Thread Massimo Di Pierro
No it is the same.

This 

Field('owner', 'reference person')

is the same as 

Field('owner', db.person)

If the reference field has a format='...' than you get the default 
validator:

db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')




On Friday, 30 August 2013 02:51:41 UTC-5, Mirko wrote:

 Hi all,
 I am really new to web2py and I find this python framework really exciting.

 I am currently reading the whole online book chapter database validators, 
 and while I was reading at the example given, I was wondering if there is a 
 difference between this :

 db.define_table('person', Field('name', unique=True))
 db.define_table('dog', Field('name'), Field('owner', db.person))
 db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')

 and this :

 db.define_table('person', Field('name', unique=True), format='%(name)s')
 db.define_table('dog', Field('name'), Field('owner', type='reference 
 person', required=True))

 Thanks a lot,

 Mirko


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: web2py newbie question

2013-08-30 Thread Anthony
There are two distinctions here. First:

Field('owner', db.person)

is equivalent to:

Field('owner', 'reference person')

However, the latter is generally preferred because if you are using lazy 
table definitions, the former method triggers the full definition of 
db.person, so you lose the benefit of the lazy definition.

Second:

db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')

is equivalent to:

Field('owner', 'reference person', requires=IS_IN_DB(db, 'person.id', 
'%(name)s'))

Again, though, the latter is preferable in the case of lazy tables because 
the former will trigger the full db.dog table definition. Of course, as 
Massimo pointed out, neither of the above are really necessary if you 
specify the format argument in the db.person table definition, as that 
will result in a default validator equivalent to the above.

Anthony

On Friday, August 30, 2013 12:51:41 AM UTC-7, Mirko wrote:

 Hi all,
 I am really new to web2py and I find this python framework really exciting.

 I am currently reading the whole online book chapter database validators, 
 and while I was reading at the example given, I was wondering if there is a 
 difference between this :

 db.define_table('person', Field('name', unique=True))
 db.define_table('dog', Field('name'), Field('owner', db.person))
 db.dog.owner.requires = IS_IN_DB(db, 'person.id', '%(name)s')

 and this :

 db.define_table('person', Field('name', unique=True), format='%(name)s')
 db.define_table('dog', Field('name'), Field('owner', type='reference 
 person', required=True))

 Thanks a lot,

 Mirko


-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] [newbie] example authorization

2013-06-04 Thread lesssugar
In my layoyt.html I have the following code

{{=auth.login().update(_action=URL('default', 'login'), _name='global_login'
)}}

The login form takes user email and password. It generates correctly. Let's 
assume there are test users in db.auth_user.

I would be grateful if someone provided a short example of further login 
implementation:
1. validate the login data (is email in db? is password correct?)
2. if data OK: redirect to a specific user profile

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Newbie Tables Question

2013-04-17 Thread Doug Girard
I want to create a form which I can add multiple 'items' of different 
'types' that have different 'attributes'

For example, lets use two types of food, pizza and steak

You would start by selecting the type of food. Say pizza

Upon selecting this type you would get more form fields, specific to the 
type chosen. Maybe,

dough:
cheese:
sauce:
topping:

Where if you had chosen steak, you would get a different set of attributes. 
Maybe,

cut:
rarity:

etc..

I hope I've made myself clear, I'm just a beginner at python and am a bit 
stuck. Thank You!

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] newbie question about digitally signed URLs using hmac

2013-04-10 Thread Tim Richardson
the book has an example to use hmac digitally signed URLs, where the KEY 
seems to be a global variable, ie always the same.
Is this a good idea? 

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] [Newbie]How to query and display table records defined in db.py in pages of auth.wiki()

2013-03-26 Thread Spring
Hi there,

I've going through the web2py group trying various keywords but didn't find 
a clear answer: in the pages of auth.wiki, how can I query and display 
tables defined in db.py? Or, more importantly is this possible. Accordingly 
to the introduction of auth.wiki it sounds like a Swiss knife that handles 
a lot of needs, so I believe there is a simple way out. It would be 
wonderful if it can be achieved with Markmin just embedding youtube video.

Any reply appreciated.

Spring

-- 

--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Newbie: Cascading deletes with SQLFORM.grid and GAE

2012-11-17 Thread Julian Sanchez
Hi Everyone!!  Long time lurker  first time posting...

I am working on a simple application that I intend to deploy in GAE.  I 
have a few tables with fields that reference other tables which by default 
enables the ondelete=CASCADE behavior.  This works fine when I run the app 
locally using sqlite as the database.
I believe GAE doesn't support cascading deletes natively. 
I presume web2py doesn't support cascading deletes when running under GAE 
because I don't see that happening.  When I delete a row (rendered through 
SQLFORM.grid) only that row is deleted an all dependent tables remain 
untouched.

The problem I have is that I can't find a way for me to implement the 
cascading behavior manually.  I added a 'ondelete=mydelete' event for the 
SQLFORM.grid where I do the manual delete of the dependent tables and 
commit in the database, but that doesn't seem to work either.  I searched 
through this forum but didn't find any suggestions either.  Any suggestions 
as to what could I do to solve this??  Do I have to stay away from 
SQLFORM.grid to avoid this problem?

Many Thanks!!
Julian

I am using web2py Version 2.2.1 (2012-10-21 16:57:04) stable on OS X 
Mountain Lion and GoogleAppEngineLauncher version 1.7.3 (1.7.3.333)

-- 





[web2py] NewBie Question about crud.create

2012-09-05 Thread tommasot
I have the following code in the controller about record creation

*form = crud.create(db.anno,next='list_anno')*

This is the model,how you can see is very simple :)

*db.define_table('anno',
Field('descrizione'),
Field('incorso','boolean'),format='%(descrizione)s')*

Now i want to catch the 'incorso' value posted from the form and manipulate 
the value if some condition is satisfied.

The question is how can i intercept the value, i hope there is something 
like form.field


Thanks

-- 





Re: [web2py] NewBie Question about crud.create

2012-09-05 Thread Richard Vézina
What you want to do exactly?

Base on the value you are talking about filtering a dropbox list for an
other field?

If so there is lazy option plugin :

http://dev.s-cubism.com/plugin_lazy_options_widget

You will need to be more specific in your question if you want us to help
you properly.

Richard

On Wed, Sep 5, 2012 at 11:09 AM, tommasot tommt...@gmail.com wrote:

 I have the following code in the controller about record creation

 *form = crud.create(db.anno,next='list_anno')*

 This is the model,how you can see is very simple :)

 *db.define_table('anno',
 Field('descrizione'),
 Field('incorso','boolean'),format='%(descrizione)s')*

 Now i want to catch the 'incorso' value posted from the form and
 manipulate the value if some condition is satisfied.

 The question is how can i intercept the value, i hope there is something
 like form.field


 Thanks

 --





-- 





[web2py] newbie question - recursively finding children

2012-08-31 Thread web-dev-m
Hey everyone!

Wow Web2py 2.0 looks so cool! I can't wait to try all the new features.  
This has made it so easy for me (a non-programmer) to make viable web 
applications!

My question is as follows:  
For one of my views, each page in my application has a variable number of 
child pages, each of which can have a variable number of child pages, 
and so on.  I want each child page to have its own div like so:

div  the big container div
div  variable number of divs here
div/div  variable number of child div's here 
each with their own text
/div
div

How do I write the controllers, so that it recurses as deep as the deepest 
node and generates those divs??

My design is as follows:

Two tables:
table1
-id (auto generated)
-field for text

table2
-id(autogenerated)
-parent_id(created from form)
-childid(created from form)

I know that I have to write a function that returns a div for each, but I 
just wasnt sure how to do it.

Please help!

Thanks!

-- 





[web2py] Newbie: interactive monitoring of a scheduler job?

2012-07-24 Thread Tim Richardson
I'm using the 'experimental' scheduler with 1.99.7 . I know there are posts 
encouraging us to try the development version, but I'm just learning web2py 
and I'm trying to keep things as controlled as possible. Plus I don't know 
when the development version becomes stable. 

I can send a job to the scheduler. I'm using it because I have some tasks 
that could take a few minutes to finish. What's a recommended way for a 
user still at their browser to see when a job is complete? Some kind of 
ajax usage?


-- 





[web2py] [Newbie] Using existing Mysql DB with web2py app

2012-07-09 Thread Pankaj Chawla
Hi

I am new to web development but have been trying my hands at various python 
frameworks and web2py looks very good. Now my problem is that there is an 
existing web application based on CakePHP and MySQL. While that application is 
complete in itself, the plan is to write an android application that will also 
interact with the same DB through an exposed API using JSON as the protocol 
medium. Since I am not a PHP developer, I will like to use Python for doing 
that API interface and Web2py seems like a good choice to do it. But before I 
dive in there are some questions I have in mind:

1. Can I use web2py to connect to the existing DB? Is there any automated way 
of creating the model classes from existing DB tables? Any specific things to 
keep in mind?

2. Will it create any problems with a CakePHP based web application and an 
android application using a web2py based API to do CRUD on the same Mysql DB? 

3. Can both be hosted on the same apache server? Is the built-in rocket based 
webserver in web2py good for production deployment or only for internal 
development and testing? Since the Web2py app will only be exposing a JSON 
based API I can always have it served on a different port.


---
Take care,
Pankaj



[web2py] Newbie Alert: A flow chart of how things happen

2012-06-07 Thread Omar Ali
I'm a total newbie. I have programmed extensively during the VB days (event 
driven programming) (I know, you'd hardly call that programming!) so ... 
Web programming is taking a toll on me.

Could someone explain to me the dynamics of web2py programming in a way 
that an event driven programming dude can understand, maybe using analogies 
and such..




Re: [web2py] Newbie Alert: A flow chart of how things happen

2012-06-07 Thread Jim Steil
I think it would really help for you to get the web2py book and read 
it.  It does a great job explaining the flow of control and how data 
gets passed around.


-Jim

On 6/7/2012 5:15 AM, Omar Ali wrote:
I'm a total newbie. I have programmed extensively during the VB days 
(event driven programming) (I know, you'd hardly call that 
programming!) so ... Web programming is taking a toll on me.


Could someone explain to me the dynamics of web2py programming in a 
way that an event driven programming dude can understand, maybe using 
analogies and such..



No virus found in this message.
Checked by AVG - www.avg.com http://www.avg.com
Version: 2012.0.1913 / Virus Database: 2433/5053 - Release Date: 06/06/12



--
Jim Steil
VP of Information Technology
Quality Liquid Feeds, Inc.
608.935.2345 office
608.341.9896 cell


[web2py] newbie - dreamweaver and web2py

2012-04-08 Thread jaideep kekre
im a student trying to build a slick website as a hobby . can web2py be 
used with dreamweaver to generate html and then add the web2py template 
stuff ? any bugs or issues i should be aware of? 

thanks a lot !!

[web2py] newbie question about relationships in model

2012-02-04 Thread air_cooled
I've created a model in the GAE SQL tool - which was great, except it
didn't work in web2py.  I just got errors.

So I created a model from the wizard to get going, but I've got some
strange behaviour around relationships.

I have a table 'labels' which is linked to a number of other tables.
A couple of these links work as you'd expect - in the edit screen you
see a drop list of the 'name' field from the relate table.  For some
reason I can't fathom ONE of these tables ('winery') shows a text
field into which the ID of the related record has to be added.  That
related table 'winery' is similar to the others that do work 'variety'
and 'retailcategory', and has a 'name' field with the same data type
as the others.  These relationships are modelled:

Field('f_retailcategory', type='reference t_retailcategory',
  label=T('Retailcategory')),
Field('f_winery', type='reference t_winery',
  label=T('Winery')),
On searching the syntax is suggested as:

Field('f_winery_id', db.winery),

or


Field('f_winery_id', db.t_winery)

However adding these lines just causes it to blow up and show the
error:
type 'exceptions.KeyError' 'winery'

This is all a bit arcane.  I can't understand why the GAE stuff
does'nt work after fixing all the parsing errors.
I've used PHP Cake a bit, so I get the concepts, but at this stage it
seems the documentation != practice.

Any tips?
thanks





[web2py] newbie : Accessing specific form elements' values from a controller.

2012-02-04 Thread Salvation
Hi!
I have a html form in my default view. I don't want to create form
elements from my controller, but use pure HTML where possible. How can
I
1. Access the form elements, and their values into my controller, say
default.py. (something like GetElementById )
2. Detect if the form has been submitted, so that I can use the values
I Accessed.

I went through many questions here, but couldn't work it out.

My View:

form id=mainForm class=well form-search
 legendSearch Videos/legend
 span class=input
  input type=text size=45 name=search_keyword
id=searchKeyword class=xlarge
 /span

 span class=formactions
  button class=btn primary type=submitSearch/
button
  /span
/form

My Controller:

def index():
#is form submitted ?
#if Yes
#Access the form
#get the value inside the searchKeyword text box
#Use it elsewhere
#else
#display the form and wait

I have a feeling that this is not the correct approach. Please feel
free to point me in the right direction.

Thank You.


Re: [web2py] newbie : Accessing specific form elements' values from a controller.

2012-02-04 Thread Carlos Costa
I think you can do like this:

if request.vars:
   use request.vars.varname to access values
else:
  return .

Since you point your form to the right actions the all the vars will
be there when you submit.
When you dont submit they will not be there.

2012/2/4 Salvation timsina.an...@gmail.com:
 Hi!
    I have a html form in my default view. I don't want to create form
 elements from my controller, but use pure HTML where possible. How can
 I
 1. Access the form elements, and their values into my controller, say
 default.py. (something like GetElementById )
 2. Detect if the form has been submitted, so that I can use the values
 I Accessed.

 I went through many questions here, but couldn't work it out.

 My View:

 form id=mainForm class=well form-search
     legendSearch Videos/legend
         span class=input
              input type=text size=45 name=search_keyword
 id=searchKeyword class=xlarge
         /span

         span class=formactions
                  button class=btn primary type=submitSearch/
 button
          /span
 /form

 My Controller:

 def index():
 #    is form submitted ?
 #    if Yes
 #        Access the form
 #        get the value inside the searchKeyword text box
 #        Use it elsewhere
 #    else
 #        display the form and wait

 I have a feeling that this is not the correct approach. Please feel
 free to point me in the right direction.

 Thank You.



-- 
Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן


Re: [web2py] newbie question about relationships in model

2012-02-04 Thread Carlos Costa
Is t_winery being created after this line?

2012/2/4 air_cooled jam...@billson.com:
 I've created a model in the GAE SQL tool - which was great, except it
 didn't work in web2py.  I just got errors.

 So I created a model from the wizard to get going, but I've got some
 strange behaviour around relationships.

 I have a table 'labels' which is linked to a number of other tables.
 A couple of these links work as you'd expect - in the edit screen you
 see a drop list of the 'name' field from the relate table.  For some
 reason I can't fathom ONE of these tables ('winery') shows a text
 field into which the ID of the related record has to be added.  That
 related table 'winery' is similar to the others that do work 'variety'
 and 'retailcategory', and has a 'name' field with the same data type
 as the others.  These relationships are modelled:

    Field('f_retailcategory', type='reference t_retailcategory',
          label=T('Retailcategory')),
    Field('f_winery', type='reference t_winery',
          label=T('Winery')),
 On searching the syntax is suggested as:

    Field('f_winery_id', db.winery),

 or


    Field('f_winery_id', db.t_winery)

 However adding these lines just causes it to blow up and show the
 error:
 type 'exceptions.KeyError' 'winery'

 This is all a bit arcane.  I can't understand why the GAE stuff
 does'nt work after fixing all the parsing errors.
 I've used PHP Cake a bit, so I get the concepts, but at this stage it
 seems the documentation != practice.

 Any tips?
 thanks






-- 
Carlos J. Costa
Cientista da Computação
Esp. Gestão em Telecom

EL MELECH NEEMAN!
אָמֵן


[web2py] Newbie Tutorial Confusion

2012-01-31 Thread llanitedave
I just downloaded web2py, and I'm going through the html book for the first 
time.  I'm just getting to the point where I think I can understand the 
web2py approach, and I'm starting to get enthused.

I've gotten as far as the Postback section, and I'm running into problems. 
 The code does not seem to be working as posted, and I'm kind of at a loss.

Using the code below: 









def first():
if request.vars.visitor_name:
session.visitor_name = request.vars.visitor_name
redirect(URL('second'))
return dict()

def second():
return dict()

 default/first.html view:







{{extend 'layout.html'}}
What is your name?
form
  input name=visitor_name /
  input type=submit /
/form

 default/second.html view 



{{extend 'layout.html'}}
h1Hello {{=session.visitor_name or anonymous}}/h1


(I first tried it slightly customized, then in frustration I copied and pasted 
verbatem without a change in results), it works as long as I actually input the 
visitor_name.  But if I don't input any value, then it does not display Hello 
anonymous as it should.  It just resets back to first.html.

I went a little further, to the next step down, but I had similar problems 
there.  It doesn't seem to be treating null session data as it should.

So what should I try next?  I'll settle for any hint I can get.

*
*


[web2py] newbie: How to match REST URL and extract path params

2011-12-22 Thread dum coder
Hello everyone, i'm new to Python and web2py , In Java Jersey REST
framework i can map a REST URL to a function and get all the path
parameters eg.,

/comapany/{comapnyid}/store/{storeid}

can be mapped to a particular function and companyid and storeid are
accessible as
parameters to function.

i'm trying to find how can i accomplish similar functionality in
web2py, where

GET /comapany/apple/store/567

gets mapped to a function and in side function i can retrieve
companyid and storeid variables.

I looked at function parse_as_rest but seems like it tried to run
query against db, in  my
case i just want to retrieve path parameters and then call other rest
api  in other systems


thanks


[web2py] newbie question

2011-11-19 Thread chawk
db.define_table('discussion',
Field('comment', 'text'))

def comment():
form = SQLFORM(db.discussion, _class='test1')
if form.process().accepted:
redirect(URL('comment_results'))
return dict(form=form)

def comment_results():
items = db(db.discussion.id==db.discussion.id).select()

return dict(items=items, erase=erase)




Re: [web2py] newbie question

2011-11-19 Thread Chris Hawkes
sorry guys i hit enter to soon, disregard this question

On Sat, Nov 19, 2011 at 6:33 PM, chawk chrshawke...@gmail.com wrote:

 db.define_table('discussion',
Field('comment', 'text'))

 def comment():
form = SQLFORM(db.discussion, _class='test1')
if form.process().accepted:
redirect(URL('comment_results'))
return dict(form=form)

 def comment_results():
items = db(db.discussion.id==db.discussion.id).select()

return dict(items=items, erase=erase)





[web2py] Newbie - install on Apache not working...

2011-11-15 Thread Derek
While I can run web2py on my development machine (Ubuntu 10.10)
without any problems, I cannot seem to get it to work on a production
server.

I have adapted the directions given in 
http://web2py.com/book/default/chapter/11#mod_wsgi
as follows:

$ cd /var/www/
$ sudo wget http://web2py.com/examples/static/web2py_src.zip
$ sudo unzip web2py_src.zip
$ sudo chown -R www-data:www-data /var/www/web2py

Then in a new config file /etc/apache2/sites-available/web2py I have
added:

VirtualHost *:80
  ServerAdmin webmaster@localhost
  ServerName subdomain.domain.com
  DocumentRoot /var/www/web2py/
  WSGIDaemonProcess web2py user=www-data group=www-data \
   display-name=%{GROUP}
  WSGIProcessGroup web2py
  WSGIScriptAlias / /var/www/web2py/wsgihandler.py

  Directory /var/www/web2py
AllowOverride None
Order Allow,Deny
Deny from all
Files wsgihandler.py
  Allow from all
/Files
  /Directory

  AliasMatch ^/([^/]+)/static/(.*) \
   /var/www/web2py/applications/$1/static/$2
  Directory /var/www/web2py/applications/*/static/
Order Allow,Deny
Allow from all
  /Directory

  Location /admin
  Deny from all
  /Location

  LocationMatch ^/([^/]+)/appadmin
  Deny from all
  /LocationMatch

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

(Note: subdomain.domain.com is just a dummy entry here; on the real
server it contains the actual server details.)

However, browsing to the main entry page just results in the normal
main page for the server being displayed.

I will appreciate any boot up help you can give!

Thanks
Derek
2011/11/14

(As a small footnote, I have seen that most tutorials and directions
for web frameworks start with installing on a new/clean machine,
which is very frustrating because 95% of the time that is simply not
the case...)


Re: [web2py] Newbie - install on Apache not working...

2011-11-15 Thread Kenneth Lundström

Hi Derek,

is this the first name based domain on the server? Do you have other 
name based webpages on the server?


For some reason it sounds like Apache doesn't see this configuration and 
doesn't understand to use web2py.



Kenneth


While I can run web2py on my development machine (Ubuntu 10.10)
without any problems, I cannot seem to get it to work on a production
server.

I have adapted the directions given in 
http://web2py.com/book/default/chapter/11#mod_wsgi
as follows:

$ cd /var/www/
$ sudo wget http://web2py.com/examples/static/web2py_src.zip
$ sudo unzip web2py_src.zip
$ sudo chown -R www-data:www-data /var/www/web2py

Then in a new config file /etc/apache2/sites-available/web2py I have
added:

VirtualHost *:80
   ServerAdmin webmaster@localhost
   ServerName subdomain.domain.com
   DocumentRoot /var/www/web2py/
   WSGIDaemonProcess web2py user=www-data group=www-data \
display-name=%{GROUP}
   WSGIProcessGroup web2py
   WSGIScriptAlias / /var/www/web2py/wsgihandler.py

   Directory /var/www/web2py
 AllowOverride None
 Order Allow,Deny
 Deny from all
 Files wsgihandler.py
   Allow from all
 /Files
   /Directory

   AliasMatch ^/([^/]+)/static/(.*) \
/var/www/web2py/applications/$1/static/$2
   Directory /var/www/web2py/applications/*/static/
 Order Allow,Deny
 Allow from all
   /Directory

   Location /admin
   Deny from all
   /Location

   LocationMatch ^/([^/]+)/appadmin
   Deny from all
   /LocationMatch

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

(Note: subdomain.domain.com is just a dummy entry here; on the real
server it contains the actual server details.)

However, browsing to the main entry page just results in the normal
main page for the server being displayed.

I will appreciate any boot up help you can give!

Thanks
Derek
2011/11/14

(As a small footnote, I have seen that most tutorials and directions
for web frameworks start with installing on a new/clean machine,
which is very frustrating because 95% of the time that is simply not
the case...)




Re: [web2py] Newbie - install on Apache not working...

2011-11-15 Thread Kenneth Lundström
 (As a small footnote, I have seen that most tutorials and directions 
for web frameworks start with installing on a new/clean machine,  
which is very frustrating because 95% of the time that is simply not the 
case...)


I think the reason is quite simple, it's very hard, if not impossible, 
to make a installation manual for a none new/clean server. If it's not a 
new/clean server then the server setup can be so different. It can 
contain all kind of software and installation. If you install for 
example web2py on an existing server you should have a basic knowledge 
of the setup and then you have to modify the setup instructions to suit 
your server setup.



Kenneth



Re: [web2py] [Newbie] Best practice to set application wide settings

2011-07-26 Thread Jagmal
Thanks Bruno for the suggestions. I will keep these in mind.

[web2py] [Newbie] Best practice to set application wide settings

2011-07-22 Thread Jagmal
Hi All,

I am new to web2py framework and have been working on a small project
to set up authentication. In here, I would like to configure default
options. For ex, I would like to disable registration. I am wondering
what is a good way to do it.

Should I create a model class and put these default settings there?
Also, should I be using the same model class to configure DB and other
application wide settings?

Regards,
Jagmal


Re: [web2py] [Newbie] Best practice to set application wide settings

2011-07-22 Thread Bruno Rocha
The best practice says that:

1. have the latest web2py version
2. create your classes and custom objects in /modules
3. create in /modules a class to hold your settings properties or use
gluon.storage.Storage
4. In models import your modules with your classes and objects (you can use
'current' object to pass data between models and modules)
5. define database tables in models (models are executed alphabetically)
6. Use controllers only do determine the control flow of app, complex code
go to /modules and instantiate/call in controller/model
7. Many HTML HELPERS in controllers
8. Less HTML HELPERS in views
9. take care about security defining the response.generic_patterns and
proper authentication/siganature
10. READ THE BOOK (but not only the book, the source code, the group)



On Fri, Jul 22, 2011 at 2:54 AM, Jagmal jag...@gmail.com wrote:

 Hi All,

 I am new to web2py framework and have been working on a small project
 to set up authentication. In here, I would like to configure default
 options. For ex, I would like to disable registration. I am wondering
 what is a good way to do it.

 Should I create a model class and put these default settings there?
 Also, should I be using the same model class to configure DB and other
 application wide settings?

 Regards,
 Jagmal




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Newbie Question: jqGrid fail on Firefox 4

2011-03-23 Thread Willoughby
I've inherited a web2py app running v1.61.1 and some form of jqGrid(?) for 
displays.
Everything has been humming along but now discovered that the grids fail to 
display in Firefox 4.

And yes, I know Firefox 4 is the ultimate culprit - but has anyone seen this 
issue yet?

Thanks...




[web2py] Newbie questions

2011-03-16 Thread Nick Rosencrantz
Hi
I just deployed my first attempt to try web2py with google app engine
(http://matochsovklockan.appspot.com)
Basically it works while a few links return invalid request eg
http://matochsovklockan.appspot.com/examples/default/index
Is this an expected result or something that I did wrong?
I like web2py a lot and welcome all advice, comments and discussions
here.
Regards,
Niklas R


[web2py] Newbie Problems with Cherokee + Web2py

2011-01-05 Thread Offray Vladimir Luna Cárdenas
Hi all,

This is my first post to the list, after a long time (a couple of years
maybe) without being here. In that moment I have not the time for
learning web2py and keeping the peace with the list, so I unsubscribed
myself. But now I want to re-enable my participation here. I have
installed Instant Press Appliance and the plugin_wiki and now I want to
publish it in the web using cherokee, following the instructions on [1]
and making some minor variations. So I have ran this small bash script:

   #!/bin/bash
   version=1.91.4
   proyecto=Portico
   usuariow2p=offray
   sudo groupadd w2padmin
   sudo mkdir -p /opt/$proyecto/Web2py/$version
   sudo chown :w2padmin /opt/$proyecto/Web2py/
   sudo chmod -R g+rwx /opt/$proyecto/Web2py/
   sudo usermod -a -G w2padmin $usuariow2p

After that I defined the data source and the virtual server according to
the docs (changing the path by my own one), but is not working. Even I
have changed the path by the one in the docs (/var/web2py/) but still is
not working. When I load localhost in the machine where I'm running the
test, it automatically becomes http://localhost/welcome/default/index;
but here I get:

-
404 Not Found
The requested URL /welcome/default/index was not found on this server.

Cherokee web server 1.0.15 (Arch Linux), Port 80
-

When I see the process running to see what's happening with
startweb2py.sh I get:

-
[In] ps aux | grep web2py
[Out]
offray3650  2.4  0.4  26780 12684 ?SN   09:33   0:01 python2
/var/web2py/fcgihandler.py
offray3656  2.4  0.4  18580 12664 ?SN   09:33   0:01 python2
/var/web2py/fcgihandler.py
offray3671  2.4  0.4  18580 12664 ?SN   09:33   0:01 python2
/var/web2py/fcgihandler.py
offray3681  2.4  0.4  26776 12684 ?SN   09:33   0:01 python2
/var/web2py/fcgihandler.py
offray3893  0.0  0.0   4236   852 pts/2SN+  09:34   0:00 grep web2py
-

Si cargo la dirección localhost:8000 tradicional de web2py, me dice
que no logra establecer conexión con el servidor. No sé si el
fcgihandler.py debería levantar automáticamente web2py o si es necesario
hacer algo más o si el problema es querer ejecutar el servidor virtual
como un usuario diferente al root (sin embargo coloqué estos parámetros
del usuario en Cherokee).

When I load the usual localhost:8000 of web2py it says that it cannot
stablish a connexion with the server. I imagine that fcgihandler.py
should load web2py automatically or if is something related with trying
to run web2py under a different non-root user (but I have told cherokee
this properly).


Any pointer to a solution will be appreciated.

Thanks in advance,

Offray


[web2py] newbie

2010-12-12 Thread Shel
Hello,

I am trying to create a form that displays all the rows in a table
where, for example, db.storyline.story_id = session.story_id, and I
cannot for the life of me figure out how to do this.  It seems like
this should be very simple, but nothing I have tried works.  I am not
sure how to use a query as the data source for a form, or how to
create a form that shows all the rows returned by the query.  Any help
would be appreciated.Especially if anyone could point me to some
sample code that does something similar, that would be great.

Thank you,
Shel


[web2py] Newbie question:add new record as a copy of an existing row in SQLFORM

2010-12-03 Thread tomt
Hi,

I've started to write a simple application to learn web2py. I am using
SQLFORM to insert, modify and delete records. So far everything is
working as planned.

I would like to give the user the ability add a new record as a copy
of an existing one.  The idea is that the user would view an existing
record, modify a couple fields, and select 'copy' which result in
adding a new record.

I assume that this requires additional code, and I was hoping that
someone would suggest an example, or let me know if SQLFORM can do
this automatically.

Thanks in advance,

- Tom


[web2py] newbie + resources on web design

2010-11-08 Thread Markandeya
Dear Friends at Web2Py,
 i need some resources, books ebooks, tutorials, etc. on how to design
a database driven web application that will help me with web2py
development. Any advice will be appreciated.

i want to create web apps with web2py but know too little of web
design for database driven web applications. i write same type
programs for client-server or 3 tier applications not using the web.
So i have questions like do i get all master and child tables rows
into dictionaries on the client web page so they can click a parent
record and then see the child detail records in a grid or do i get the
detail records from the server when parent record is clicked? If there
is an edit do i reload all the records again from the server to show
in the grid or just check the edit was accepted by the database and
then edit the record in the grid?

  So i need some resources, books ebooks, tutorials, etc. on how to
design a database driven web application that will help me with web2py
development.


[web2py] Newbie Parent/Child editing- The right way

2010-10-18 Thread Markandeya
Dear Friends of Web2py,
i am starting out with Web2py and Web Apps. I have a Parent Table of
Service Calls and a child table of Visits. When making an edit form
with both tables visible, one below the other, I need to be able to
click on a Parent (Service Calls) table cell or row and  have the
child (visits) table then filter or lookup the records for that Parent
Service Call Record. Then when a child record is edited or added it
needs to be shown in the child html table. This is a usual and
recurring situation in many webapps or pages. What is the best
practices way to do this? Bring in all 50-100 child records in a
dictionary or array and then have a function that displays them in the
Child Html table? or go to the database each time? And what event on
the page or in the html table can be used to show when a Cell or Row
is clicked by the user? Also if my Parent table has a field for number
of calls, then with each added or deleted call record the parent  db
and html table also has to be changed. How best to accomplish this.
  Maybe there is tutorial or example or simple web2py program/webapp
that might help.
  Thanks for putting up with beginners ignorance. Any guidance will be
welcome, Thanks Markandeya


[web2py] newbie, import csv table file

2010-09-14 Thread Markandeya
Dear Friends of web2py,
Sorry for this repeated question, but i can't seem to understand
properly. I have been looking it up for an hour or two.
I have CSV file for a database table created by sqlite. It is in the
format that is first line delimited column names then a separate line
with delimited field values for each table row.

Can this be imported in any way so that one doesn't have to hand write
db.define_table statements defining each field??

If i have a Mysql table can this be imported(or even the schema) so
that there is no need to hand write the db.define_table statements??

Many thanks. This will save me lots of time searching whatever the
proper answer is and i can get to the programming.


[web2py] Newbie needs help

2010-08-21 Thread Michele Alzetta
Dear web2py-users,

I tried to create the database schema of my application by adding the
following code in db.py ; I am pasting the entire code, but in fact
the problem appears already at the first table definition, because te
ticket I get is the following:

Traceback (most recent call last):
  File /home/mike/web2py/gluon/restricted.py, line 186, in
restricted
exec ccode in environment
  File /home/mike/web2py/applications/TurniPS/models/db.py, line 28,
in module
Field('OrarioSett','integer',default='38'))
  File /home/mike/web2py/gluon/sql.py, line 1359, in define_table
t._create(migrate=migrate, fake_migrate=fake_migrate)
  File /home/mike/web2py/gluon/sql.py, line 1845, in _create
fake_migrate=fake_migrate)
  File /home/mike/web2py/gluon/sql.py, line 1914, in _migrate
self._db._execute(sub_query)
  File /home/mike/web2py/gluon/sql.py, line 947, in lambda
self._execute = lambda *a, **b: self._cursor.execute(*a, **b)
OperationalError: duplicate column name: lnott

This is the code, of course there is no duplicate column name...

... so - is this a silly mistake (missing bracket or apostrophe =
better use an editor instead of the web interface to develop)
... is it a crass error (young man, if you had read the manual on page
n, you would know that field definitions whatever)
... or what ? And how would it be best to go about debugging this sort
of error ?

Thank you for any suggestions. Here follows the code:

# Tabella 1 - dati personali dei medici

db.define_table('Medici',
 
Field('SiglaMedico','string',required=True,length=5,notnull=True,unique=True),
 
Field('NomeCognome','string',length=5,required=True,notnull=True,unique=True),
  Field('Email'),
  Field('LNott','boolean',default=True),
  Field('LPref','boolean',default=True),
  Field('LFest','boolean',default=True),
  Field('OrarioSett','integer',default='38'))

db.Medici.Email.requires=IS_EMAIL(error_message=T('Indirizzo email
invalido!'))
db.Medici.OrarioSett.requires=IS_INT_IN_RANGE(0,40)

# Tabella 2 - periodi di assenza dei medici

db.define_table('Assenze',
Field('Medici_id',db.Medici),
Field('Inizio','datetime'),
Field('Fine','datetime'),
Field('PesoMotivazione','integer'),
Field('Motivazione','string'))

db.Assenze.Inizio.requires=IS_DATETIME()
db.Assenze.Fine.requires=IS_DATETIME()
db.Assenze.PesoMotivazione.requires=IS_INT_IN_RANGE(0,10)

# Tabella 3 - tipi di servizio

db.define_table('Servizi',
 
Field('SiglaServizio','string',length=5,required=True,notnull=True,unique=True),
Field('TipoServizio','string'))

# Tabella 4 - tipi di turno

db.define_table('Turni',
 
Field('SiglaTurno','string',length=5,required=True,notnull=True,unique=True),
Field('OraInizio','time'),
Field('OraFine','time'),
Field('DescizioneTurno','string'))

db.Turni.OraInizio.requires=IS_TIME()
db.Turni.OraFine.requires=IS_TIME()

# Tabella 5 - associamo i diversi tipi di turno a diversi tipi di
servizio

db.define_table('ServiziTurno',
Field('Servizi_id',db.Servizi),
Field('Turni_id',db.Turni))

# Tabella 6 - associamo ogni medico a diversi tipi di servizio

db.define_table('ServiziMedici',
Field('Servizi_id',db.Servizi),
Field('Medici_id',db.Medici),
Field('Preferenza','integer'))

db.ServiziMedici.Preferenza.requires=IS_INT_IN_RANGE(0,10)

# Tabella 7 - infine il nostro schema turni !

db.define_table('SchemaTurni',
Field('Data','date'),
Field('Turni_id',db.Turni),
Field('Medici_id',db.Medici),
Field('Gettone','boolean',default=False),
Field('OreServizo','integer'),
Field('Festivo','boolean'),
Field('Preferenza','integer'))

db.SchemaTurni.Data.requires=IS_DATE()
db.SchemaTurni.OreServizio.requires=IS_INT_IN_RANGE(0,12)
db.SchemaTurni.Preferenza.requires=IS_INT_IN_RANGE(0,10)


[web2py] Newbie question on self-submitting form

2010-05-26 Thread NoNoNo
Hi,

I'm quite new to web2py and currently building a simple application: a
message board, listing latest 20 messages by index(). For earlier
messages, there is a  self-submitting form to enter page number (20
message each page) to go to, and after submitting the form, redirects
to that page. Here is the question on the self-submitting form:
nothing changed (always showing the 1st page) whatever number is input
into the form. Controller as follows:

def index():
page_no=1
entries=db(db.whoelse.id  0).count()
messages=db((db.whoelse.id(entries-20)) 
(db.whoelse.id=entries)).select(db.whoelse.ALL,
orderby=~db.whoelse.created_on)

if request.vars.page_no:
if request.vars.page_no(entries/20+1):
redirect(URL(r=request, f='index'))
else:
redirect(URL(r=request, f='gotopage')
form=crud.create(db.whoelse,
next=URL(r=request,args=1),message='Your message is posted')
return dict(messages=messages, entries=entries,
form=form,page=page_no)

def gotopage():
entries=db(db.whoelse.id  0).count()
messages=db((db.whoelse.id(entries-request.vars.page_no*20)) 
(db.whoelse.id=((entries-
(request.vars.page_no-1)*20.select(db.whoelse.ALL,
orderby=~db.whoelse.created_on)

form=crud.create(db.whoelse,
next=URL(r=request,args=1),message='Your message is posted')
return dict(messages=messages, entries=entries, form=form,
page=request.vars.page_no)
--
and corresponding view part:
 h5{{=page}}/{{=entries/20+1}} Pagesnbsp;nbsp;nbsp;nbsp;Go to
page:forminput name=page_no /  input type=submit //form/
h5
--

Any reply will be appreciated.

Spring


[web2py] Newbie Questions.

2010-04-13 Thread Yanni
Ok, so I'm a bit confused.

1. I am using web2py on my Windows installation, however, after I stop
and restart the service, all my work disappears (the views,
controllers, etc).  How do I prevent this from happening?
2. Is there a way around GAE not allowing the timestamp option? The
application I am planning requires that the date-submitted is written
into the database, not necessarily the time.
3. Is there a list of plugins somewhere?

Thank you.


-- 
To unsubscribe, reply using remove me as the subject.


[web2py] Newbie DAL question

2010-04-13 Thread Sheldon
Newbie DAL question

I'm new to web2py and I'm trying to get the following code to
work, but it didn't return any results when there should have
been two rows.

user_id = '4'
rows = db(
(db.auth_membership.user_id==user_id) 
(db.auth_membership.group_id==db.auth_group.id) 
(db.auth_membership.user_id==db.auth_user.id)
).select( db.auth_group.role, db.auth_user.first_name,
db.auth_user.id)

So I tried the raw SQL that _select() generates:

SELECT auth_group.role, auth_user.first_name, auth_user.id
FROM auth_user, auth_group, auth_membership
WHERE ((auth_membership.user_id=4
AND auth_membership.group_id=auth_group.id)
AND auth_membership.user_id=auth_user.id);

Which didn't work until I put quotes around the 4 (user_id)
which then worked as its supposed to:

SELECT auth_group.role, auth_user.first_name, auth_user.id
FROM auth_user, auth_group, auth_membership
WHERE ((auth_membership.user_id='4'
AND auth_membership.group_id=auth_group.id)
AND auth_membership.user_id=auth_user.id);

How can I force the DAL to generate quotes when a string is
passed to the db()?  Is this something that is taken care of
in the model?  If so, since this is an Auth table, how can I
change it?

Thanks,
Sheldon


-- 
To unsubscribe, reply using remove me as the subject.


Re: [web2py] Newbie Question: Intellisense for Web2Py?

2010-01-20 Thread tiago almeida
Hi.
You can try *pydev* which is an IDE based on eclipse for python.
I've never used it with web2py so I can't give you more details. Google is
your friend.

See ya
Tiago

On Wed, Jan 20, 2010 at 6:24 AM, Tweety tweetych...@gmail.com wrote:

 Hello,

 I am a newbie both with web2py, python and computer and web development in
 general. I am trying to digest Massimo's book which I bought from Lulu. I
 just want to ask anybody if they can suggest an IDE that has intellisense
 that can make learning much more easier for me?

 Right now, I am just trying to memorize all the functions and it is really
 hard for me :(

 I am desperate to learn but am wondering if anybody can suggest an IDE that
 can work with web2py that has intellisense?

 I hope someday Web2Py will have intellisense :)

 Thanks 2 you all,

 Tweety

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




-- 

You received this message because you are subscribed to the Google Groups "web2py-users" group.

To post to this group, send email to web...@googlegroups.com.

To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/web2py?hl=en.



[web2py:38100] Re: web2py newbie + google app engine

2009-12-30 Thread reyelts
Thanks Massimo! That was exactly the problem. I had basic GAE working
with Python 2.6, so made the rash assumption that the rest of it would
run safely. I swapped in Python 2.5 and it GAE+web2py runs *much*
better. It serves out pages as expected, etc. It does come up with a
couple of warnings:

WARNING  2009-12-29 15:33:57,886 datastore_file_stub.py:483] Could not
read datastore data from /tmp/dev_appserver.datastore
WARNING  2009-12-29 15:34:17,456 portalocker.py:91] no file locking
WARNING  2009-12-29 15:34:19,212 main.py:50] unable to import
wsgiserver

Are these normal/expected?

--

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




[web2py:38102] Re: web2py newbie + google app engine

2009-12-30 Thread mdipierro
I have never seen the first one.
The other two have to do with the fact that the filesystem is
readonly.
We should remove all those unnecessary warning on GAE they just create
confusion.

Massimo

On Dec 30, 9:21 pm, reyelts reye...@gmail.com wrote:
 Thanks Massimo! That was exactly the problem. I had basic GAE working
 with Python 2.6, so made the rash assumption that the rest of it would
 run safely. I swapped in Python 2.5 and it GAE+web2py runs *much*
 better. It serves out pages as expected, etc. It does come up with a
 couple of warnings:

 WARNING  2009-12-29 15:33:57,886 datastore_file_stub.py:483] Could not
 read datastore data from /tmp/dev_appserver.datastore
 WARNING  2009-12-29 15:34:17,456 portalocker.py:91] no file locking
 WARNING  2009-12-29 15:34:19,212 main.py:50] unable to import
 wsgiserver

 Are these normal/expected?

--

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




[web2py:37986] web2py newbie + google app engine

2009-12-28 Thread reyelts
Hi, I'm relatively new to both web2py and google app engine. I'm
running on Fedora 11. I played around with standalone GAE for a while
and got some things working before jumping to web2py. However, I can't
seem to get web2py to run under GAE. When I start it up, there is a
series of warnings, but it does come up:

$ /opt/google_appengine/dev_appserver.py ~/web2py
/opt/google_appengine_1.3.0/google/appengine/tools/appcfg.py:41:
DeprecationWarning: the sha module is deprecated; use the hashlib
module instead
  import sha
/opt/google_appengine_1.3.0/google/appengine/api/
datastore_file_stub.py:40: DeprecationWarning: the md5 module is
deprecated; use hashlib instead
  import md5
INFO 2009-12-29 03:11:46,875 appengine_rpc.py:157] Server:
appengine.google.com
INFO 2009-12-29 03:11:46,884 appcfg.py:348] Checking for updates
to the SDK.
INFO 2009-12-29 03:11:47,259 appcfg.py:362] The SDK is up to date.
WARNING  2009-12-29 03:11:47,260 datastore_file_stub.py:483] Could not
read datastore data from /tmp/dev_appserver.datastore
INFO 2009-12-29 03:11:47,440 dev_appserver_main.py:399] Running
application web2py on port 8080: http://localhost:8080

When I try to bring it up in a brower, the server logs the following
errors:

WARNING  2009-12-29 03:12:22,704 portalocker.py:91] no file locking
WARNING  2009-12-29 03:12:23,152 main.py:50] unable to import
wsgiserver
INFO 2009-12-29 03:12:23,181 gaehandler.py:55]  Request:
1.76ms/0.00ms (real time/cpu time)
INFO 2009-12-29 03:12:23,201 dev_appserver.py:3243] GET / HTTP/
1.1 303 -
INFO 2009-12-29 03:12:23,221 dev_appserver_index.py:205] Updating /
home/reyelts/web2py/index.yaml
ERROR2009-12-29 03:12:23,264 restricted.py:143] Traceback (most
recent call last):
  File /home/reyelts/web2py/gluon/main.py, line 462, in wsgibase
session.connect(request, response)
  File /home/reyelts/web2py/gluon/globals.py, line 270, in connect
'-'), uuid.uuid4())
  File /usr/lib/python2.6/uuid.py, line 519, in uuid4
_buffer = ctypes.create_string_buffer(16)
NameError: global name 'ctypes' is not defined

INFO 2009-12-29 03:12:23,264 gaehandler.py:55]  Request:
5.43ms/0.00ms (real time/cpu time)
INFO 2009-12-29 03:12:23,296 dev_appserver.py:3243] GET /welcome/
default/index HTTP/1.1 500 -
WARNING  2009-12-29 03:12:25,705 dev_appserver.py:1147] Blocking
access to skipped file /home/reyelts/web2py/applications/admin
INFO 2009-12-29 03:12:25,709 gaehandler.py:55]  Request:
4.89ms/0.00ms (real time/cpu time)
INFO 2009-12-29 03:12:25,736 dev_appserver.py:3243] GET /admin/
default/ticket/unrecoverable HTTP/1.1 400 -

What's going on, here?

--

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




[web2py:37992] Re: web2py newbie + google app engine

2009-12-28 Thread mdipierro
you cannot use Google dev_appserver with python 2.6. It requires
Python 2.5. Google App Engine runs on 2.5.

Massimo

On Dec 28, 9:18 pm, reyelts reye...@gmail.com wrote:
 Hi, I'm relatively new to both web2py and google app engine. I'm
 running on Fedora 11. I played around with standalone GAE for a while
 and got some things working before jumping to web2py. However, I can't
 seem to get web2py to run under GAE. When I start it up, there is a
 series of warnings, but it does come up:

 $ /opt/google_appengine/dev_appserver.py ~/web2py
 /opt/google_appengine_1.3.0/google/appengine/tools/appcfg.py:41:
 DeprecationWarning: the sha module is deprecated; use the hashlib
 module instead
   import sha
 /opt/google_appengine_1.3.0/google/appengine/api/
 datastore_file_stub.py:40: DeprecationWarning: the md5 module is
 deprecated; use hashlib instead
   import md5
 INFO     2009-12-29 03:11:46,875 appengine_rpc.py:157] Server:
 appengine.google.com
 INFO     2009-12-29 03:11:46,884 appcfg.py:348] Checking for updates
 to the SDK.
 INFO     2009-12-29 03:11:47,259 appcfg.py:362] The SDK is up to date.
 WARNING  2009-12-29 03:11:47,260 datastore_file_stub.py:483] Could not
 read datastore data from /tmp/dev_appserver.datastore
 INFO     2009-12-29 03:11:47,440 dev_appserver_main.py:399] Running
 application web2py on port 8080:http://localhost:8080

 When I try to bring it up in a brower, the server logs the following
 errors:

 WARNING  2009-12-29 03:12:22,704 portalocker.py:91] no file locking
 WARNING  2009-12-29 03:12:23,152 main.py:50] unable to import
 wsgiserver
 INFO     2009-12-29 03:12:23,181 gaehandler.py:55]  Request:
 1.76ms/0.00ms (real time/cpu time)
 INFO     2009-12-29 03:12:23,201 dev_appserver.py:3243] GET / HTTP/
 1.1 303 -
 INFO     2009-12-29 03:12:23,221 dev_appserver_index.py:205] Updating /
 home/reyelts/web2py/index.yaml
 ERROR    2009-12-29 03:12:23,264 restricted.py:143] Traceback (most
 recent call last):
   File /home/reyelts/web2py/gluon/main.py, line 462, in wsgibase
     session.connect(request, response)
   File /home/reyelts/web2py/gluon/globals.py, line 270, in connect
     '-'), uuid.uuid4())
   File /usr/lib/python2.6/uuid.py, line 519, in uuid4
     _buffer = ctypes.create_string_buffer(16)
 NameError: global name 'ctypes' is not defined

 INFO     2009-12-29 03:12:23,264 gaehandler.py:55]  Request:
 5.43ms/0.00ms (real time/cpu time)
 INFO     2009-12-29 03:12:23,296 dev_appserver.py:3243] GET /welcome/
 default/index HTTP/1.1 500 -
 WARNING  2009-12-29 03:12:25,705 dev_appserver.py:1147] Blocking
 access to skipped file /home/reyelts/web2py/applications/admin
 INFO     2009-12-29 03:12:25,709 gaehandler.py:55]  Request:
 4.89ms/0.00ms (real time/cpu time)
 INFO     2009-12-29 03:12:25,736 dev_appserver.py:3243] GET /admin/
 default/ticket/unrecoverable HTTP/1.1 400 -

 What's going on, here?

--

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