I think this question is more about PyDAL than web2py. What I'm doing is
using the web2py shell to call functions and do stuff within a web2py app,
but without actually running the web server. Everything happens within a
Python shell. In this environment, database transactions are not
automa
On Thursday, December 14, 2017 at 4:10:40 AM UTC-8, Anthony wrote:
>
> Could be a little complicated. The relevant code is in gluon.restricted --
> see
> https://github.com/web2py/web2py/blob/4f51647b2f5bd68887ddd9fe139c6bbc0fa885d4/gluon/restricted.py#L115
> .
>
>
That is unfortunate. Would be
In some situations, when my web2py code raises an exception, what I want to
do is log information about what happened, but then handle it in some way
that doesn't involve the default error handling. The advantage of the
default error handling, though, is that it generates an error ticket. Is
On Wednesday, December 13, 2017 at 8:40:18 AM UTC-8, Anthony wrote:
>
> You'll either have to first retrieve the total record count or just use a
> number you know will be larger than the record count. Feel free to open an
> issue in the PyDAL repo.
>
> Note, not all databases support "offset" w
I would like to be able to do a query that does something like "give me the
rows from the Nth row to the end, no matter how many rows there are". I
can use limitby to get the first N rows, but I can't find a way to say "get
all rows except for the first N rows". This seems especially perverse
On Wednesday, September 20, 2017 at 10:31:04 PM UTC-7, Massimo Di Pierro
wrote:
>
> In web2py, and in general in code that runs multithreaded you should not
> define variables in modules at top level and then import them because they
> are cached and then shared by multiple threads. That is not
It seems that the "db" object given by the DAL wraps up not only the
database definition, but also a "live" connection to the database. This
means that if the db object is stashed somewhere, it can go "stale" and
attempts to use it later will lead to strange errors. Is that so?
What I'm tryin
Is it considered kosher for controller functions to add their own custom
data to the request object? I didn't see anything in the docs about this.
For instance if a controller wants to do request.some_stuff = 123, is that
"allowed"?
The reason for this is that I have some library functions ca
On Thursday, August 31, 2017 at 8:05:51 AM UTC-7, Anthony wrote:
>
> Here is a variation of something I use in Jupyter notebook:
>
> import os
> import gluon.shell
> from gluon.settings import global_settings
> from gluon.storage import Storage
>
> def web2py_environment(app, controller=None, web2p
I use DreamPie, a wrapper around the Python interpreter. I would like to
be able to use the web2py console shell from within DreamPie. I could also
imagine wanting to use it from within other alternative Python
interpreters, for instance inside the IPython QT console or a console
embedded in
On Monday, July 31, 2017 at 1:25:31 PM UTC-7, Paolo Caruccio wrote:
>
> Maybe the web2py book could help you:
>
>
> http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=with_alias#Self-Reference-and-aliases
>
>
That appears to only be talking about using aliases f
On Monday, May 29, 2017 at 11:30:53 PM UTC-7, Brendan Barnwell wrote:
>
> When running queries that do joins, I often find the format of the result
> somewhat cumbersome, with its nested structures representing the different
> tables in the join. If I were writing the query in raw
On Thursday, June 29, 2017 at 8:27:01 AM UTC-7, Anthony wrote:
>
> You need to have at least a basic routes.py in the root /web2py folder,
> but for application specific routing, you can also put a routes.py file in
> the application folder (i.e., in /web2py/applications/myapp/).
>
Okay. . . but
Looking at the routing discussion in the docs, it seems that any kind of
custom routing has to be defined at the global level of the entire web2py
install. Is that correct? This seems awkward if I want to write an app
that carries with it its own knowledge of how it wants to route its
interna
>
> You can put anything that would go on a full page (including any form) in
> an Ajax component. Forms in components are submitted via Ajax (they are no
> less "real" than forms loaded in full pages), and only the component itself
> refreshes upon submission. It is not quite clear what else y
On Wednesday, June 7, 2017 at 8:16:38 PM UTC-7, tesser...@gmail.com wrote:
>
> According to github, there were semi-regular releases going back to 2013,
> then they stopped about a year ago, so I guess it's only natural for people
> to wonder about the status of the project. Personally, I'm wonde
When running queries that do joins, I often find the format of the result
somewhat cumbersome, with its nested structures representing the different
tables in the join. If I were writing the query in raw SQL, I would
probably use "AS" clauses to select just the columns that I want, with
simple
Does web2py provide any kind of utility to convert the request args and
vars "intelligently" into regular Python types? Values passed in the URL
or query string will always be received as strings by web2py code, but in
many cases they really need to be converted to other types. In a URL like
On Saturday, February 18, 2017 at 6:00:23 AM UTC-8, Anthony wrote:
>
> Do you have a use case that cannot easily be accommodated by that pattern?
>> If so, what do you imagine would be the API for doing what you want to do,
>> and would it look much different from simply making an HTTP call (or
> The simplest approach is to put shared functionality into modules. Of
> course, if you don't know in what context a given bit of code will run, you
> can easily check whether particular tables have been defined and then call
> the table defining code if necessary.
>
> Maybe it would help to
On Thursday, February 16, 2017 at 6:39:37 AM UTC-8, Anthony wrote:
>
> In your example above, it's one model defining tables from another model.
>> But in my case, what I have is a controller function that needs access to
>> the db, which is defined in the model file. But I found the hard way (
On Friday, January 13, 2017 at 8:21:48 AM UTC-8, Anthony wrote:
>
>
> You can use the DAL from modules as well. As Niphlod suggested, you can
>>> also use the scheduler to schedule and run a task in the context of another
>>> app, though that might not be as fast as you'd like, as even setting
>
On Saturday, January 21, 2017 at 8:52:55 AM UTC-8, Anthony wrote:
>
>
> I created an issue here: https://github.com/web2py/web2py/issues/1561
>>
>> I can probably do a pull request, but wanted to see if anyone knows of a
>> reason why the existing service functionality restricts the passed
>> ar
On Thursday, January 12, 2017 at 1:17:30 AM UTC-8, Anthony wrote:
>
> Feel free to open a Github issue, or better yet, send a pull request.
>
I created an issue here: https://github.com/web2py/web2py/issues/1561
I can probably do a pull request, but wanted to see if anyone knows of a
reason why
On Wednesday, January 18, 2017 at 2:12:35 PM UTC-8, Anthony wrote:
>
> A web2py controller is not like a Python module. It is meant to be
> executed in a prepared environment to generate the response to an HTTP
> request. Because the top level of the controller may include code you
> wouldn't wa
I recently dug into web2py and discovered how it decides which controller
functions are exposed as endpoints. I found that it does this with the
find_exposed_functions function in compileapp, which uses a regex to
textually search the source code of the controller file for lines of the
form "d
On Saturday, January 7, 2017 at 11:07:36 AM UTC-8, Anthony wrote:
>
> On Saturday, January 7, 2017 at 1:57:36 PM UTC-5, Brendan Barnwell wrote:
>>
>> The shared functionality involves DB access, so as far as I can tell it
>> cannot be abstracted into modules that would
On Thursday, January 5, 2017 at 7:04:56 AM UTC-8, Anthony wrote:
>
> But from the other side of things, I guess the question is, if we can do
>> that, is there ever any reason to use the "service" mechanism at all? Or
>> can request.restful do everything service can do, and more?
>>
>
> I suppos
Python modules that can be imported by multiple applications.
>
> Anthony
>
> On Thursday, January 5, 2017 at 12:54:59 AM UTC-5, Brendan Barnwell wrote:
>>
>> I have a situation where I have (or am going to have) multiple
>> applications running on a single web2py instance.
I have a situation where I have (or am going to have) multiple applications
running on a single web2py instance. Each application will do its own
thing, but they are all using the same databases. Some of the applications
may serve as backend API endpoints where certain kinds of data can be
re
It looks like I could use request.restful for that, but to be honest I find
that mechanism somewhat awkward. Creating functions as local variables and
then returning locals() just seems gross to me. :-)
But from the other side of things, I guess the question is, if we can do
that, is there ev
Just bumping this up to see if anyone has any ideas, as I have again run up
against this limitation.
The situation I'm in is that I have a number of controller functions which
all accept some arguments in common (for instance, an API key that has to
be checked to allow access to the resource).
I notice that the pydal Expression class defines magic methods for most
math operations, letting you create expression queries like
`.select(db.Table.field*2)`. However, it doesn't define a __pow__ method,
so I can't do something like `.select(db.Table.field**2)` to get a computed
result that
On Monday, November 14, 2016 at 1:01:26 PM UTC-8, Anthony wrote:
>
> On Monday, November 14, 2016 at 1:29:11 PM UTC-5, Brendan Barnwell wrote:
>>
>> You're right that dict.get handles the default value, but the
>> functionality available for args includes substantia
hod from List (with a couple
modifications at the beginning because it's delegating to dict keys rather
than list indices). Would there be interest in making this change to
web2py?
On Monday, November 14, 2016 at 9:50:19 AM UTC-8, Anthony wrote:
>
> On Monday, November 14, 2016 at
The request.args object has a handy callable interface that allows
specification of default value, type to coerce to, etc. As far as I can
tell, the request.vars object has no such interface. Is this right? Why
is this? What can I do if I want to access various vars that may or may
not be p
Hi, I've been experimenting the web2py services functionality. Very neat!
But what I'm wondering is whether it is possible to expose a service that
accepts arbitrary URL parameters and receives them as *args and/or
**kwargs. That is, I'd like to have code like this:
@service.json
def myfinc(
On Friday, January 29, 2016 at 6:27:36 AM UTC-8, Anthony wrote:
>
> On Friday, January 29, 2016 at 3:00:47 AM UTC-5, Niphlod wrote:
>>
>> PS: didn't have time to read through all, but did you consider using
>> web2py.py -f /path/to/applications_directory ? I just fixed a couple of
>> issues in tr
On Thursday, January 28, 2016 at 10:21:54 AM UTC-8, Anthony wrote:
>
> On Thursday, January 28, 2016 at 2:37:47 AM UTC-5, Brendan Barnwell wrote:
>>
>> Yes, I realize I can do that. The problem is that (if I understand
>> right) unless I put it in the web2py folder, we
Yes, I realize I can do that. The problem is that (if I understand right)
unless I put it in the web2py folder, web2py won't know about it. I can
symlink it (or directory-junction it, in windows), but that still seems
quite awkward to me. I feel like it would make more sense if the
informati
pplications folder)
>
> Massimo
>
>
>
>
> On Wednesday, 27 January 2016 17:05:57 UTC-6, Brendan Barnwell wrote:
>>
>> I've recently begun looking at web2py. It looks very nice. However, one
>> thing that seems strange to me is that it is apparently not
I've recently begun looking at web2py. It looks very nice. However, one
thing that seems strange to me is that it is apparently not set up to be
installed. Rather, to "install" it you just copy the web2py files (or
clone the repo) into a directory. That install then "knows" about all the
ap
42 matches
Mail list logo