Agreed that the web2py itself shouldn’t require python 3, but python 2 is no
longer the default for Ubuntu, and a public configuration recipe should reflect
that.A user who really needs 2.7 for their projects will be able to adapt
it without much effort.
From: web2py@googlegroups.com On Be
Agree that the changes merit a pull request, and the script should now be
py3-specific, since we're past py2 EOL.
Re. problem 3, I think the script once handled ubuntu/debian versions with
initd OR systemd, and that the init config is long obsolete and should be
removed. It was useful having b
I'd look at the apache logs. I ran into the same problem with an
nginx/uwsgi config, and uwsgi's logs pointed me to the fact that I had the
wrong group on the application's file permissions.
On Friday, 1 May 2020 18:52:02 UTC+1, Ian W. Scott wrote:
>
> What are the "likely culprits" I should be
The new pyDAL version included in 2.19.1 causes problems where multiple
URIs are provided to the DAL, but the first is non-functional (e.g. a
mirror)
See details at:
https://github.com/web2py/pydal/issues/620
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://
Should be, but it can depend on what other tools you're using in web
stack. E.g., the steps it'll take to get Apache running two different
environments are different from the steps to get NGINX/Uwsgi, or Gunicorn.
On Saturday, 14 March 2020 19:06:20 UTC, Andrea Fae' wrote:
>
> Is it possible to
Simplest fix: use "any" instead:
{{for bookings in bookings:}}
{{if any(bookings.company in q.customer.company for q in quotes):}}
Quoted
{{pass}}
{{pass}}
To avoid all this looping, you could have a separate query join the two
tables and count the matches.
On Saturday, 18 January 20
Yes, that should work.
I have three web2py instances on a server running nginx/uwsgi, and the
principle's the same: slightly different configs for each instance,
pointing to separate source files.
On Tuesday, 21 January 2020 11:37:55 UTC, Manuele wrote:
>
> Hi!
>
> If I need to manage on the s
Admittedly, splitting a lot of the functions into a module would be the
best solution.
We recently had the same challenge, and moved a bunch of functions from our
default controller into their own functions, without having to change
frontend calls. This only worked because the functions were i
, I think
> you will need to different instances of Redis.
>
>
> El viernes, 7 de junio de 2019, 7:09:26 (UTC-3), Tim Nyborg escribió:
>>
>> Thanks for this. Let me know if you find a resolution to the 'saving to
>> disk' latency issue. Redis sessions wou
from Redis configuration. The first one sets the max amount of
> memory that Redis is allowed to use, and "maxmemory-policy" allows you to
> choose how Redis should evict keys when it hits the maxmemory:
> https://redis.io/topics/lru-cache.
>
>
> El jueves, 6 de jun
This is really good to know. I've a similar architecture to you, and am
planning to add redis to the stack soon. Knowing about issues to be on the
lookout for is very helpful.
On Friday, 24 May 2019 16:26:50 UTC+1, Lisandro wrote:
>
> I've found the root cause of the issue: the guilty was Redi
My guess is that something is wrong with the file permissions on the
sessions folder/subfolders. If uwsgi is trying to write a session file and
failing, you'll get an unrecoverable error.
On Wednesday, 8 May 2019 07:49:34 UTC+1, tomasz bandura wrote:
>
> Hello,
>
> I use web2py (2.16.1) on 2 en
The web2py book's example could use replacing, since it relies on using
__init__ and returning (value, error) rather than using def validate and
returning value or raising ValidationError
On Sunday, 7 April 2019 05:36:13 UTC+1, Massimo Di Pierro wrote:
>
> we will fix the backward incompatibilit
Apologies. Left a lot of cruft in there which should be edited out now.
On Wednesday, 3 April 2019 17:10:49 UTC+1, tim@conted.ox.ac.uk wrote:
>
> That will be different. SQLFORM.grid doesn't support aggregation, so
> you'll need to use virtual fields to do the work, which is what I do to
>
That will be different. SQLFORM.grid doesn't support aggregation, so
you'll need to use virtual fields to do the work, which is what I do to
show invoices along with their current calculated balance. It's not
sortable, though.
Something like:
def is_operador(row):
return not idb(
I think that implicit conversion of "auth_group.role = 'Operador'" to a 1
is a Sqlite-specific thing. What you want to use here is case:
query = db().select(
db.auth_user.id,
db.auth_user.username,
db.auth_user.canceled_on,
db.auth_user.canceled_by,
(db.auth_group.role == 'Op
You set the default in client:
db.define_table(
'client',
Field('city', db.city, default='Value here'),
)
On Friday, 9 November 2018 04:59:23 UTC, mostwanted wrote:
>
> if i have 2 table client and city and have city referenced in client, how
> do i set a default value for city that wil
Is it possible for cache.ram to work if running on nginx/uwsgi,
particularly with multiple processes?
I don't really care if each of my processes (4) winds up with its own cache
in memory, but they seem to expire very quickly.
Moving to cache.disk or Redis may be the way to go, but if simple
Are you setting the PDF's title before streaming it?
pdf.set_title('Whatever you want to appear in the tab')
pdf_stream = pdf.output(dest='S')
On Thursday, 6 September 2018 13:16:32 UTC+1, Simona Chovancová wrote:
>
> Hello.
> I have a backend function that is supposed to stream a pdf file, but
You need to use the onvalidation option in SQLFORM to do validation
spanning several columns:
def _validate_other(form):
if form.vars.select_field == 'Other' and not form.vars.other:
form.errors.other = 'Please provide a value'
form = SQLFORM(table, onvalidation=_validate_other)
for
You can put conditions into the field validator:
Field('writer_user', 'string',
requires=IS_IN_DB(
db(
(db.auth_user.id == db.auth_membership.user_id)
& (db.auth_membership.group_id == db.auth_group.id)
& (db.auth_group.role
I've done this with a table with a year as its id:
idb.define_table(
'next_id',
Field('year', 'id'),
Field('next', 'integer'),
)
def get_next_id(year):
record = idb.next_id(year)
if not record:
# Auto add new years
idb.next_id.insert(year=year, next=1)
If you want to avoid javascript magic, you'll want to create a custom
widget, probably something extending a dropdown. However, there are nice
lightweight js libraries for adding images to dropdown options.
On Tuesday, 9 January 2018 12:33:07 UTC, Dragan Matic wrote:
>
> I would like to have an
My interim solution for computed fields is to set writable=False. It's
fixed problems with form submission.
On Tuesday, 2 January 2018 19:02:30 UTC, José Leite wrote:
>
> It seems that compute fields are not working anymore with web2py 2.16.1.
> Can not generate thumbnails anymore.
>
> Is there
Answered my own question: SQLFORM.grid(ui={...})
So either solution is fine.
On Monday, 4 December 2017 16:45:38 UTC, tim.n...@conted.ox.ac.uk wrote:
>
> Since I use fa icons all over the place, and do a fair bit of styling on
> top of the w2p css, I'd sooner see 'fa fa-{name}' rules. Not as cle
Since I use fa icons all over the place, and do a fair bit of styling on
top of the w2p css, I'd sooner see 'fa fa-{name}' rules. Not as clean as
.icon, I admit, but it makes it easier for global rules to affect the grid.
Is it possible to pass a dict of custom icon class strings to the grid, so
Has anyone gotten field.show_if to work with the built-in radio button
widget?
We've a typical show_if:
idb.amendment.transfer_module.show_if = idb.amendment.transfer_type == 1
And it functions just find if transfer_type uses
SQLFORM.widgets.integer.widget
or ...options.widget, but not ...radio
I'm not sure I understand the link between student and student_class. Does
student.class_name reference class_name.id?
Anyway, I think you need to be joining things up properly, and grouping by
student:
def generate_report():
marks=db(
(db.student_class.class_name=='5A')
&
I'm not sure I understand the link between student and student_class. Does
student.class_name reference class_name.id?
Anyway, I'd do something like this:
def generate_report():
marks=db(
(db.student_class.class_name=='5A')
& (db.student.class_name == db.student_class.id)
I think you need to give a bit more context. What are your model
definitions for db.student_class and db.marks? Does each student have
multiple rows in the marks table?
On Thursday, 30 November 2017 09:12:14 UTC, mostwanted wrote:
>
> I'm at the brink of pulling my hairs out!!!
> Can please pl
Your grid should be using a query that brings in both tables, rather than
just the Voyages table:
def Voyages():
Voyages = SQLFORM.grid(db.EQ_Voyages.Vessel == db.EQ_Vessels.id, fields
=[db.EQ_Vessels.VesselName, db.EQ_Voyages.VesselNumber], csv=False, orderby
=[db.EQ_Vessels.VesselName, db.EQ
Actually, this should be simple enough that I can post a fix.
On Friday, 21 July 2017 09:35:34 UTC+1, tim.n...@conted.ox.ac.uk wrote:
>
> Creating a SQLFORM.factory() from tables, or a combination of tables and
> fields, now breaks, because the underlying logic assumes the tables are
> fields:
>
Creating a SQLFORM.factory() from multiple tables, or a combination of
tables and fields, now breaks, because the underlying logic assumes the
tables are fields:
form = SQLFORM.factory(idb.catering, idb.catering_diet)
File "/home/www-data/internal-apps/gluon/sqlhtml.py", line 1922, in factory
Below is something similar I've been playing with. The interface is utter
garbage, but it shows the general idea. A form that allows you to select
fields and aggregation per field:
Manage a list of queries fields, adding in the field or its .sum() or
.count() method as necessary. Where you're
Very impressive. Especially impressed by the 'Save for later' process,
which I bet I'll end up copying.
On Wednesday, 14 June 2017 14:36:18 UTC+1, Ian Ryder wrote:
>
> Hi all, not sure if it's OK to do this - slap me down if not!
>
> We're just about to launch a new tool / site based on web2py -
Re #3: I highly recommend swapping in Eonasdan's bootstrap-datetimepicker:
https://github.com/Eonasdan/bootstrap-datetimepicker
I just altered my web2py_ajax.html to swap dependencies and initialize
datepickers:
# response.files.insert(1,'/inc/css/calendar.css')
# response.files.insert(2,'/inc/
Looks like the issue is: str(query)
The query is a unicode object by default, and á can't be converted to a
string, since it's outside the ascii character set.
Try this instead:
print u"DEBUG: query = " + query
On Tuesday, 30 May 2017 11:07:30 UTC+1, Karoly Kantor wrote:
>
> Please help:
>
> I
I use this same stack, and ran into encoding issues when updating the
database, because of FreeTDS v.91.
But upgrading to FreeTDS v1.00.40 fixed all unicode issues:
https://github.com/mkleehammer/pyodbc/issues/244
Connect with mssql4n, TDS_Version 7.1+, no need to set db_codec
On Friday, 19 May
You'll also want to set auth.settings.formstyle
I've built a form style, placed it in a model (style.py), and then set
response.formstyle and auth.settings.formstyle
On Tuesday, 25 October 2016 15:52:12 UTC+1, Marko Seppälä wrote:
>
> Hi,
>
> I'm trying to set custom form styles for auth, like r
It may be a bad move, but I defined IntegrityError in a model, so it can be
nice and terse everywhere else:
IntegrityError = idb._adapter.driver.IntegrityError
Where I have two different databases, I just added it to the database
objects:
db.IntegrityError = db._adapter.driver.IntegrityError
idb
Looks like you want a subquery. You'll need to decide which of the items
to choose when you have a given category_code.
Say you want the first item with a given category code:
sub_query = db()._select(db.products.id.min(),
groupby=db.products.category_code)
results = db(db.products.id.belongs(s
I've been thinking about doing this exact thing for a while, so I'll be
eagerly watching your plugin
On Thursday, 11 February 2016 16:18:28 UTC, Carlos Cesar Caballero wrote:
>
> Hi, right now I am working in a plugin with an autocomplete widget using
> typeahead.js:
>
> https://github.com/daxs
Lovely! I was just about to post this problem.
On Tuesday, 9 June 2015 07:56:35 UTC+1, Paolo Valleri wrote:
>
> I see the problem now, thanks for pointing it out.
> I'll post a fix later today.
>
> Paolo
>
> 2015-06-08 22:11 GMT+02:00 Donatas Burba >:
>
>> This is failing example:
>>
>> db=DAL('
Here's a question for those of you experienced integrating MSSQL and web2py.
My web2py apps connect to a legacy SQL Server 2005 database, but I'm
running into a problem where any attempts to *insert *unicode data into my
nvarchar fields breaks the encoding (Renée -> Renée)
It seems the Unicode
I'm using a custom formstyle to apply bootstrap3 to my forms (a modified
copy of the built-in bootstrap3_inline). Importantly, it adds the
form-control class to each input.
This works fine, until you define a widget for a field, and have it fail
validation.
db.define_table('test',
Field('
Depends on how you're implementing the widget.
I've got a CKEditor widget as follows (pretty much a glorified copy of
text.widget with the ckeditor class):
class CKEditor(FormWidget):
_class = 'ckeditor'
@classmethod
def widget(cls, field, value, **attributes):
"""
Your first suggestion's clever, and not too hard to extend. Have a list of
admin functions, check if request.function is in it.
At the moment, I've got a disabling routine, and pass all the table names:
def suppress_timestamp(*tables):
#Stop updating of modified_on and _by, given a l
form = SQLFORM.factory(
Field('Presupuesto', requires=IS_IN_DB(db, db.presupuesto,
*db.presupuesto._format*)),
submit_button='Continuar',
table_name='presupuesto',
)
On Monday, 26 January 2015 16:09:31 UTC, César Bustíos Benites wrote:
>
> Hello! I have a table called
'but I get "abcDEF"'
How did you get that?
form=FORM(INPUT(_type="text", _name="n", requires=IS_LOWER()))
if form.process().accepted:
response.flash = form.vars.n
The above spits out 'uppercase' when I entered 'UPPERCASE'
On Tuesday, 27 January 2015 15:15:34 UTC, mweissen
I'm really liking the ability to automatically timestamp when records are
updated, but I'm wondering if there's a simple way of suppressing this
behaviour when needed:
I have these signature fields appended to a number of tables, automatically
recording when users update records:
signature_fiel
I haven't found a solution to this, but have found more detail about the
problem:
The first defined autocomplete widget on a particular field overrides ALL
others defined after.
idb.define_table(
'fee',
...
Field('module_code', 'string', writable=False, label='Module code',
Found my mistake; hopefully it will save someone time in the future.
Multiple autocompletes referring to the same field need keyword arguments,
otherwise they all end up as the
default '_autocomplete_%(tablename)s_%(fieldname)s'
(_autocomplete_module_code in my case). Once I gave them distinct
After some further digging, I'm not sure map_hyphens can possibly work on
application names as things sit.
In map_app() in rewrite.py, the incoming app name is never translated. I
added the following code near the top of the function, and everything
started to work.
if routers.BASE.ma
I've put Routes.py in the root web2py directory. You may be right about a
bug, though. I've loaded up a fresh local copy of web2py, created an app
called a_b, and set up the routing:
routers = dict(
# base router
BASE=dict(
default_application='welcome',
map_hyphen=Tru
Does anyone know how to get map_hyphen to work with an application name?
I have a routes.py setup as follows:
routers = dict(
BASE = dict(
default_application = "home",
default_controller = "default",
default_function = "index",
map_hyphen=True,
),
That's the method I use, more or less, as it seems the simplest and most
reliable to set defaults.
Would it be easier if those fields were writable = False and readable =
False in the model, and the other form used ignore_rw=True?
You might also put
db.registrations.registered_user.default = au
Or, on the slightly simpler side:
before you call SQLFORM.grid():
from gluon import TAG
db.house.location_type.represent = lambda value, row: TAG.abbr(value,
_title=row.location_type_msg)
db.house.capacity.represent = lambda value, row: TAG.abbr(value,
_title=row.capacity_msg)
--
Resources:
It's easy enough if you have a separate search-form:
searchform = SQLFORM.factory(...)
form = None
if searchform.process().accepted:
form = SQLFORM.grid(...)
If you're wanting to use the built-in grid search tool, you could set the
query to return 0 results unless keywords is in get_vars:
d
Clever.
I took the route of replacing the Button with an anchor that submits the
form via javascript:
export_form = FORM(LABEL('Export batch #'),
DIV(
INPUT(_type='text', _name='number', _class="span2",
_id="appendedInputButton"),
I have a form which allows a user to download a CSV, given a batch number,
without having to leave the page. However, I'd like to allow form
re-submission, since the user might want to run the CSV export several
times. Web2py.js disables buttons on form submission, but is there a
simple way t
I've run into an odd problem with autocomplete:
I have a factory form doing an autocomplete lookup on the field
idb.module.code, with custom help_fields, etc., and it works well:
browseform = SQLFORM.factory(Field('code', widget=SQLFORM.widgets.
autocomplete(request, idb.module.code, id_field=id
Is it possible to have a string or text field's length parameter
automatically populate the SQLFORM-generated input's maxlength?
Such that:
Field('personname', 'string', length=32, label='First name',
requires=[IS_LENGTH(32), IS_NOT_EMPTY()]),
Will produce:
I know I can add the parameter to t
I'm connecting to a legacy MSSQL database, and have an important table which
has an alphanumeric primary key:
db.define_table('module',
Field('modid', 'string'),
...
primarykey=['modid'])
When I generate an update SQLFORM (form = SQLFORM(db.modu
gt; why the overcomplication ? as other backends that don't support date every
> date field in DAL gets turned to a datetime (with 0 hours, minutes and
> seconds) and it's automatically handled.
>
> On Wednesday, February 12, 2014 6:31:06 PM UTC+1, Tim Nyborg wrote:
>>
>> I
I'm connecting to an MSSQL 2005 db, which only has the Datetime format
(Date was added in 2008).
Is there a standard way to treat a Datetime as a Date in web2py for forms
and formatting?
I've done the following, and it works thus far, but it seems a bit hackish.
Field('BirthDte', 'datetime',
65 matches
Mail list logo