This method seems to be still in trunk
(http://code.google.com/p/web2py/source/browse/gluon/tools.py#2832), as I
cannot find it in the latest stable.
It takes a user id and return the name/role of the group that user is in.
However, it doesn't seem to be able to work with custom groups. For
I have a couple of questions about the provided Auth.register() function (I
suppose they also apply to other Auth functions in general):
1. In a controller, if I do:
def register():
return dict(form=auth.register())
with the following settings in a model:
I see your point.
Perhaps I should revise my definition of 'static' and 'dynamic': when I
generate an HTML using a view of web2py, everything returned by the server
will stay the same and will potentially change only after I refresh the
page - this is what I mean by static. On the other hand,
I want to implement a page that is served by two backends, one is tornado
and the other is web2py, and this concerns two questions below:
1. The tornado serves the dynamic part of the content on the page (together
with some help from frontend Javascript), while the web2py handles the rest
of
By 'static content', I mean things like the layout, links, labels, buttons,
input fields, tables, etc. On the other hand, values of the labels and
those of the table are dynamic, such that they refreshes themselves as new
values arrive via websockets.
Every other pages of the app will be
Hi,
1. In the web2py book, there is an example for Auth settings, which
presumably resides at top-level inside a model:
auth.settings.register_onaccept.append(lambda form: mail.send(to=
'y...@example.com', subject='new user', message=new user email is %s' %
form.vars.email))
and I wonder
Thanks guys! Very helpful comments and explanations!
Hi Anthony,
I was looking at Carousel JS plugin. For example, I've seen a recent thread
(https://groups.google.com/forum/?fromgroups#!searchin/web2py/carousel/web2py/LZqq06VAUZs/zyQIOgqZKnQJ)
where people encounter conflicts between web2py.css and bootstrap.min.css,
when using Carousel
I see. Note, web2py.css is designed primarily to work with the welcome
app. You don't have to use web2py.css or the welcome app at all, though.
You can instead create the entire front end with pure Bootstrap, and that
should work fine with web2py (if you're using the web2py grid, you
Hi,
I've seen a couple of threads in the group discussing bringing bootstrap 2
together with web2py, and someone mentioned that this will become true in
the coming web2py release.
I just wonder what state this development is in now, are we finally going
to be able to use all the features
I intend to deploy web2py using Nginx and uwsgi on a VPS. On the same
server, I also installed virtualenv to manage other python packages needed
for my application.
At the end of this this setup
scripthttp://code.google.com/p/web2py/source/browse/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh,
I strongly advicee the use of the scheduler because your requirements will
be fullfilled best from that than a homemade task queue, at least, if not
trying to use celery.anyway, just my 2 cents:
SQLITE write operations are locking the entire database. one of 2
controllers (or
I think I'm not mistaken by saying that celery is the most used library
for this kind of operations, it's written in python and founded on rabbitMQ
(also on others, but primarily rabbit) to handle queues. Seems huge, but
it's fairly easy to setup (especially if you planned to use rabbitmq
Hi group,
I am going to implement a homemade task queue as a background process for
updating database, and I have some questions as below:
1. does a background process updating a database interfere with controller
functions that operate on the same database? For example, if I have a task
I've looked deeper into this, and in web2py doc:
http://www.web2py.com/examples/static/epydoc/web2py.gluon.cache.CacheInRam-class.html,
it mentions: This is implemented as global (per process, shared by all
threads) dictionary. A mutex-lock mechanism avoid conflicts.
Does this mean
Thanks for confirming this. The only kind of updates would be adding new
key-value pairs. Having confirmed that this sort of updates will be
consistent on the cache, I am now a little worried about the performance of
doing so, given the mention of the mutex-lock design of the cache.
If
Very nice. Thank you!
Regarding the pros and cons of this approach (in comparison to David's
database approach), I wonder what are the potential pitfalls/risks of the
cache approach. For examples, but not limited to,
1. Is there any consistency issue for the data stored in web2py cache?
Yes, this could be a
Hi group,
Is it possible for one to store incoming user data (e.g. those submitted by
users on a page) in memory, manipulate them in memory, and send them back
with web2py? Or do I need to external modules/libraries to do that? So far,
it seems by default all user submitted data are written
That might be just slightly unsafe, don't you think, if a piece of data
gets evicted before it's needed? I'd prefer to limit caching to data that
can be recreated when it's not found in the cache.
An alternative might be a memory-based SQLite database, taking care not to
let it leak (a
If you just need to store data for a single user across requests, you can
store it in the session (each user has a separate session). But if you need
to store data from multiple users and then process it all together, you can
store it in the cache:
Databases are specially designed for keeping persistent data - so there is
your answer! :)
I suggest:
1. Write the data initially to a transitional Sqlite DB on disk.
2. Once all the data pieces have arrived, migrate the completed data
to your main DB and delete all the
In general, the approach David suggests (
https://groups.google.com/d/msg/web2py/4cBbis_B1i0/KkKnNwUw8lcJ) is
probably preferable, but below are answers to your questions...
user_data = cache.ram('user_data', lambda:dict(), time_expire=None)
# add the data from this user, this should
Hi Bruno,
Any chance of adding English subtitles to this video? Would be a great
resource for everyone! Thanks!
That works! CRYPT() validator is temporarily removed from and added back to
the list of
db.auth_user.password.requires
inside the same function. Thanks!
Actually, looking at the code, auth.user.id should work as well, unless
you have auth.settings.registration_requires_verification = True, in which
case, session.auth.user.id won't work either (but form.vars.id will work
in either case).
I was going to update this post to reflect this,
I am trying to define a function which programmatically logs user in, e.g.
def program_login:
# log-in code
this may be useful for some callback situations, e.g.
auth.settings.verify_email_onaccept.append(program_login)
in which case, user gets automatically logged in only after he/she
Hi Group,
I have something like the following in a model:
def grant_permissions(form):
group_id = auth.id_group(role=request.args(0))
auth.add_membership(group_id, auth.user.id)
auth.settings.register_onaccept.append(grant_permissions)
Basically, I want to assign a user to a group
The new user id should be in form.vars.id as well as session.auth.user.id at
that point.
Thanks Anthony. But is this documented anywhere in the manual or in any doc
of Web2py? Otherwise, it is really difficult for users to figure this out
without consulting experts like you.
You second
to
auth.define_tables()
, in that I sometimes get all those (renamed) Auth tables created but other
times not.
The way I setup my database is as follows.
Use PostgreSQL command line (with username: cyan) to create the db:
createdb mydb
, and create the db object in the account.py model file:
db = DAL
Hi Anthony,
When I say 'sometimes Web2py fails to create Auth tables and other times it
does', I mean running a test procedure like this:
1. if 'mydb' already exists, it is dropped from PostgreSQL server using
'dropdb mydb'
2. a fresh 'mydb' is created using 'createdb mydb'
3. then run the
Hi Anthony,
Great insight! The removal of manual re-direction fixes the email failure!
One follow-up questions:
1. The Web2py manual says that
auth.settings.register_onaccept[]
should be called *before* the re-direction. For my purpose here (i.e.
re-directing the user to a new page after
Thank you!
Hi group,
Two questions relating to two Auth settings:
1. when I set *auth.settings.create_user_groups = False*, I suspect that
'auth_group' table is not created at all after calling
'auth.define_tables()'. Because if I do a 'auth.add_group(...)' after
'auth.define_tables()' in a model file,
Hi Anthony,
Thanks for looking into this.
The model code I am using is as follows:
## use PostgreSQL on localhost
db = DAL(postgres://cyan:123456@localhost:5432/mydb)
#
## web2py authentication utilities ##
#
from
I've just tried it out.
Unzip the latest stable source code of web2py to a folder, say,
web2py_src.
Go to Eclipse - Preferences - PyDev - 'Interpreter - Python'
In the 'System PYTHONPATH' window, add 'web2py_src' to the path.
So far, it seems autocomplete is working without doing all the
(in
Portuguese, but you can follow the code)
On Fri, Apr 13, 2012 at 7:30 PM, cyan wrote:
Hi group,
I am trying to make a minimal multiuser chat-like app using Web2py.
Nothing too fancy here, I just need the app to be able to do the following:
1. client browsers can send the receive text msgs
I think I will just make those fields invisible for now. Defining custom
auth tables seem also a little risky, as it is unclear that which fields
must be kept (except for auth_user, which is used as an example in the
manual) for both current and future releases.
Thanks all!
On Friday, April
Hi group,
I am trying to make a minimal multiuser chat-like app using Web2py. Nothing
too fancy here, I just need the app to be able to do the following:
1. client browsers can send the receive text msgs from a server
2. server may manipulate the msgs received and selectively routes those
Hi group,
Is there anywhere I can find the default schema for the tables involved in
Auth provided by Web2py, namely,
'auth_user'
'auth_group'
'auth_membership'
'auth_permission'
'auth_event'
They're described in the the manual but I would like to see the exact field
definitions for each of
Hi group,
Could someone please let me know how much support exists for redis in
web2py? I've come across
this:
http://code.google.com/p/web2py/source/browse/gluon/contrib/redis_cache.py,
but not sure if redis is officially supported by web2py. If not, any
timeline available? Many thanks.
Hi Group,
I am trying to implement a fairly standard procedure for user registration:
after a user submits his/her email address, an email is sent, and by
clicking on the link contained in that email, the user is registered.
How do we implement this without writing anything to the DB until
, 2012 11:53:37 PM UTC-4, cyan wrote:
Thanks for the pointer. Anthony.
So now I have the following in my controller:
def register():
form = SQLFORM.factory(
Field('email', requires=[IS_NOT_EMPTY(), IS_EMAIL(forced=
'^.*\.edu(|\..*)$',
error_message='email must be .edu address
Hi group,
How do I enforce some simple validation for passwords matching on a form in
a controller? All I want to do is to check the second password is the same
as the first one, and here is some code I've come up so far:
form = SQLFORM.factory(
Field('email', requires=IS_NOT_EMPTY()),
', None)),
error_message=Password fields don't match)
Anthony
On Tuesday, March 27, 2012 5:40:29 PM UTC-4, cyan wrote:
Hi group,
How do I enforce some simple validation for passwords matching on a form
in a controller? All I want to do is to check the second password
Hi everyone,
I'm new to web2py framework, and would like to host some app on
dotcloud (dotcloud.com).
Apparently, people have managed to done this successfully, and I
wonder if someone could share their experience/procedure to deploy a
web2py app on dotcloud.
I've been trying to use dotcloud's
46 matches
Mail list logo