[web2py] Auth - overlapping permissions problem

2020-07-16 Thread Paul Ellis
the situation is that I have permissions associated with auth_groups. eg. user, team leader, business leader, oversight now I need a "secretary" or "accounts" group which has access to some business leader features i.e reports. Some team leader features ie. price maintainence. But does not

[web2py] Accessing Postgres server from a secondary docker container without db.py

2019-12-17 Thread Paul Ellis
How do I do connect to a prostgres server using PyDAL but without a db.py in the secondary container or having all the tables drop when I connect without a db definition? I have a server running docker with containers for the nginx proxy, lets encrypt, web2py and postgres. one

[web2py] Smartgrid with multiple references between tables - Undocumented - Solved

2019-12-09 Thread Paul Ellis
When using Smartgrid and there are multiple links between two tables. For example a user_id might appear multiple times in db.offer because of created_by, updated_by, belongs_to fields. db.define_table( 'offer', Field('offer_number', unique=True, label = T('Offer Number')),

[web2py] Re: Tempfile not found when uploading images with the Add function in a Grid

2019-11-04 Thread Paul Ellis
Actually I was looking at the wrong controller function. I have a utility function which returns part of the UI. Somehow when the form is submitted and this is run the tempfile for the image is closed. So by doing this at the end, after the form processing is complete, the problem is solved.

[web2py] Re: SQLFORM.grid search with fields readable = False

2019-11-01 Thread Paul Ellis
If you want the fields to be searchable. Then instead of setting readable = false. Hide the fields with: db.table.field.represent = lambda value, row: DIV(value, _class='hidden') and the column heading with: grid = SQLFORM.grid( headers = { 'table.field' : DIV(_style =

[web2py] Tempfile not found when uploading images with the Add function in a Grid

2019-11-01 Thread Paul Ellis
I am getting this error when users upload an image with the Add function of a grid. As background, it is adding a product which can only be seen by users in a particular group (belong to the same company). Traceback 1. 2. 3. 4. 5. 6. 7. Traceback (most recent call last): File

[web2py] Upload field causing a temp file issue

2019-08-21 Thread Paul Ellis
I have 2 similar controller functions using SQLFORM() with an upload field. One works and one is giving an error online (not when testing locally). I suspect a file system permission problem but I am not sure. The error only occurs if an image is uploaded. The extra processing after the form is

Re: [web2py] Re: How to convert my view to pdf

2019-05-07 Thread Paul Ellis
I had a look at xhtml2pdf and I am not sure how to implement it in my web2py application. Do you save the PDF as a file or output it to the browser? Do you use the html generated by the web2py view and have the function calls in a view or do you generate the HTML another way in a controller

[web2py] Receiving JSON via AJAX in controller function

2019-05-02 Thread Paul Ellis
I have some JS which sends data from a row in a grid to the server as JSON. The controller function receives the JSON in a request.vars key (not a value). This is awkward to find if there are other request.vars. Currently I am testing for lengths over 10. This was a quick hot fix because I

[web2py] Re: How to convert my view to pdf

2019-04-29 Thread Paul Ellis
This is really hard to answer because a PDF has a set page size and a HTML file (view) does not. Plus getting the css used in a HTML file to translate into css is also a challenge. Just print the page you are talking about with a pdf printer driver to see. You probably won't be happy with the

Re: [web2py] Re: MARKMIN - Sanitizing

2019-04-29 Thread Paul Ellis
DB, you could sanitize > it first using XML() > > e.g. > > XML('dodgy();**Hello**',sanitize=True).xml() > > *script/script**Hello*** > > > On Thursday, 25 April 2019 12:19:44 UTC+1, Paul Ellis wrote: >> >> I am using an editable span with some js to submit th

[web2py] MARKMIN - Sanitizing

2019-04-25 Thread Paul Ellis
I am using an editable span with some js to submit the input via ajax to the server. The span is only editable by admins. To give them some formatting options they can use MARKMIN in the span. The problem is it only seems to be one directional. How can I take the processed HTML and turn it

[web2py] Re: Don't allow textarea to contain html tags

2019-04-23 Thread Paul Ellis
you could use XML(input_text, sanitize=True) as part of your form processing. http://www.web2py.com/books/default/chapter/29/05/the-views#XML if form.process().accepted: form.vars.text_input = XML(form.vars.text_input, sanitze=True) -- Resources: - http://web2py.com -

[web2py] Re: Asynchronous submission of request.vars values to Controller for calculations using Ajax

2019-04-17 Thread Paul Ellis
Which controller is displaying the view you have posted? It looks like the ajax function is calling the same controller which returns the index page. The controller function called by the ajax function should return a string. The string can be jquery which will be evaluated if you use ':eval'.

[web2py] Re: mysql import from csv problem

2019-03-03 Thread Paul Ellis
Which python and web2py version are you using? Do you mean you don't have the csv file anymore? Do you have a backup of the old database to make another one from? On Tuesday, 19 February 2019 22:13:24 UTC+1, Andrea Fae' wrote: > > Hello, when I import with this procedure >

Re: [web2py] Re: dict values error in python 3.6

2019-03-03 Thread Paul Ellis
https://github.com/web2py/web2py/issues/2126 done On Sat, Mar 2, 2019 at 12:16 PM Kevin Keller wrote: > Can someone file an issue on github and also attach the solution please? > Thanks > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > -

[web2py] Re: custom_auth_table TypeError: a bytes-like object is required, not 'str'

2019-03-01 Thread Paul Ellis
I have solved this by deleting errors. I think there was some errors pickled while running Python 2 still in the directory. Is it possible your /databases/*.table files were pickled while running under Python 2? Might need to export the data and start a fresh database with python 3 and then

[web2py] Re: custom_auth_table TypeError: a bytes-like object is required, not 'str'

2019-03-01 Thread Paul Ellis
web2py™Version 2.17.2-stable+timestamp.2018.10.06.11.34.06 PythonPython 3.7.0: Traceback (most recent call last): File "C:\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment) File "C:/web2py/applications/admin/controllers/default.py"

[web2py] Re: dict values error in python 3.6

2019-03-01 Thread Paul Ellis
This is a issue with generic.html. In Python 3 dict.values() does not return a list it returns a dict_values object. On line 10 of Generic.html wrap the values method call in list() and it works. {{=BEAUTIFY(list(response._vars.values())[0])}} -- Resources: - http://web2py.com -

[web2py] Re: Issue with db.export_to_csv_file and Python 3.7

2019-03-01 Thread Paul Ellis
I have been having a similar problem with importing from csv file and the same solution works. db.import_from_csv_file(open(path, 'r', encoding='utf-8', newline=''))Enter code here... On Saturday, 2 March 2019 00:53:29 UTC+1, jim kaubisch wrote: > > been looking around some more. turns out

[web2py] Re: web2py - docker - sending email

2019-03-01 Thread Paul Ellis
is not required for outgoing mail. On Friday, 1 March 2019 05:46:10 UTC+1, Paul Ellis wrote: > > I am moving an app to a new server. Previously on pythonanywhere and could > send email for password resets. So the email settings are correct. > > New server is using docker. web2py + nginx >

[web2py] Re: Cannot import modules

2019-02-28 Thread Paul Ellis
I know this sounds odd. But this worked for me recently. It can be caused by a corrupt .pyc file. Try deleting the .pyc files and see if the problem remains. On Thursday, 28 February 2019 20:54:24 UTC+1, Ben Duncan wrote: > > Getting the following errors when trying to import a module > Module

[web2py] web2py - docker - sending email

2019-02-28 Thread Paul Ellis
I am moving an app to a new server. Previously on pythonanywhere and could send email for password resets. So the email settings are correct. New server is using docker. web2py + nginx Trying to send email I am getting the following error: web2py:Mail.send failure:[SSL: WRONG_VERSION_NUMBER]

[web2py] Fresh install - ImportError: cannot import name Cookie

2019-02-28 Thread Paul Ellis
with a fresh install of web2py by running git clone --recursive https://github.com/web2py/web2py.git and then running: python web2py.py I am getting: Traceback (most recent call last): File "web2py.py", line 21, in import gluon.widget File "C:\w2p\gluon\__init__.py", line

[web2py] Re: SQLFORM.grid() buttons have no names? 2.17.2-stable

2018-12-30 Thread Paul Ellis
Seems to me that it would as simple as using the buttonclass key as a name or id in the gridbutton function. But I am not a professional so I don't know if this is a good idea. def gridbutton(buttonclass='buttonadd', buttontext=T('Add'), buttonurl=url(args=[]),

[web2py] SQLFORM.grid() buttons have no names? 2.17.2-stable

2018-12-30 Thread Paul Ellis
Is there a reason there are no names or ids attached to the grid buttons? Like addBtn, deleteBtn and so on. There's no identifying information on the buttons to make it easy to change the text or colour, for example. I don't want 'Add record' I want something more contextual depending on the

[web2py] Re: removing / hiding SQLFORM.grid links in the view, edit, add forms?

2018-12-12 Thread Paul Ellis
After reading the sqlhtml.py for a while last night. I decided to use the same method. Before creating the grid: if request.args(-3) in ('edit', 'view'): On Wednesday, 12 December 2018 00:10:02 UTC+1, Paul Ellis wrote: > > I have a grid with some links. One of the buttons is a place

Re: [web2py] removing / hiding SQLFORM.grid links in the view, edit, add forms?

2018-12-12 Thread Paul Ellis
FORM.grid(query, editable=False,details=False,create=False,..) > > Thanks > SP > > > On Wed, Dec 12, 2018 at 4:40 AM Paul Ellis wrote: > >> I have a grid with some links. One of the buttons is a placeholder which >> some Jquery attaches to. How do I stop this bu

[web2py] removing / hiding SQLFORM.grid links in the view, edit, add forms?

2018-12-11 Thread Paul Ellis
I have a grid with some links. One of the buttons is a placeholder which some Jquery attaches to. How do I stop this button from appearing in the subforms add, view etc. I don't really want or need any of the links to appear in the subforms. grid = SQLFORM.grid(query, links = [

[web2py] Broken/Changed Link on Web2py.com

2018-09-26 Thread Paul Ellis
Hey Contributors, The link behind the 3rd picture on web2py.com goes to paktpub.com and shows a book about 'Internet Marketing with WordPress'. Looks like the site is correct, not sure about the book. Just thought you would like to know. Best Regards -- Resources: - http://web2py.com -

[web2py] Re: How to select row based on item ID or name

2018-01-04 Thread Paul Ellis
You would still get a Rows Object though, even though there is only 1 row in it. You would need .first() .last() or [0] at the end to get just the row. Or use the shortcut method. db.table[id] On Thursday, 4 January 2018 18:24:26 UTC+1, Dave S wrote: > > > > On Wednesday, January 3, 2018 at

[web2py] Requesting button names for grid and smartgrid

2018-01-04 Thread Paul Ellis
Would it be possible to name the grid buttons and smartgrid table links? This would make it pretty easy to tweak the buttons. For example. I would like to change the Delete button to red. I can do it like this: rowBtns = grid.elements('div', _class = 'row_buttons') if rowBtns: for row in

Re: [web2py] Re: smartgrid - limit dropdown menu items in edit form

2018-01-04 Thread Paul Ellis
in your db.py > file to apply this rule to the entire site. > > http://web2py.com/books/default/chapter/29/06/the- > database-abstraction-layer?search=common+filter#Common-filters > > > > On Monday, January 1, 2018 at 4:51:33 PM UTC-6, Paul Ellis wrote: >> &

[web2py] smartgrid - limit dropdown menu items in edit form

2018-01-01 Thread Paul Ellis
I want to start using a smartgrid to browse a couple of tables as an admin tool. There are a couple of companies using the same database. When an admin edits an 'Offer' I want them to be able to change the user_id. Effectively assigning the offer to a different staff member in the event of

Re: [web2py] SQLFORM.grid search type error reduce()

2017-08-15 Thread Paul Ellis
. Thanks for the fix. On Tue, Aug 1, 2017 at 10:46 AM, Paul Ellis <eddie.dig...@gmail.com> wrote: > I am getting this error only when searching the auth_membership table > > I have put in a basic 'appadmin' in my webapp. I call it 'tooladmin' to > differentiate from the built i

Re: [web2py] Re: SQLFORM.grid search type error reduce()

2017-08-07 Thread Paul Ellis
I will gladly test. But I can't do it until next week. ⁣Sent from TypeApp ​ On 4 Aug. 2017, 17:58, at 17:58, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: >Just fixed in trunk. Can you please help test the fix? > >On Tuesday, 1 August 2017 03:46:13 UTC-5, Paul Ellis wr

[web2py] SQLFORM.grid search type error reduce()

2017-08-01 Thread Paul Ellis
I am getting this error only when searching the auth_membership table I have put in a basic 'appadmin' in my webapp. I call it 'tooladmin' to differentiate from the built in stuff. I use this function to edit any database table: def manage_table(): tablename = request.args(0) pagetitle

Re: [web2py] Re: PDF Download File Name

2017-05-29 Thread Paul Ellis
y 29, 2017 at 10:41 AM, Paul Ellis <eddie.dig...@gmail.com> wrote: > I tried your suggestion like this: > response.view = offer_number > response.headers['Content-Type'] = 'application/pdf' > return pdf.output(dest='S') > > but I still get the controller

Re: [web2py] Re: PDF Download File Name

2017-05-29 Thread Paul Ellis
ely@gmail.com> wrote: > > > On Tuesday, May 16, 2017 at 1:27:06 AM UTC-7, Paul Ellis wrote: >> >> Hello, >> >> I use pyfpdf to display some information from my my database. When I >> click save the filename is 'pdf_view' which is the name of the controller >

[web2py] PDF Download File Name

2017-05-16 Thread Paul Ellis
Hello, I use pyfpdf to display some information from my my database. When I click save the filename is 'pdf_view' which is the name of the controller function. How can I change this? I want the name to also come from the database. With the help of others on here. I can make a download link

Re: [web2py] Re: Python web2py console

2017-03-07 Thread Paul Ellis
cation -M > > Em segunda-feira, 6 de março de 2017 11:14:53 UTC-3, Paul Ellis escreveu: >> >> Yes. I want an interactive shell with my application loaded. >> >> I know I can run a 'Test' page with output to the console, but it would >> be much easier (and I know

Re: [web2py] Re: Python web2py console

2017-03-07 Thread Paul Ellis
t have > Python installed. If you have Python installed, it would be preferable to > just use the source version of web2py -- don't bother with the .exe version. > > Anthony > > > On Monday, March 6, 2017 at 7:14:34 AM UTC-5, Paul Ellis wrote: >> >> Hello, >> >

Re: [web2py] Re: Python web2py console

2017-03-06 Thread Paul Ellis
, Mar 6, 2017 at 2:36 PM, Marlysson Silva <marlyss...@gmail.com> wrote: > Try just double click in web2py.exe , it open a server in a screen. > > Or are you trying accessing models of application via shell? > > Em segunda-feira, 6 de março de 2017 09:14:34 UTC-3, Paul Ellis

[web2py] Python web2py console

2017-03-06 Thread Paul Ellis
Hello, I know this question has been asked before, but didn't solve the problem for me. I am using Windows 10 and web2py binary and have replaced web2py.py with web2py.exe in the command python web2py.py -s [applicaiton] -m and am getting this error: python web2py.exe -s [application] -m

Re: [web2py] Re: Autoincrement which resets each month (not primary id)

2017-03-06 Thread Paul Ellis
tabase so that there's nothing for you to manage. > So on insert the database could automatically look at the date (or use an > existing created_date field) and the current auto-increment number and > combine as needed and store it for you. > > ~Brian > > > >

[web2py] Autoincrement which resets each month (not primary id)

2017-03-05 Thread Paul Ellis
I want to have a numbering system which is 2 digit year, 2 digit month and then an autoincrement number which resets each month. 1703# Currently using SQLite with a view to move to MYSQL in future. The MYSQL examples I have found suggest using a composite primary key, which doesn't seem to

[web2py] Re: how to open web2py console shell on my windows 8 ??

2017-03-04 Thread Paul Ellis
Hi Anthony, I am using Windows 10 and have replaced web2py.py with web2py.exe and am getting this error: SyntaxError: Non-ASCII character '\x90' in file web2py.exe on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details What am I doing wrong? Cheers On

[web2py] Re: SQLFORM.grid field.represent not working with joined tables

2017-02-20 Thread Paul Ellis
I still don't know what caused this. There was obviously something missing in the grid. I have come back to the problem after working around it with js and can't replicate the issue. It is now working. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: SQLFORM.grid field.represent not working with joined tables

2017-02-15 Thread Paul Ellis
Here is the traceback: 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. Traceback (most recent call last): File "E:\web2py\gluon\restricted.py",

[web2py] SQLFORM.grid field.represent not working with joined tables

2017-02-14 Thread Paul Ellis
I have have a grid with a left outer join. So the row objects look like this: I am trying to use represent to make some of them editable. For the optional checkbox it is like this: db.product_offer_item.optional.represent = lambda value, row: INPUT(_type='checkbox',

Re: [web2py] Re: SQLFORM.grid changing the behaviour when there are no records

2017-02-13 Thread Paul Ellis
:}} > No records > {{pass}} > > > That should do it I think. > > Regards, Edwin > > On Monday, February 13, 2017 at 7:12:53 PM UTC+4, Paul Ellis wrote: >> >> I want to display something else if the query returns empty. Like some >> instructions and buttons. >

[web2py] SQLFORM.grid changing the behaviour when there are no records

2017-02-13 Thread Paul Ellis
I want to display something else if the query returns empty. Like some instructions and buttons. I can't find anything in the SQLFORM.grid signature, like an on_empty option and haven't found anything in the book or by googling. As the Add button doesn't fit this situation. I am getting a DIV

[web2py] Re: [web2py:34645] Re: Does your Response Flash get in the way?

2017-02-13 Thread Paul Ellis
Hi Thadeus, How did you move the flash messages? On Thursday, 5 November 2009 17:52:15 UTC+1, Thadeus Burgess wrote: > > Instead of putting a timer on response.flash, I moved its location to > another location on the site that does conflict with any text. > > -Thadeus > > > > > On Thu, Nov 5,

[web2py] Changing the default PDF dowload filename (fpdf)

2017-02-12 Thread Paul Ellis
When want to save a PDF made with FPDF and web2py. The filename is always the controller function name (pdf_view) in this case. I would like to make the filename take a value from the database. Customer name or Business name for example. I have tried adding a name in the output() but it

[web2py] Re: Changing Bootstrap Navbar to light background colour

2017-02-07 Thread Paul Ellis
In my version of web2py the layout.html has this: However, it is definitely black. If I change it to navbar-inverse I get a green navbar. By using the above css. I am able to get a light navbar. Thanks On Thursday, 3 December 2015 11:32:48 UTC+1, Leonel Câmara wrote: > > I don't mean in the

Re: [web2py] Re: How to add an input field in SQLFORM.grid??

2016-11-28 Thread Paul Ellis
What about if I don't use 'callback' but 'href' so it loads the whole page. I still can't get the quantity value to be passed as an arg. On Saturday, 26 November 2016 14:35:33 UTC+1, Anthony wrote: > > On Friday, November 25, 2016 at 11:11:41 PM UTC-5, Paul Ellis wrote: >> >>

Re: [web2py] Re: How to add an input field in SQLFORM.grid??

2016-11-25 Thread Paul Ellis
Hi, I am trying to do the same thing as the OP. Add a quantity input field to a grid and then use Callback to work with the product_id and quantity. I just don't seem to be able to pass the quantity to the callback function. Using this method I don't get a value from quantity.