[web2py] Re: $.web2py.component

2018-01-18 Thread Anthony
second is the ID of the div where the component should be loaded). You can use it to trigger the creation or reloading of Ajax components using Javascript (e.g., clicking a button could load a component). Anthony On Thursday, January 18, 2018 at 2:31:34 PM UTC-5, Andrea Fae' wrote: > >

[web2py] Re: Where is password reset link handled?

2018-01-16 Thread Anthony
. Anthony On Tuesday, January 16, 2018 at 6:03:19 PM UTC-5, Ian W. Scott wrote: > > I'm trying to debug an "invalid reset password" message when a user tries > to reset their password via an emailed link. I'm confused, though, about > where the emailed link is handled. I u

[web2py] Re: How to dynamicly add SQLFORM.grid using JQuery

2018-01-16 Thread Anthony
form'). > html( *`*{{=list_program}}*`* ) }); > > Unfortunately, this does not work > Yeah, I forgot the grid also includes a script tag, so this isn't the best approach. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (S

Re: [web2py] Re: restapi for login

2018-01-16 Thread Anthony
On Tuesday, January 16, 2018 at 3:55:30 AM UTC-5, yogeshwar khalkar wrote: > > Thanks Anthony > I have done this. > > @request.restful() > def login(): > def POST(username, password): > user = auth.login_bare(username, password) > return jso

[web2py] Re: comparison between foreign key id and name

2018-01-16 Thread Anthony
DAL reference fields store the record ID of the linked record, not the value of one of its other fields. So, you comparison must be to the record ID of the company, not the company name. Anthony On Tuesday, January 16, 2018 at 4:55:13 AM UTC-5, yogeshwar khalkar wrote: > > Hi, > Pleas

[web2py] Re: How to dynamicly add SQLFORM.grid using JQuery

2018-01-16 Thread Anthony
the page is first requested, you might consider loading each grid asynchronously via Ajax only when needed. For example, clicking a button could call $.web2py.component() to retrieve a given grid as a web2py Ajax component. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Doc

[web2py] Re: How to dynamicly add SQLFORM.grid using JQuery

2018-01-15 Thread Anthony
Why don't you just put the grid right where you want it in the HTML but hidden, and then when the button is clicked, just use jQuery to un-hide the div? On Monday, January 15, 2018 at 12:25:20 PM UTC-5, Tu Duong wrote: > > It shows part of the HTML code on the browser. Seems like the code >

[web2py] Re: How to dynamicly add SQLFORM.grid using JQuery

2018-01-15 Thread Anthony
You say it works with a SQLFORM but not a grid -- what happens when you try with a grid? On Monday, January 15, 2018 at 10:16:38 AM UTC-5, Tu Duong wrote: > > Hi, > > I want to display the table's content when user clicks the button, here is > my code and it does not work. I can display the

[web2py] Re: restapi for login

2018-01-15 Thread Anthony
Check out http://web2py.com/books/default/chapter/29/09/access-control#Manual-Authentication. Also, check out https://github.com/web2py/web2py/blob/623f3b99477eb97ffadb20d6f7cb3da398253c9c/gluon/authapi.py#L20, which Auth is built on top of. Anthony On Monday, January 15, 2018 at 10:16

[web2py] Re: uploadfolder outside web2py

2018-01-15 Thread Anthony
loads when there is no session.vertexID. With the above change, you can then change the download function to the standard: def download(): return response.download(request, db) Anthony On Monday, January 15, 2018 at 4:41:58 AM UTC-5, Annet wrote: > > Hi Anthony, > > Thanks for

Re: [web2py] SQLFORM IS_NOT_EMPTY validator dependent on the value of another request vara

2018-01-15 Thread Anthony
== Other) > This is useful for improving the UI, but it will not force the user to enter a value in the text field. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Re

[web2py] Re: SQLFORM IS_NOT_EMPTY validator dependent on the value of another request vara

