Hello,
I've got an application where I'm sharing a database with a second (non
web2py) framework. I want my web2py application to handle user registration
and would like to avoid users having two passwords (partly so that only
web2py ever writes to the auth_user table).
Inevitably, the hashed
YPT and validators.LazyCrypt, and in
>LazyCrypt, replace the __str__ method with one that calls a custom
>simple_hash function.
>3. Create an entirely new custom hashing validator that replicates the
>algorithm used by the other app.
>
> Anthony
>
> On Th
Hello,
I've got an application with a PostgreSQL backend that shares a small
subset of tables with another application. At the moment, I have Web2Py
defining all the tables and the expectation is that the other application
just read information from the tables (and does what it likes with any
Hi,
I've got an application that shares a DB with another application running a
different framework. The setup is that my application declares a set of
tables that the other application can read from but won't write to, so I
haven't been exploring the mechanisms for connecting to legacy databas
.define_table('key_test2',
Field('id', 'integer'),
Field('oid', length=64, default=uuid.uuid4, rname='"Oid"'),
primarykey = ['id', '"Oid"'])
The error thrown is: primarykey must be a
list of fiel
re where the best place to put that might be - it presumably
shouldn't be in db.py where it will get repeatedly called, but somewhere in
something like a zzz_indexing.py model file that checks first whether the
primary keys have been modified?
Cheers,
David
On Thursday, 18 Augu
Hello,
I'd like to use a simple menu to switch between two possible languages for
content. I've got the content separated out following the markmin
get_content() model so want to use a global variable `lang` to direct the
path of the content to be loaded in pages. I've got a couple of URLs
de
I have a table like this:
db.define_table('visit',
Field('project_id', 'integer', 'references projects'),
Field('arrival_date','date'),
Field('departure_date','date'),
Field('number_of_visitors','integer'),
Field('purpose','text'),
Field('proposer_id', 'integer', 'reference
Thanks for the help. I'm still working on this - I will come back with some
code to show what worked for me - but just wanted to correct another typo
in my code.
The correct syntax for referencing other tables is not:
Field('project_id', 'references projects')
but:
Field('project_id', 'refere
Hello,
I'm trying to use a variable from a form in an onupdate function, but
because I've set it to writeable=False in the controller, it doesn't get
passed in form.vars. In more depth:
I've got a table for volunteers to post offers of help on a project. Those
have to be approved by an admin b
That's the problem - the auth_user row _can't_ be retrieved because
form.vars.volunteer_id is None.
--
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 r
Hello all,
Thanks for the information and help.
- I can see that using SQLFORM simplifies it, but the SQLFORM.grid API
makes it really easy to present a user with a summary table of options that
they can then click into to see details.
- The other options suggested both carry out the query I w
That is exactly what I was looking for. I don't know how it compares for
performance with the record id query, but it makes for very clean code, and
the fact that it exposes the reference table fields is very neat.
Many thanks!
--
Resources:
- http://web2py.com
- http://web2py.com/book (Docume
Hi,
I'm trying to create a view that allows a user to create a new project and
add (existing) users to that project. In order to represent the two tables
on a single page, I've been following a recipe from pyslices:
http://www.web2pyslices.com/article/show/1542/manage-users-and-memebership-in-t
Hi,
I've installed the web2py_ckeditor plugin from:
https://github.com/timrichardson/web2py_ckeditor4/releases
I think this will working really nicely for providing a table of simple
blog posts, but I'd like to control where uploaded files get stored. I had
a look at the source and it seemed li
Hi,
I've got a table 'sites' and a table 'audio', where sites.id =
audio.site_id. I'm trying to create a service that returns a list of sites
with the number of audio recordings at each site, including zero counts.
That's easily achieved using:
sitedata = db(db.sites).select(db.sites.ALL,
o WHERE
> ((sites.id IS NOT NULL)
>
>
> On Sunday, November 25, 2018 at 1:00:56 AM UTC+3, David Orme wrote:
>>
>> Hi,
>>
>> I've got a table 'sites' and a table 'audio', where sites.id =
>> audio.site_id. I'm trying to crea
> > '12:00:00'))
>
>
> On Sunday, November 25, 2018 at 1:34:54 AM UTC+3, David Orme wrote:
>>
>> Thanks for the suggestion. I've actually tried that and get exactly the
>> same results - I read somewhere that using an empty db() could be
>>
Hi,
I'm looking for an approach to validate a user provided WKT geometry. The
obvious answer is to let the spatial backend do the validation, so this
works:
if geometry is not None:
geometry = db.executesql("select
st_geomfromtext('{}');".format(geometry))
except ProgrammingError:
rai
cutesql("select
st_geomfromtext('{}');".format(geometry))
except db._adapter.driver.ProgrammingError:
raise HTTP(404, "Invalid WKT Geometry")
Cheers,
David
On Friday, 15 March 2019 13:21:43 UTC, David Orme wrote:
>
>
> Hi,
>
> I'm looking for an
Hi,
I wanted to see if anyone has opinions on adding ST_Transform in to the
list of available GIS commands. I've only looked at this from the point of
view of PostgreSQL and PostGIS, but there is precedent for having Postgre
only GIS functions. The basic argument is that coordinate transformati
I guess more generally there is an issue with having to do a round trip
through WKT to update a record - it loses precision and is there is an
explicit warning about using it for passing data:
http://postgis.org/docs/ST_AsText.html
I don't see any point in altering how the select represents the
So, in addition to st_transform, I would add st_aswkb. This isn't an
official Postgis command - it provides a method to bypass the automatic
conversion to WKT found in here:
https://github.com/web2py/pydal/blob/master/pydal/adapters/base.py#L550
With a suitably modified PostgreRepresenter, that
Hi,
Just wanted to ask about that recipe. I'm using web2py to provide some
database management pages and then an API to feed data to a front end. The
front end developer is looking for speedups and was asking about deploying
to now.sh, to take advantage of the CDN that sits in front of it for
Hi,
I have two tables: `tx` contains a set of named objects and then `tx_vals`
contain 0 to many possible values for those objects. I want to obtain a
table that contains all named objects in `tx` and one random value from
`tx_vals`. I think that has to be a left join to get the null values wh
Hi,
I'm running a static website from an S3 bucket that calls an API running on
web2py and I've run into a problem with CORS. I can update the headers for
API calls by editing the calls() controller:
def call():
"""
exposes services. for example:
http:///[app]/default/call/json
Hello,
I'm using wavesurfer in a site, so have included it at the bottom of
layout.html.
http://cdnjs.cloudflare.com/ajax/libs/wavesurfer.js/1.0.52/wavesurfer.min.js";>
But then one of my views has javascript code to setup a wavesurfer player.
This is currently included at the bottom of
d page_js}}
>
> This way it will be inserted in the right place into the rendered page.
>
>
> 2017-03-31 11:45 GMT-03:00 David Orme <mailto:david.o...@gmail.com>>:
> Hello,
>
> I'm using wavesurfer in a site, so have included it at the b
Hi,
I'm trying to set up a dropdown on a form to have representation text that
merges information from multiple tables.
The table setup is one where I'm tracking users and datasets associated
with projects. Because project details can get updated, I have a permanent
project id, and the details
That's great. Thanks - I simply hadn't thought that I could switch which
table the IS_IN_DB 'table.value_field' argument was pointing to in order to
shift which fields were available.
To give the specific answer for my case:
db.datasets.project_id.requires = IS_IN_DB(query,
'project_details.pr
Hi,
I've got a controller that is serving up a searchable SQLFORM grid of some
map locations along with a Leaflet map containing the locations. The
underlying table looks like this:
db.define_table('gazeteer',
Field('location', 'string', unique=True),
Field('type', 'string', requires=IS
Hi,
I have a function that checks an uploaded file. I want the check to get
scheduled automatically on upload but I also want admin user to be able to
run the check live from the website (it doesn't take too long). I currently
have a single function in a model that gets shared, but then it has
Aha. That is very helpful. Thanks very much.
Cheers,
David
> On 17 Aug 2017, at 14:20, Leonel Câmara wrote:
>
> That seems fine to me. Note however that you can know if the function is
> being run by the scheduler looking at request.is_scheduler
>
> --
> Resources:
> - http://web2py.com
day, 17 August 2017 11:22:50 UTC+1, David Orme wrote:
>
> Hi,
>
> I have a function that checks an uploaded file. I want the check to get
> scheduled automatically on upload but I also want admin user to be able to
> run the check live from the website (it doesn't take too l
Hi,
I've got a table where I want to group related rows with a unique id. I
could use something like:
next_val = db.table.unique_id.max() + 1
But that does not seem safe against updates happening at almost the same
time (I might be being paranoid). I could also use:
next_val = uuid.uuid4
But
Hi,
I'm collecting dataset files from users. There can be several versions as
problems with the files get fixed and I want to organise the uploaded files
by their common dataset id. So in my controller I do this:
# set the upload directory locally
upload_dir = os.path.join(request.folder, 'uplo
I think that is field.retrieve firmly expecting a string and trying to find
the end character of the lambda function.
So, if that isn't possible, then I need a custom view of the record, which
represents the file with a custom download function that I can pass
new_ds_id to?
On Friday,
at would derail the upload widget in the SQLFORM edit view but
it doesn't seem to. Its probably a simpler way to get a custom download
link that points to the record rather than just the filename, but doesn't
get around the need for a custom download function.
On Saturday, 3 February
#x27;Content-Disposition'] = file_header
# get a stream of the file
path = os.path.join(request.folder, 'uploads', 'datasets',
str(record.dataset_id), record.file)
stream = open(path, 'rb')
return response.stream(stream)
On Saturday, 3 Fe
Hi,
I'm looking at parse_as_rest() to provide an API and can't get it to work
as expected. I have two table: datasets and fields, with a 1 to N
relationship and I want to create an API that returns datasets that have a
field name matching a pattern so (using the tuple version of patterns to
pr
Hi Massimo,
I saw that announcement shortly after submitting the question. I've
downloaded the developer source (/static/nightly, with VERSION contents
"Version 2.18.5-stable+timestamp.2019.04.08.04.22.03") and neither dbapi.py
(nor it's recent rebranding as restapi.py) is in that zip. Is it re
Sorry, being dim. The web2py repo links out to pydal, so I can just clone
web2py/web2py.
Cheers,
David
--
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)
---
Y
Hello,
I've got a table like this:
db._common_fields.append(auth.signature)
db.define_table('locations',
Field('title', 'string'),
Field('capacity', 'integer'),
Field('celcat_code', 'string'),
Field('is_external', 'boolean', default
Well now that is embarrassing. Thanks!
For reference, this was my recipe to put at the top of a file that is going
to populate multiple tables:
if db(db.auth_user).count() == 0:
#Bulk load account
admin_user_id = db.auth_user.insert(first_name='Bulk uploader')
else:
admin_user_id = d
Just to note that I had a similar fix to make and I think this solution is
flawed:
> auth.settings.controller = 'plugin_user_admin'
>
>
It's exactly the right setting, but initialising an Auth instance uses
`settings.controller` to initialise a whole bunch of links and I don't
think these ge
I'm sure I'm missing something obvious but I am trying to alter the
representation of a referenced field in a SQLFORM and failing hopelessly
(Web2Py 2.20.4 on Python 3.7.7). The two tables involved are:
db.define_table('markers',
Field('first_name','string'),
Fiel
Thanks! I had played with the represent attribute, with no success, but
using that first option within the controller works. Changing the validator
seems a bit over the top just to change the format, but it works!
On Tuesday, 11 August 2020 16:07:36 UTC+1, villas wrote:
>
> Off the top of my hea
Thanks for the suggestion. I don't need to create the form programmatically
- the factory is great for that. I've already got code to create the form
but want to create a dummy row on the server side to populate a display
example form.
Cheers,
David
On Sat, 13 Feb 2021, 08:37 Jacinto Parga, wrot
48 matches
Mail list logo