You can try something like this:
def test():
rows = db(db.test).select()
return dict(rows=rows)
def update_level():
for key, value in request.post_vars:
try:
db.table[key].update_record(level=value)
except:
# do something if key is invalid.
this web2py plugin: http://dev.s-cubism.com/plugin_messaging
or, if you want a live chat for all logged-in users you can try pubnub.com
http://jsfiddle.net/nolandubeau/4AWFF/3/
On Wed, Aug 22, 2012 at 4:27 PM, Ray Morris r...@crtpoms.com wrote:
Just wondering if anyone knows a way that one
You have to give id and name to form inputs, and select needs options.
Ttry this on web2py shell
print SELECT(*[OPTION(option, **{_value: option, _selected:selected
if option == 1 else None}) for option in (0, 1)], _name=1, _id=1)
select id=1 name=1option value=00/optionoption
selected=selected
how is your mail config?
from gluon.tools import Mail
mail = Mail()
mail.settings.sender = ?
.server = ?
did you configured the login? is it ok?
use a try block to check which error you get.
try:
mail.send()
except Exception, e:
print str(e)
Em 23/08/2012
You want to create a slug?
web2py comes with IS_SLUG validator which helps with this.
db.define_table(product,
Field(title, unique=True),
...
...
Field(slug, compute=lambda row: IS_SLUG()(row.title)[0]
)
So now you can use slug field to build your urls.
URL(product, show,
which web2py version?
On Tue, Aug 21, 2012 at 7:41 PM, Daniel Gonzalez gonva...@gmail.com wrote:
Hi,
I have defined so my authorization table (db.py):
# Use the authorization table for agents
agent_table = auth.settings.table_user_name
db.define_table(
agent_table,
You are getting an empty rows object
def change_membership():
if request.vars.id:
row = db(db.auth_membership.user_id == request.vars.id).select()
if not row:
redirect(.)
id = row[0].id
form = SQLFORM(db.auth_membership,
You can define classes on models or controllers, the only caveat is that
you can never import that classes in to other modules.
They will be defined and will be available for the current request on
global environment (means that it will be available on the flow of
Not tested, but should work.
in your controllers/default.py
response.view = default/generic.%s % request.extension
def index():
return dict(message=Hello from index)
def contact():
return dict(message=Hello from contact)
then, in your views folder create a generic file:
form = SQLFORM.factory(Field(name), Field(email, requires=IS_EMAIL()))
On Sat, Aug 18, 2012 at 7:11 AM, Simon Carr simonjc...@gmail.com wrote:
Hi,
I understand how to create forms using SQLFORM and FORM, but the latter
does not provide any table formatting as SQLFORM does.
How do I create
are you using auth.signature in any table?
if you have Auth, the auth tables will not be lazy (I think) because it
needs to be defined on auth.define_tables()
On Sat, Aug 18, 2012 at 6:58 AM, David Marko dma...@tiscali.cz wrote:
I have redesigned one of my app by moving requires into Field
What about
db.table.field.readable = True
db.table.field.default = x
?
--
I use Linode (1024 and 2048 instances) powered by NGINX and UWSGI.
Also I am now hosting web2pyslices.com sponsored by
http://pythonanywhere.com, I have plans to move to Python Anywhere when
they release the PRO plan with Postgres.
But if did not needed postgres, I would like to use
http://rochacbruno.com.br/web2py-on-pythonanywhere/
--
def feed(table):
return db(db[table].id0).select()
--
It returns no Row. It return an int object
db(db.person.id 0).count()
*Translates to SELECT count(*) FROM PERSON WHERE ID )*
*So the result is an integer object.*
*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br |
Also, you would get exceptions if table does not exists, so:
def feed(table):
*try*:
return db(db[table].id0).select()
*except* KeyError:
return Sorry, table not found
*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
response.subtitle = *XML*(T('Aggregator for')+A('Company', _href='
http://company.org/'))
*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Open links which points outside your own site in a new
Maybe it can help you: http://rochacbruno.com.br/web2py-routes/
--
I would use something like this:
*import requests*
class IS_VERIFIED_URL(object):
def __init__(self, error_message=url does not exist!):
self.error_message = error_message
def __call__(self, url):
error = None
*response = requests.get(url)*
if
Thats evil! I would create a view or a procedure in database.
On Wed, Aug 15, 2012 at 6:41 PM, pbreit pbreitenb...@gmail.com wrote:
Should I even attempt a complex query like this in DAL? Where do I begin?
$q = SELECT
u.user_id,
u.fname,
u.lname,
u.telephone1,
u.email,
u.is_active,
HI,
I am not updating this project since web2py gets the SQLFORM.grid feature,
But, I am using this on some websites and its working very well for Json
datasources.
Bur you can go and use datatables.net or Jqgrid, or sencha, or wijmo grid (
http://wijmo.com/widgets/wijmo-complete/grid/)
this
On Wed, Aug 15, 2012 at 5:52 PM, pbreit pbreitenb...@gmail.com wrote:
I disagree. Current model definition works fine for vast majority of
projects and the alternatives are still much too confusing IMO.
I just proposed a solution for testing:
http://rochacbruno.com.br/lazy-dal-beta-working/
Taking this exact example
Foreach movie in movies
print movie.title
foreach stars in movie.stars
print star.name
I guess `movie.stars` is a list:string field?
if so.. there's one-liner solution
table = TABLE(*[TR(TD(movie.title), TD(UL(*[LI(star.name) for star in
, delete* methods
But it will only happens depending on your model and relations definition.
Can you share your model for those 2 tables?
On Tue, Aug 14, 2012 at 3:10 AM, Bruno Rocha rochacbr...@gmail.com wrote:
Foreach movie in movies
print movie.title
foreach stars in movie.stars
Thinking again I am guessing a better option for this...
(note: the problem here is not to get the 'key', the problem is to be able
to build the string and interpolate multiple keys on to it on different
running times)
I think this could be better.
auth,messages.verify_email = 'Click on the
in your controller..
if request.args(0) == view:
db.table.field.readable = True
grid = SQLFORM.grid(.)
http://zerp.ly/rochacbruno
Em 14/08/2012 09:37, Mandar Vaze mandarv...@gmail.com escreveu:
I have a few fields that have compute attribute defined. I've only
inserted the records
maybe
{{=prettydate(item.timestamp, *T*)}}
--
If it is a webapp you can start looking here:
https://google-developers.appspot.com/chart/interactive/docs/index
--
use the unary ~ operator
db(~db.table1.field1.belongs(array)).update(field2=False)
Bruno Rocha
www.rochacbruno.com.br
Em 13/08/2012 05:21, Pradeesh pradeeshnara...@gmail.com escreveu:
In my control I have an array with so many values.
I want to write a dal query to update a table rows which
take a look on custom validators
http://rochacbruno.com.br/custom-validator-for-web2py-forms/
Em 13/08/2012 10:54, max dulip.withan...@gmail.com escreveu:
One of my users use german keyboard. is there any possibility for the dot
in a floating point number identified as comma.
for me global
It also happens for me, I did not found a better way to solve, but I think
prettydate needs to be rewritten for accurate responses.
On Mon, Aug 13, 2012 at 6:11 PM, Pystar aitoehi...@gmail.com wrote:
Hi guys,
I am storing my timestamp in my database using the datetime.datetime.now()
You only can call functions that are in global scope.
if you define function in /models/ so you can call those functions in
controllers and views.
If you defined in controller, so you have to return it to the view.
controller/default.py
---
def foo():
return bar
Its Great!
I would like to use Cherokee again! (I used it with Pylons on the past)
On Mon, Aug 13, 2012 at 9:23 PM, Michele Comitini
michele.comit...@gmail.com wrote:
https://github.com/cherokee/webserver
Good to see new commits lately.
mic
--
--
The easy way is
/models/
. nothing here ...
/modules/mymodels.py
from gluon import current
from gluon.dal import DAL, Field
def define_my_tables(*table_list):
db = DAL()
tables_definitions = {
owner: {fields: [Field(name), Field(gender)], format:
%(name)s, migrate:
Thinking again...
It could be better if define_my_tables run once on the very first request
and table keeps defined forever from there
--
Why not:
auth.messages.verify_email = 'Click on the link
http://%(env)s/%(url)s/%(key)s to verify your email' \
% dict(env=request.env.http_host,
url=URL(...), key= lambda : lazy_get_the_key())
Should this works? being lazy_get_the_key() a function which selects
I never knew about web2py.org (what is that? is it a web2py foundation web
site?)
--
No problem!
Thats how plugins works
models/plugin_foo.py
modules/plugin_foo.py
*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: web2py routes https://rochacbruno.snipt.net/web2py-routes/
Get a
db(db.table).select(orderby=random) # does not works on GAE
*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: web2py routes https://rochacbruno.snipt.net/web2py-routes/
Get a signature like this.
That feature exists only for Mysql and Postgres under
scripts/extract_mysql_models.py
You can try to rewrite this for SQLserver, or you can use
db.executesql(RAW SQL)
*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br |
/views/default/index.html
!-- begin --
button class=load_content data-url={{=URL('default', 'otherthing1')}}
data-target=ajax_container Click to load content1 /button
button class=load_content data-url={{=URL('default', 'otherthing2')}}
data-target=ajax_container Click to load content2 /button
On Fri, Aug 10, 2012 at 11:00 AM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
Which web2py version?
On Friday, 10 August 2012 08:39:40 UTC-5, Tito Garrido wrote:
Same error using locals()
:(
On Thu, Aug 9, 2012 at 5:23 PM, Bruno Rocha rocha...@gmail.com wrote:
try to replace
https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.fileuploader.w2p
https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.upload.w2p
+1 Great words Massimo!
its the best conclusion of Programming-Motherfucker method! :)
Em 09/08/2012 10:48, Massimo Di Pierro massimo.dipie...@gmail.com
escreveu:
Listen everybody. This thread is hilarious but not very professional.
I think most of the people on this thread are hardcore
try to replace return dict(GET=GET, POST=POST, PUT=PUT,
DELETE=DELETE) withreturn locals()
I dont know, but maybe its the problem
On Wed, Aug 8, 2012 at 10:49 PM, Tito Garrido titogarr...@gmail.com wrote:
Hi folks,
*I have a simple table:*
*db.define_table('estadio',
did you see the messaging plugin?
web2py.com/plugins
http://zerp.ly/rochacbruno
Em 08/08/2012 01:58, shartha m.mirghorb...@gmail.com escreveu:
Hi, I'd like to implement a messaging system (between the users of the
website), and I need help to implement it. The way I've done it is to
create
In this page: http://dev.s-cubism.com/web2py_plugins you can find a set of
plugins, one of them are message plugin. (experimental, but I used and it
works well)
Also there is a video (in portuguese) about real time message:
https://vimeo.com/38972256
--
Is that SQLITE? did you created it as integer and after that changed to
string?
SQLITE does not have ALTER-TABLE command, so even if you change a field
from integer to string, web2py will see it as string, but the db will still
store as integer.
You need to change the datatype to CHAR() on your
I think you need to use current
from gluon import current
and inside the decorator function access current.request instead of request
On Wed, Aug 8, 2012 at 5:48 PM, Yarin ykess...@gmail.com wrote:
A little more about what I'm trying to do:
I have a decorator function defined in a model
if he is setting the cookie inside a decorator function (inner-function)
maybe it gets defined on the start of the request.
when the decorated function gets passed to the decorator inner-function, I
guess the cookie will be already setted. (but we need to take a look at the
code to figure out the
That is how I am used to work: http://programming-motherfucker.com/
--
replace this:
{{=BEAUTIFY(response._vars)}}
with this:
{{=form}}
--
What do you have in models?
All model files runs alphabetically for each request, so we need to know
what are you doing on model files.
Can you try to test with an empty brand new app, remove all files from
models folder and try your simple controller
import logging
def test():
On Mon, Aug 6, 2012 at 4:19 PM, Felipe Meirelles
fel...@felipemeirelles.com.br wrote:
Without any model I have a huge drop on the cpu use, from around 300ms to
around 60ms. Still higher than with Django, but its acceptable by the
concept of the framework.
Because of that I am using a
On Mon, Aug 6, 2012 at 5:43 PM, Pystar aitoehi...@gmail.com wrote:
but doesnt going your model less route go against web2py tenet of
convention over configuration? although it looks interesting
Yes, my sample code is very complex to implement. And this is why I am
insisting on tests. If
Basically you have to keep in mind that 'orderby and limitby will be
done by the database engine, the db does not know anything about your
lambda' logic.
--
{{=A(XML(i.A.ShortTitle+br /+i.Title) ,_href=URL(r=request,f='
Article',vars=dict(id=i.id)))}}
On Sun, Aug 5, 2012 at 6:02 PM, BlueShadow kevin.bet...@gmail.com wrote:
{{=A(XML(i.A.ShortTitle+\n+i.Title)
,_href=URL(r=request,f='Article',vars=dict(id=i.id)))}}
--
You have an extra u
u = db.user_media_interactions
id = db(u).insert(*user_id*=int(request.vars.user_id),
*lecture_id*=li.lecture_id,
*lecture_item_id*=int(request.vars.lecture_item_id), *rawstring*=istr, *
progress*=prg)
On Sun, Aug 5, 2012 at 6:48 PM, lucas sjluk...@gmail.com wrote:
u =
I think you can generate a KEY in script.js (you need to generate this file
dynamically)
So you will have a key to check back when the widget gets rendered.
On Fri, Aug 3, 2012 at 12:31 PM, Tito Garrido titogarr...@gmail.com wrote:
Hi Folks,
I have created a jsonp function that will be used
routes.py
routers = dict(
BASE = dict(
default_application = 'myapp',
default_controller = 'mycontroller',
default_function = 'function1',
controllers = ['default', 'mycontroller', 'etc'],
functions =
you can also post this in web2pyslices.com
http://zerp.ly/rochacbruno
Em 02/08/2012 13:30, Dirk Krause dir...@googlemail.com escreveu:
Hi,
I tried to pull together the different sources for restful services,
including various hints in this group and of course the excellent web2py
web2py has a more flexible template engine, you can use Python there and
does not need to create a tons of template filters to get simple things
done. Also in Django the template language sucks a lot because of the
limitations.
Let me give an example:
To build a map using google maps API you
HI!
Sorry, it is getting too much hits/day and my VPS are not able to handle.
I am migrating the website to PythonAnywhere.com - which is now the hosting
sponsor for web2pylices.
I hope to get it published there by end of the day.
Thanks
On Tue, Jul 31, 2012 at 1:43 PM, Alec Taylor
I agree that we need to focus on PLUGIN-SYSTEM improvement.
Web2py needs a better plugin architecture, integrated with git/hg repos,
with a distribution tool like PyPi or RubyGEMS (I think plugins has to be
independent Python modules distributed in PyPi and instaled with pip
install
Movu.ca can be used as a base for all those things.
Also, the publushing system that Massimo created can be easily integrated
with Movu.ca for page administrations.
The most complete website I made with Movuca is (
http://www.menuvegano.com.br/) - The whole thing was created for the needs
of
Thanks!
That is a vegan cooking social network. where people has a profile[1] to
post recipes and tips, and also creates a virtual cook book.
It has an Android app for recipe publishing/searching
[1]http://www.menuvegano.com.br/person/show/rochacbruno
--
http://localhost:8000/demo/**setup/installhttp://localhost:8000/demo/setup/install
yields:
invalid function (setup/install)
For security reason, I did a temporary change in setup controller
https://github.com/rochacbruno/Movuca/blob/master/controllers/setup.py
You can see I included a x
Traceback (most recent call last):
File /web2py_github/gluon/**restricted.py, line 205, in restricted
exec ccode in environment
File /web2py_github/applications/**muvuca/views/bootstrap/app/**home.html,
line 423, in module
NameError: name 'featured_members' is not defined
In my point of view mobile projects with PhoneGap have to be RESTful, you
need to create static/JavaScript based pages and use jquery to access the
API created in web2py.
I've done some apps with Tiggzi.com
--
put extension=False in URL
redirect(URL('index2',extension='html',vars={'text':request.vars.text},
extension=False))
--
Good idea, very easy, I am used to do this.
{{=CAT(*[BR() for i in range(5)])}}
--
You can do in the way anthony said, but you can do it all in models, no
need to touch controller code.
models/...py
auth = Auth()
# a dict of controllers as keys, and a list of allowed groups as values
auth_rules = {
You can do in the way anthony said, but you can do it all in models, no
need to touch controller code.
Note, I did suggest moving it to a model file to avoid unnecessarily
executing all the models.
The redirect in:
if not any(has_membership):
redirect(URL(r=request, c='default',
On Thu, Jul 26, 2012 at 12:39 AM, pbreit pbreitenb...@gmail.com wrote:
Wow, you would write that instead of brbrbrbrbr??
Sometimes the repetition is a variable
{{=CAT(*[BR() for i in xrange(*how_many_times*)])}}
--
you dont need to set writable=False. I think it is default for conputed
fields.
I've seem this happening before, but I cant remember the reason. (may be
the writable False can be the issue)
http://zerp.ly/rochacbruno
Em 24/07/2012 07:34, Vasile Ermicioi elff...@gmail.com escreveu:
hi,
I have
yes I think it is a bug.
the update form method checks for writable fields.
should be documented or fixed. can you open the ticket?
http://zerp.ly/rochacbruno
Em 24/07/2012 10:26, Vasile Ermicioi elff...@gmail.com escreveu:
may be the writable False can be the issue
yes, that is,
thanks a
In your view, do you have any link a or any img or any iframe?
My be you have an empty href='' or an empty src='' ?
If you have it, so that is the problem!
empty href or src or rel attributes leads on to form submit problems
--
http://www.bennadel.com/blog/2236-Empty-SRC-And-URL-Values-Can-Cause-Duplicate-Page-Requests.htm
http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/
--
Sounds great!
I would like to see it built in in SQLFORM(..., clientvalidation=True)
On Mon, Jul 23, 2012 at 5:36 PM, Franco franco.alar...@gmail.com wrote:
Greetings everyone, I want to share with you a plugin that adds client
side validation to your forms. I hope this be helpful to you.
do you have an it-it.py in languages folder? looks like the encoding of
translations file is corrupted.
try replacing T with lamba x: x for testing
td{{=prettydate(row.deadline, lambda x: x)}}/td
On Mon, Jul 23, 2012 at 1:28 PM, ctrlSoft zerooo...@gmail.com wrote:
yes.
there is no request.auth_user by default, did you created this?
I think you can do (with trunk)
{{if thisgroupid in auth.user_groups:}}
--
, Jul 24, 2012 at 5:36 AM, Alec Taylor alec.tayl...@gmail.comwrote:
On Tue, Jul 24, 2012 at 5:09 AM, Bruno Rocha rochacbr...@gmail.comwrote:
there is no request.auth_user by default, did you created this?
I think you can do (with trunk)
{{if thisgroupid in auth.user_groups
Also, there is a nice example in the web2py cookbook
Source code is here:
https://github.com/mdipierro/web2py-recipes-source/tree/master/source/04_advanced_forms/06_Creating_a_Form_Wizard
App is here:
fixed link for app:
https://github.com/mdipierro/web2py-recipes-source/raw/master/apps/04_advanced_forms/web2py.app.form_wizard.w2p
--
That works on my Galaxy S -
http://www.web2pyslices.com/slice/show/1490/how-to-install-web2py-on-android-for-fun-without-rooting-the-device
--
Yeah, sorry.
I have to upgrade my Linode, also, bots from google and baidu are eating my
server. I need to solve some sessions problems.
I will upgrade the Linode for webslices and also I will put a bigger
donate, sponsor link in web2pyslices website, I am paying backups and
hosting by my own,
Well, I think web2py.com and web2pyslices.com needs a better hosting
solution.
On Fri, Jul 20, 2012 at 2:22 PM, Dave davidramsayreinh...@gmail.com wrote:
can't get to the website today.
--
--
I could not be able to restart NGINX/UWSGI, I am waiting my backups to
finish and I will need to restart my Linode. The same problem :/
On Fri, Jul 20, 2012 at 3:58 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:
Anyway, considering they have different hosting it is suspicious they
I dont know if it is a bug or feature (but I like it), you can do it in
models!
models/0_routing.py
if request.controller in MYLISTOFGROUPS:
groupslug = str(request.controller) # here you can use deep copy or
just str()
request.controller = 'group'
request.function = 'show'
are you sure the migrate is not False in db = DAL(...) ?
try including migrate=True in your define_table
On Fri, Jul 20, 2012 at 6:17 PM, Marek Mollin rog...@gmail.com wrote:
Hey,
Problem is as follows.
I start a clean db in psql. Test the connection + delete all the
/databases files to
The only problem here is WHO will build the Killer web2py CMS?
Instant Press is built by @Martin and I dont know if he gets contribution
Movu.ca is built by @rochacbruno (me) and I did not get too much
contribution (two or 3 people helped with ideas and translations)
Sorry community, but we do
IMHO the real question is *what is the cause of plugins little usage?*
The misunderstanding of plugin system, to be honest I think the web2py
plugin system is not good.
Now with modules, we can have a better base for plugin development.
--
controllers/default.py
from tenjin import *
from tenjin.helpers import *
engine = tenjin.Engine(path=['views'])
def index():
context = dict(form=SQLFORM(db.table))
return engine.render('page.pyhtml', context)
That should works!
I would set a Dropbox shared folder on both machines (there is a server
dropbox.py for linux)
So create a script which copies the .sqlite in to Dropbox folder.
On city machine a scheduled task read records on sqlite and import new
records directly to mysql.
You are going to need a 'signal'
You need to use the url like this
img src='+URL('static', 'images', args='poweredby.png', host=True,
scheme=True)+'/
--
The conditional models are good, but the problem is the fact that they are
not reusable, when you need the same table on multiple controllers, or you
have to define it globally, or you have to repeat the definition on every
sub model.
I think having a module with functions or classes to define
if request.function == 'new':
db.mytable.myfield.readable = False
db.mytable.myfield2.readable = False
db.mytable.myfield3.readable = False
On Tue, Jul 17, 2012 at 5:16 PM, Ashraf Mansour ad...@aqar-riyadh.comwrote:
Hi,
How can i hide columns in the create form generated by
I am having a related problem.
Your Linode, blouserver, has exceeded the notification threshold (1000)
for disk io rate by averaging 1382.77 for the last 2 hours:
I receive this message every 2 hour, so my nginx get bas gateway and I need
to do rm sessions/* and also /etc/init.d/uwsgi restart
16, 2012 8:14 AM, Bruno Rocha rochacbr...@gmail.com wrote:
I am having a related problem.
Your Linode, blouserver, has exceeded the notification threshold (1000)
for disk io rate by averaging 1382.77 for the last 2 hours:
I receive this message every 2 hour, so my nginx get bas gateway and I
301 - 400 of 2316 matches
Mail list logo