2018-01-15 Thread Anthony
ld == 'Other' else None Anthony -- 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 received this message because you are subscribed to the Google Grou

[web2py] Re: uploadfolder outside web2py

2018-01-14 Thread Anthony
oad action in the welcome app for an example) and specify the URL of that action as the "upload" argument. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/iss

[web2py] Re: uploadfolder outside web2py

2018-01-12 Thread Anthony
e", you can simplify to: table.image.uploadfolder = os.path.join('/', 'home', 'webapps', 'uploads') or even just: table.image.uploadfolder = '/home/webapps/uploads' Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web

[web2py] Re: decorator() takes exactly 1 argument (0 given)

2018-01-12 Thread Anthony
ions in web2py relate to Auth and Cache decorators, but I don't see any related code above). Also, why do you select the same set of records twice, and what is the point of looping through the records in details2 given that your code returns only the final record (i.e., the value "detail&quo

[web2py] Re: DB model reference field conditions eg. auth_user belonging to a certain group only

2018-01-12 Thread Anthony
equires" argument for a reference field, you will lose the default "represent" function, so you must explicitly specify that as well. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://

[web2py] Re: Parsing and Inserting data from a python dictionary into a database table using DAL

2018-01-11 Thread Anthony
On Thursday, January 11, 2018 at 6:39:38 AM UTC-5, Rahul wrote: > > Thanks! Anthony for guiding me on this. Always #1 for helping us out. > Now there is one last thing and it may be trivial but can you point me to > the right direction. I used below notation. This works fi

[web2py] Re: iterselect() and doing other DB actions - Connection is busy with results for another command

2018-01-10 Thread Anthony
On Wednesday, January 10, 2018 at 2:48:34 PM UTC-5, Brian M wrote: > > Thank you Anthony, that works! > > Only issue is that while using iterselect() you apparently can't do your > own db.commit() or else you'll get "Function sequence error (0) (SQLFetch)" > I su

[web2py] Re: Parsing and Inserting data from a python dictionary into a database table using DAL

2018-01-10 Thread Anthony
ike: db.mytable.insert(field1=record['field1'], field2=record[ 'field2_alt_spelling'], ...) Anthony On Wednesday, January 10, 2018 at 7:48:33 AM UTC-5, Rahul wrote: > > Hi All, Massimo > I am receiving a dictionary of records from a webservice like below > (sample single record

[web2py] Re: iterselect() and doing other DB actions - Connection is busy with results for another command

2018-01-10 Thread Anthony
Have you tried enabling the Multiple Active Result Sets option? I think you can do so by adding the following to the connection string: DAL('mssql4://username:password@localhost/test?MARS_Connection=yes', ...) Note, it may need to be all caps -- MARS_CONNECTION. Anthony On Wednesday, January

[web2py] Re: auto increment field that reset evry year

2018-01-09 Thread Anthony
Second, unless you lock the db.protocollo table on each of these requests, you could end up with a race condition where separate requests made nearly simultaneously both read the same current value for ieri and ultimo_protocollo and then end up creating separate records with identical value

Re: [web2py] Re: horizontal scaling question

2018-01-08 Thread Anthony
burden on the database. I suppose in many cases where the freshness of a read replica is an issue, the freshness of a cache would also likely be an issue. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.go

[web2py] Re: DISPLAYING LINK DETAILS INTO ANOTHER DIV USING (args=variable.id)

2018-01-08 Thread Anthony
ents or (2) the "cid" argument in conjunction with an Ajax component <http://web2py.com/books/default/chapter/29/12/components-and-plugins#Components--LOAD-and-Ajax> . Anthony On Monday, January 8, 2018 at 3:51:35 AM UTC-5, mostwanted wrote: > > My task is very simple but i do

Re: [web2py] Re: horizontal scaling question

2018-01-06 Thread Anthony
and swaps the ._adapter, which is used to connect to the database. In a given controller, you could then do: def myaction(): connect_to_master(db) [Do db write operations.] return dict() Anthony On Saturday, January 6, 2018 at 8:26:45 AM UTC-5, CDA wrote: > > So given the example

[web2py] Re: horizontal scaling question

2018-01-05 Thread Anthony
Do you have doubts about whether it would work? Seems fairly straightforward. On Friday, January 5, 2018 at 3:59:29 PM UTC-5, CDA wrote: > > > Below is an excerpt about horizontal scaling from Chapter 13 in the book. > Has any one successfully implemented this using web2py? > > It is also

[web2py] Re: execute web2py modules in terminal on 2.16.1

2018-01-04 Thread Anthony
he web2py shell (even with Python 2), is that in the gluon.shell module, the print function is imported from __future__. Anthony -- 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 Iss

[web2py] Re: session var in table decimal field throws error on postgres

2017-12-29 Thread Anthony
nly place you need that constant is in defining decimal fields, just store the entire field type as a constant: DECFIELD = 'decimal(100, 7)' Then in your table definitions: db.define_table(..., Field('myfield', DECFIELD, ...)) Anthony -- Resources: - http://web2py.com - http://web2py.com/b

[web2py] Re: query with contains ....

2017-12-29 Thread Anthony
reful about allowing arbitrary user input for a regexp query (see caution here: https://www.postgresql.org/docs/current/static/functions-matching.html). Anthony On Friday, December 29, 2017 at 3:24:10 AM UTC-5, Dave S wrote: > > I figured out how to iterate through request.vars to do a quer

[web2py] Re: session var in table decimal field throws error on postgres

2017-12-28 Thread Anthony
place and use it for all users (which means there is no reason to store it in the session). Anthony -- 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

Re: [web2py] strange URL output ?!

2017-12-21 Thread Anthony
tension=False) # Or any falsey value other than None Anthony -- 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 received this message because you are s

[web2py] Re: grid column names do not print nicely

2017-12-20 Thread Anthony
> > >> Probably we should add some code to web2py-bootstrap3.css to remove some >> of the URLs from the grid when printing (e.g., headings, pagination links, >> etc.). If you'd like, open a github issue and link to this thread. >> >> Anthony >> >

[web2py] Re: grid column names do not print nicely

2017-12-20 Thread Anthony
should add some code to web2py-bootstrap3.css to remove some of the URLs from the grid when printing (e.g., headings, pagination links, etc.). If you'd like, open a github issue and link to this thread. Anthony On Wednesday, December 20, 2017 at 6:17:13 AM UTC-5, icodk wrote: > > When i

Re: {Disarmed} Re: {Disarmed} [web2py] Re: Get reference format representation on dal callbacks

2017-12-19 Thread Anthony
ote, that will be the actual DAL Table object -- if you want the name, you can do set.query.first.tablename. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Rep

[web2py] Re: Migrate snag when moving from 2.14.6 to 1.16.1

2017-12-19 Thread Anthony
the DAL to recognize the original hash -- just grab the prefix from an existing *.table file and do: db = DAL(..., table_hash=[the original connection string hash]) Anthony On Friday, December 15, 2017 at 6:26:05 PM UTC-5, SimonD wrote: > > > I've just upgraded from 2.14.6

[web2py] Re: Why is this ajax call making web2py to freeze, even using session.forget?

2017-12-17 Thread Anthony
How many uWSGI worker processes/threads? Is it possible you've got enough simultaneous long-running requests that all the available processes/threads are occupied at the same time? Anthony On Sunday, December 17, 2017 at 10:47:04 AM UTC-5, Lisandro wrote: > > Sorry, I forgot to m

[web2py] Re: Why is this ajax call making web2py to freeze, even using session.forget?

2017-12-17 Thread Anthony
How is web2py deployed? On Sunday, December 17, 2017 at 8:41:50 AM UTC-5, Lisandro wrote: > > Hello everyone. I've read the docs [1] and also read several posts in this > forum about this problem, however I can't figure out why it's still > happening in my case. I was hoping you can help me. >

[web2py] Re: Generate ticket "manually"

2017-12-15 Thread Anthony
On Thursday, December 14, 2017 at 10:36:08 PM UTC-5, Brendan Barnwell wrote: > > 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:/

[web2py] Re: Generate ticket "manually"

2017-12-14 Thread Anthony
). Calling the .log() method on that error object should then generate the ticket. Note, you'll be responsible for specifying the proper values for the "layer", "code", and "environment" arguments to RestrictedError() (for "environment", current.globalen

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-14 Thread Anthony
On Thursday, December 14, 2017 at 2:21:20 AM UTC-5, mweissen wrote: > > Hi Anthony! > > You have written: > > Not sure what you mean. When I try it, I get the expected list of record > IDs in request.vars.records as well as the value of "f" in request.vars.f. >

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Anthony
On Wednesday, December 13, 2017 at 3:15:03 PM UTC-5, mweissen wrote: > > Anthony, now I have written a small program as example : > > def test1(): > if "f" in request.vars: > raise HTTP(401, "f=%s" % str(request.vars.f)) > form = SQLFORM.gr

[web2py] Re: Is there a way to use the DAL to specify a one-sided limit (aka offset)?

2017-12-13 Thread Anthony
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" without "limit". Anthony On Wednesday, December 13, 2017

Re: [web2py] Re: Add INPUT to SQLFORM.grid

2017-12-13 Thread Anthony
Hard to say without seeing your code, but after processing the selected records, the grid does a redirect, so you have to access request.vars.f before defining the grid. Anthony On Wednesday, December 13, 2017 at 5:13:52 AM UTC-5, mweissen wrote: > > Hi Anthony, > > thank you for

[web2py] Re: Session storage not working on live deployment

2017-12-12 Thread Anthony
you mean "reading the cookie"? You shouldn't need to write any code to read the cookie. Can you show your code? Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/l

[web2py] Re: How to use auth mailer with commercial service?

2017-12-12 Thread Anthony
omething like: def ses_mailer(to, subject, message): # Use "to", "subject", and "message" in the below call to the boto send() method. boto3.client('ses', ...).send(...) Then either: auth = Auth(..., mailer=ses_mailer) or after defining auth: auth.settings

[web2py] PLEASE RE-POST RECENT MESSAGES

2017-12-12 Thread Anthony
). If that doesn't work, send me a direct email and I'll manually add your email address as an approved member. Sorry for the trouble. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py

[web2py] Re: Add INPUT to SQLFORM.grid

2017-12-12 Thread Anthony
request.vars.f On Tuesday, December 12, 2017 at 3:47:56 AM UTC-5, mweissen wrote: > > I want to add *one and only one *INPUT field to a grid (not one field per > row, but one filed for the whole grid) > > For example: > > form = SQLFORM.grid() >

Re: [web2py] Re: serve static files in deployment on pythonanywhere

2017-12-06 Thread Anthony
On Wednesday, December 6, 2017 at 10:19:12 AM UTC-5, Manuele wrote: > > Hi Anthony, > > thank you for your reply, > > On 06/12/2017 15:36, Anthony wrote: > > I followed what indicated in the web configuration panel setting up two >> static configuration c

[web2py] Re: serve static files in deployment on pythonanywhere

2017-12-06 Thread Anthony
are you trying to achieve? Why are you trying to map some static requests to a non-existent folder? Anthony -- 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

[web2py] Re: How to prohibit delete of row in parent table if is refwrenced by child tables

2017-12-05 Thread Anthony
given record is deletable, then the "Delete" button will simply not be present for any non-deletable rows in the grid, which will prevent users from attempting illegal deletes to begin with. Note, though, that the query in the "deletable" function will be executed for each ro

[web2py] Re: How to prohibit delete of row in parent table if is refwrenced by child tables

2017-12-04 Thread Anthony
thrown by the database driver, which will result in a web2py error ticket if you don't catch the error in the code. So, you would want to wrap the delete in a try/except. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] Re: How to prohibit delete of row in parent table if is refwrenced by child tables

2017-12-04 Thread Anthony
lete(dbset): return not dbset(db.mytable.id == db.othertable.mytable).isempty() The above query does a join with the referencing table, and the function returns True if the join query is not empty (implying there are referencing records). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (D

[web2py] Re: How to prohibit delete of row in parent table if is refwrenced by child tables

2017-12-04 Thread Anthony
the delete. In that case, the .delete() call itself will return 0, so you can test for that value to determine that the delete failed. Anthony On Monday, December 4, 2017 at 10:01:38 AM UTC-5, rafi farchi wrote: > > Hi > How i can define a requiers rule so that a row in parent table can be

[web2py] Re: Possible bug using | at end of element of list:string

2017-11-30 Thread Anthony
Looks like a bug -- I submitted an issue: https://github.com/web2py/pydal/issues/504 Anthony On Wednesday, November 29, 2017 at 8:12:56 AM UTC-5, Scott Hunter wrote: > > Suppose I have a list:string field, and I put `A|B` in for one of the > elements. This works as expected,

Re: [web2py] request.args(0) vs request.args[0]

2017-11-30 Thread Anthony
Note, request.args is an instance of the gluon.storage.List <https://github.com/web2py/web2py/blob/130e37d7087e67909e25ce4bf1e0bd8cd293/gluon/storage.py#L268> class. It has a __call__ method, so in addition to acting like a standard Python list, it can be called like a function. A

Re: [web2py] request.args(0) vs request.args[0]

2017-11-29 Thread Anthony
Also, request.args() takes some additional arguments: requests.args(0, default=some_default, cast=int, otherwise= a_function_or_redirect_url) Anthony On Wednesday, November 29, 2017 at 11:19:57 AM UTC-5, Massimiliano wrote: > > Try it without passing the args > > def test():

[web2py] Re: Interface for "admin" users to create new users?

2017-11-28 Thread Anthony
See https://stackoverflow.com/a/47544844/440323. On Tuesday, November 28, 2017 at 10:31:32 PM UTC-5, Martti Lamberg wrote: > > > https://stackoverflow.com/questions/47542066/web2py-interface-for-admin-users-to-create-new-users > > I want to disable normal registering in my web2py app and only

[web2py] Re: Do Calculations with Plaintext Password

2017-11-26 Thread Anthony
Also, whatever computations you are doing with the password, make sure you don't end up storing a value from which the original plain text password could be easily recovered (that's the point of storing only a hash of the password). Anthony On Saturday, November 25, 2017 at 11:05:25 AM UTC-5

[web2py] Re: How to reuse the IS_IN_SET validator list in views and controllers?

2017-11-26 Thread Anthony
. You could of course also define the list in a module and import it wherever needed. Anthony On Sunday, November 26, 2017 at 10:05:21 AM UTC-5, Sarbjit wrote: > > Hello, > > I have defined a IS_IN_SET validator inside my models. Now, I want to use > the same list inside contro

[web2py] Re: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Anthony
by passing the session cookie back and forth. If the only client is the browser, just have it make Ajax calls directly to the API endpoints -- no reason to pass requests through an endpoint in another controller. Anthony On Monday, November 13, 2017 at 9:14:00 AM UTC-5, Leandro Sebastian

[web2py] Re: restful service + auth on same application/ different controllers = gives Not authorized message

2017-11-21 Thread Anthony
does indeed take keyword arguments, as shown here: http://docs.python-requests.org/en/v1.0.4/user/advanced/#session-objects. The keyword arguments are actually passed to the requests object itself -- the "verify" keyword is documented here: http://docs.python-requests.org/en/master/us

[web2py] Re: How to insert data into Database?

2017-11-20 Thread Anthony
Have you defined the blog1 table anywhere? If you have, the code looks OK -- what are you observing, and what do you expect instead? Anthony On Monday, November 20, 2017 at 4:46:07 PM UTC-5, Sandeep Patel wrote: > > I want to take data from the user using my HTML template and

[web2py] Re: Import application from staging to production server

2017-11-20 Thread Anthony
; local_import was deprecated after the web2py custom importer was created. It was used as a way to load modules local to the application and allow auto-reloading in development. It still works but is no longer necessary or recommended. Anthony -- Resources: - http://web2py.com - http://we

[web2py] Re: list:string field length

2017-11-19 Thread Anthony
ingle string in form.vars to a single element list, but not until after the onvalidation function has been run. Feel free to submit a Github issue about this (in the web2py repo, as it is related to SQLFORM, not PyDAL). Anthony -- Resources: - http://web2py.com - http://web2py.com/book

Re: [web2py] list:string field length

2017-11-19 Thread Anthony
ld on normal > relational databases and hence set the length of the text field to the > default ? > It is a text field, not a varchar field, so length is not relevant. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] Re: web2py 2.16.1 and python27

2017-11-19 Thread Anthony
fore you can run it under Python 3 with web2py. Anthony -- 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 received this message because you are s

[web2py] Re: Getting wrong Results with my grading system

2017-11-18 Thread Anthony
t;= 80: The upper range doesn't matter, as presumably 100 is the maximum anyway. Note, though, that you have defined a B as >= 79. That means that you get a B only if your percentage is between 79 and 80 -- once you hit 80, it's an A. Is that really what you want? Anthony -- Resources

[web2py] Re: scheduler can't normal run my script

2017-11-18 Thread Anthony
the task should be executed elsewhere -- you can run the queuing code from a web2py shell, define a controller action that queues the task, or even directly add a record to the scheduler_task table (possibly via appadmin) to queue a task. Anthony -- Resources: - http://web2py.com - http://we

[web2py] Re: scheduler can't normal run my script

2017-11-18 Thread Anthony
n HTTP requests, but the scheduler is not making an HTTP request to web2py. Anthony -- 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 received this message

[web2py] Re: JWT questions

2017-11-18 Thread Anthony
ng you logged in" -- you are really re-authenticating on every single request by sending the JWT in the request headers. By the way, you can use curl to store and return cookies using the --cookie and --cookie-jar options. Anthony -- Resources: - http://web2py.com - http://web2py.com/boo

[web2py] Re: Getting wrong Results with my grading system

2017-11-18 Thread Anthony
part of the "else" block and therefore only display conditionally. Typically, you would need a {{pass}} to indicate the end of an if, else, elif, or for block in a view. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/

[web2py] Re: list:string field length

2017-11-17 Thread Anthony
list includes only a single item. So, if you do something like len(db.mytable(1).my_list_string_field), you should always get the length of the list, not the length of any single element in the list. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github

[web2py] Re: list:string field length

2017-11-17 Thread Anthony
bout list:string ? > I don't think the "length" attribute is relevant for list:string fields because the field is defined as a list in databases that natively support lists (i.e., nosql databases) and as a text field in SQL databases (the list is converted to a string with the elemen

Re: [web2py] Re: How to get teh last DB Field data

2017-11-17 Thread Anthony
st message, as you are unnecessarily retrieving all the records from the database, then iterating through all of them, and only then selecting the last one. Instead, use the code shown above to get only the most recent record. Anthony -- Resources: - http://web2py.com - http://web2py.co

Re: [web2py] Re: How to get teh last DB Field data

2017-11-17 Thread Anthony
simply updating the HTML page so it shows the latest data from the database. Anthony -- 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 received

[web2py] Janrain recently broken (and how to fix)

2017-11-15 Thread Anthony
()): if request.post_vars.token: del request.get_vars.token The problem is that Janrain is now passing the token to the web2py URL via both a POST variable and the query string. One of those two must be deleted before calling auth() for the current web2py code to work. Anthony -- Resources: - http

[web2py] Re: Failing calculate the average

2017-11-15 Thread Anthony
ll the records. Finall, why not name the variables something like "total" and "average" instead of "average" (which is not really an average) and "average2"? Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github

[web2py] Re: scheduler can't normal run my script

2017-11-15 Thread Anthony
/c9fd0fd71e770c1a367b45ad5def5bd2c6fd7115/gluon/scheduler.py#L1637. You'll need to specify the DB URI, a folder where the DAL model definition metadata files will be stored, and a file where the tasks are defined. Anthony On Wednesday, November 15, 2017 at 4:04:15 AM UTC-5, yytry...@gmail.com wrote: > > i write a

[web2py] Re: SQLFORM.grid custom form on validation, oncreate not triggered

2017-11-15 Thread Anthony
. session.flash is typically set right before a redirect because it doesn't get displayed until the next request (when a new request comes in, it checks for session.flash and transfers it to response.flash). Anthony On Wednesday, November 15, 2017 at 6:55:47 AM UTC-5, Yebach wrote: > > Hello

[web2py] Re: How to get teh last DB Field data

2017-11-15 Thread Anthony
sage from the record inserted above. Perhaps the error is somewhere in the code you haven't shown (e.g., the view code). Also, not sure what you mean by "refreshing the database". Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github

[web2py] If condition is True

2017-11-11 Thread Anthony Smith
= 'record inserted' return dict (form=form) Thanks for any input Cheers Anthony -- 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 received

[web2py] Re: request.ajax

2017-11-10 Thread Anthony
I don't think Axios sets the X-Requested-With header by default, so you will probably have to add that setting when configuring it (the value of that header should be 'XMLHttpRequest'). Anthony On Friday, November 10, 2017 at 12:58:55 PM UTC-5, Pierre wrote: > > Hi everyone, > >

[web2py] Re: uploadseparate

2017-11-10 Thread Anthony
use the "uploadfolder" argument to specify a custom folder. Anthony On Friday, November 10, 2017 at 2:49:15 AM UTC-5, T.R.Rajkumar wrote: > > The uploadseparate creates folder sructure like > uploads/amc_master.annexure/a0, uploads/amc_master.annexure/87 for the > f

[web2py] Re: digitally signed urls

2017-11-10 Thread Anthony
cord the last visit on every single request). > what happens if user loads the form (main_func) logged in and hits the > submit button logged out ( he is been on the phone ) ? > They'll have to log in again. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentati

[web2py] Re: ipython notebook and web2py

2017-11-09 Thread Anthony
.join(folder, 'controllers', controller + '.py') if os.path.isfile(pyfile): execfile(pyfile, environment) globals().update(**environment) Anthony On Thursday, November 9, 2017 at 5:16:14 AM UTC-5, Morganti wrote: > > Hi, > > I am using the web2py version 2.15.4 and used the th

[web2py] Re: where is pydal doc ?

2017-11-09 Thread Anthony
eously. No, I don't suppose there is a way to know who might be working on what on their own. You can certainly see the list of contributors and forks on Github, but no way to tell who is working on what until they push some commits and submit pull requests. If you plan to make a substantial effort o

[web2py] Re: digitally signed urls

2017-11-09 Thread Anthony
accept_func and task_completed with @auth.requires_login(). Digital signatures for URLs add extra protection in case you need to restrict access to only a particular URL (i.e., a particular combination of args and vars). Anthony -- Resources: - http://web2py.com - http://web2py

[web2py] Re: As an MVC framework, does web2py allows updating model from view?

2017-11-09 Thread Anthony
eb2py allows the model to be updated from the view, it might be more productive if you explain exactly what you are trying to achieve (and why). Anthony On Thursday, November 9, 2017 at 1:42:09 AM UTC-5, Mike Stephenson wrote: > > > <https://lh3.googleusercontent.com/-omg8HOU9RD0/WgP

[web2py] Re: digitally signed urls

2017-11-08 Thread Anthony
ating a *session.hmac_key* via > *auth.settings.login_onaccept > = [generate_hmac_key*] as Anthony suggested in this post > don't know if this is effective ? > It's not quite clear what you are trying to achieve. If you are using Auth and having users log in, why not use URL(..., user_signature=T

[web2py] Re: where is pydal doc ?

2017-11-08 Thread Anthony
ot sure if you were using the repo when you were working on the translation, but if so, you should have seen the existing translation in the repo (or in a pull request if it wasn't merged yet). Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://g

[web2py] Re: digitally signed urls

2017-11-08 Thread Anthony
combinations of args and vars). You can digitally sign the allowed URLs and check the signature in the action to prevent any other URLs from working. Anthony On Wednesday, November 8, 2017 at 9:52:18 AM UTC-5, Leonel Câmara wrote: > > I'll give you an example, lets imagine I have a client datab

[web2py] Re: change_password validator

2017-11-07 Thread Anthony
Right, this is a bug. Reported here: https://github.com/web2py/web2py/issues/1800 Anthony On Tuesday, November 7, 2017 at 2:41:12 PM UTC-5, mark.phi...@gmail.com wrote: > > I just encountered the same problem that was described above. > I use the "auth.settings.password_min_le

[web2py] Re: where is pydal doc ?

2017-11-07 Thread Anthony
On Tuesday, November 7, 2017 at 10:59:19 AM UTC-5, Lars wrote: > > I really didn't want to argue on this, I just said how I feel, that's all. > Sorry if I offended anyone. > Not offended or "arguing," just trying to clarify. Anthony > > On Tuesday, November 7, 20

[web2py] Re: custom form submit not working - form.accepts not triggered

2017-11-07 Thread Anthony
onvalidation, oncreate, onupdate, onedit, and ondelete callbacks, which will be passed to .process() within the grid code. Anthony On Tuesday, November 7, 2017 at 7:32:48 AM UTC-5, Yebach wrote: > > Hello > > I am trying to implement a custom form for SQLFORM.grid > > When submit i

[web2py] Re: where is pydal doc ?

2017-11-07 Thread Anthony
On Tuesday, November 7, 2017 at 4:22:44 AM UTC-5, Lars wrote: > > Hi Anthony, > > > I think that convers most of the arguments > > > Actually 11 on 24... > I count 19 out of 24 documented in the DAL chapter of the book and 2 additional (after_connection and tabl

[web2py] where is pydal doc ?

2017-11-06 Thread Anthony
to the adapter and driver, respectively. Aside from that, of you have a specific question, try searching this forum or reading the code directly. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https

[web2py] Re: Future of web2py

2017-11-04 Thread Anthony
> > About Python, I know many people are still on Python 2, but to me it's > legacy. Many people completely moved on to Python 3. That makes web2py > very outdated. Note, web2py now supports Python 3. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (D

[web2py] Re: How to get rid if the /init/default/ in the URL?

2017-11-03 Thread Anthony
t; (or you can just use a Bash console to create a folder). If none of that is working for you, either contact Pythonanywhere support or just create a new account. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://c

[web2py] Re: Setting a header

2017-11-02 Thread Anthony
hat's the best > way to pass that to the browser? > Is this an Ajax request or full page load? If the latter, you certainly can use the tag. You can also do automatic page refreshes via Javascript. Anthony -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - h

[web2py] Re: Data Representation SQLFORM.factory /linked tables

2017-11-02 Thread Anthony Smith
Thanks Anthony As usual something I never thought of. Always looking for my mistakes.lol cheers Anthony On Thursday, 2 November 2017 13:19:35 UTC+11, Anthony wrote: > > db.define_table('drench', >> Field('status', requires=IS_IN_SET(STATUSES), >>

[web2py] Re: How to get rid if the /init/default/ in the URL?

2017-11-02 Thread Anthony
anywhere_files.png> Anthony -- 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 received this message because you are subscribed to the Google Groups

<    3   4   5   6   7   8   9   10   11   12   >