[web2py] Re: 2to3

2020-12-14 Thread villas
The framework is compatible with both. However, your own code may only be compatible with one or the other - that's up to you. Once you get to know what the differences are, you can scan the code pretty easily yourself. Still, the 2to3 is helpful if you have lots of code. One simplistic

[web2py] Re: 1050 OperationalError

2020-12-14 Thread villas
It is possible that you do not have a .table file in the databases folder, but yet the db.auth_user table already does exist in your database. The solution to that problem is usually to use fake_migrate to generate a corresponding table file. This can be found referenced in the book. Hope

[web2py] Re: File Manager plugin

2020-12-14 Thread villas
One idea included in the framework is this: http://www.web2py.com/books/default/chapter/29/14/other-recipes?search=expose#Publishing-a-folder On Saturday, 12 December 2020 at 17:37:46 UTC veron.p...@gmail.com wrote: > > Hello i'm new to web2py , and it is really a fabulous framework. From the

[web2py] Re: Authorization form and drop-down list

2020-12-14 Thread villas
Welcome to the framework and group! What you describe is not so difficult to achieve, but if someone writes a simple app for you, you will not have really made any progress for yourself as a developer. I suggest that you first familiarize yourself with the book www.web2py.com/book, check

[web2py] Re: Embarrassing question time again: NameError: name 'post' is not defined

2020-12-11 Thread villas
You're welcome! (Just one more thing, you posted in the wrong group. But no prob! Best wishes) On Friday, 11 December 2020 at 00:26:34 UTC mkt...@gmail.com wrote: > Thanks a ton, villas! Hilariously I got it right in the tutorial but I was > retyping everything by hand just to mak

[web2py] Re: Embarrassing question time again: NameError: name 'post' is not defined

2020-12-10 Thread villas
In your view new.html file you are referencing a post record. I suppose you should be displaying the form. [[=form]] Just keep experimenting and note that if a valid record id from db.post in not found then it would evaluate as None. This means that, for example, post.title would then give

[web2py] Re: Digitally sign URLs

2020-12-09 Thread villas
So doesn't the URL(..., user_signature=True) and @auth.requires_signature() decorator do exactly what you want? Maybe you want either/or decorator to work, in which case try the decorator @auth.requires() with your specific logic. You can also use the URL.verify()

Re: [web2py] PostgreSQL - column "COLUMN" must appear in the GROUP BY clause or be used in an aggregate function LINE 1:

2020-11-16 Thread villas
Usually, you would only require GROUP BY if you were trying to calculate an aggregate function such as the SUM, COUNT, AVG etc on a column. In this case, you are not specifying any such function, so it is unclear what you are trying to do. Perhaps you are simply trying to express an ORDER BY?

[web2py] Re: No such file or directory UPLOAD

2020-11-09 Thread villas
Re: thumbnail. Your code already uses it. BTW I think everyone uses Pillow now (drop in replacement for PIL with similar methods). On Sunday, 8 November 2020 at 19:54:58 UTC gaelpri...@gmail.com wrote: > > An interesting routine, but I just use PIL's thumbnail() method. Could > you

[web2py] Re: Can't import gluon.contrib.simplejson after migrating to Python 3

2020-10-13 Thread villas
hould I replace this with? > > On Wednesday, October 9, 2019 at 7:42:30 AM UTC-7 villas wrote: > >> I think we stopped using simplejson some time ago. >> >> Now, when you do this: >> from gluon.contrib import simplejson >> >> ... this happens ... >> fr

[web2py] Re: OT PollyReports generate PDF using bands from DB

2020-10-06 Thread villas
It is strange that Geraldo Reports and PollyReports do not seem to have been maintained for years. Maybe everyone is using something else these days? On Thursday, 1 October 2020 at 15:58:39 UTC+1 DenesL wrote: > > While searching for a Python PDF package I found PollyReports and was >

[web2py] Re: uploadfolder=request.folder not working as it expected

2020-10-06 Thread villas
Maybe you are not using a separator (eg '/'). Try something like this: uploadfolder = os.path.join(request.folder, 'static/docs') On Monday, 5 October 2020 at 17:21:43 UTC+1 mostwanted wrote: > *uploadfolder=request.folder+'static/docs' *suddenly aint working as it > should, initially is

[web2py] Re: How can I use vue attributes inside FORM?

2020-09-24 Thread villas
Hi, I'm glad your code is working. However, as I am still not clear on what you want, I hope someone more familiar with vuejs will be able to assist. Best wishes. On Thursday, 24 September 2020 at 18:18:08 UTC+1 Константин Комков wrote: > Thank you, for your attention *Villas*. I don't

[web2py] Re: How can I use vue attributes inside FORM?

2020-09-24 Thread villas
It does not seem easy to read and I'm not sure I can help without rewriting your code. However, in your function... def get_help_id(name): result = None if len(name) > 5: try: result = int(name[5:]) except: return result

[web2py] Re: How can I use vue attributes inside FORM?

2020-09-23 Thread villas
**{'_v-model': 'year'}).xml()) > > > среда, 23 сентября 2020 г., 18:41:12 UTC+3 пользователь villas написал: > >> Strange, copy and paste lines in the shell... >> >> >>> years = ['2020','2021'] >> >> >>> SELECT(*years, _name='year', _id='yea

[web2py] Re: How can I use vue attributes inside FORM?

2020-09-23 Thread villas
cun't create them inside > function in controller. Villas, your example is the same - not work. If I > add **{'_data-test': 'test'} - when form was generated I have > data-test="test" in select, **{'_v-model': 'year'} -when form was generated > I don't have v-model="y

[web2py] Re: How can I use vue attributes inside FORM?

2020-09-23 Thread villas
I didn't really think about what you are trying to do, but maybe this will help for your specific bug: SELECT(*years, _name='year', _id='year', _class='form-control', requires=IS_INT_IN_RANGE(request.now.year - 1, request.now.year + 1, error_message="Year isn't correct!"), **{'_v-model':

[web2py] Re: sum decimal error?

2020-09-15 Thread villas
That's great Denes and good luck with your app :) On Monday, 14 September 2020 at 15:46:55 UTC+1 DenesL wrote: > I have found my mistake, in the query > db(ti.DocNum == doc) > I was using the wrong variable (doc) which is a row, > it should be docnum. > > Thanks villas for y

[web2py] Re: sum decimal error?

2020-09-14 Thread villas
to an int, but for example 'A1234' would clearly not work. Your data could turn out to be the problem but problems and bugs can be DB specific too. Keep experimenting! Best wishes. On Friday, 11 September 2020 at 16:26:51 UTC+1 DenesL wrote: > Hi villas > > thanks for your sugges

[web2py] Re: sum decimal error?

2020-09-11 Thread villas
_ On Friday, 11 September 2020 at 03:30:54 UTC+1 DenesL wrote: > Hi villas > > thanks for your reply. > There should be no NULLs in there since I deleted all tables and started > from a blank slate. > Still no idea why this happens. Why is trying to use __int__ if it is a >

[web2py] Re: sum decimal error?

2020-09-10 Thread villas
Hi Denes Just a thought, and I'm not sure if this is the answer, but the following indicates that there is a null value in the DB field: TypeError: __int__ returned non-int (type NoneType) Maybe you initially created the field without a default and then added the default=0.0 later. This may

[web2py] Re: response.meta.keywords of type "map"

2020-09-03 Thread villas
l thing in python because when i read about it, it always points to type >> dict. >> >> On Wednesday, September 2, 2020 at 10:58:00 PM UTC-4 lucas wrote: >> >>> >>> no, i tried all those tests. when i simply do return >>> BODY(type(response.meta.ke

[web2py] Re: response.meta.keywords of type "map"

2020-09-02 Thread villas
le name'] = "keyword > string"" and both blew up with an exception also. very strange change of > response.meta.keywords. > > On Wednesday, September 2, 2020 at 10:39:37 AM UTC-4 villas wrote: > >> I'm not sure what you are doing exactly but you seem to ha

[web2py] Re: response.meta.keywords of type "map"

2020-09-02 Thread villas
I'm not sure what you are doing exactly but you seem to have created a map iterator. Maybe you could convert that to a list? You might be able to work with it more easily. Something like this: list( response.meta.keywords ) On Wednesday, 2 September 2020 at 12:52:27 UTC+1 lucas wrote:

[web2py] Re: DAL Could not create constraint or index

2020-08-19 Thread villas
the above, the book explanation should make a little more sense. On Wednesday, 19 August 2020 09:43:42 UTC+1, Andrea Fae' wrote: > Hello Villas, unfortunately other problems to this game... > I used archiving, and so this type of table definitions > > db.define_table('a

[web2py] Re: DAL Could not create constraint or index

2020-08-18 Thread villas
, but it is a work around solution. I am hoping that someone will eventually fix this contraint problem in pyDal. On Tuesday, 18 August 2020 20:51:57 UTC+1, Andrea Fae' wrote: > > Thank you Villas. I'm using option 2 and now I have the tables without > "created_by" and "modified_by&quo

[web2py] Re: DAL Could not create constraint or index

2020-08-17 Thread villas
Hi Andrea I was pleased to see you are making progress with the DB connection etc. I can see why mssql does not like the cascade from the same auth_user table. This may be an issue which needs fixing... To get things moving, and this might not be ideal, but I propose you consider either of

[web2py] Re: Server SQL non existent or access denied

2020-08-15 Thread villas
>> Do I have to install any ODBC SQL Server Driver on my client? Hi Andrea I feel your frustration and, although I do not use mssql, I believe you will certainly require a suitable ODBC driver installed so you can then connect to that datasource using pyobc. Maybe this will help

[web2py] Re: Migrate web2py sqlite application to mssql

2020-08-14 Thread villas
eck_success > ctrl_err(SQL_HANDLE_DBC, ODBC_obj.dbc_h, ret, ODBC_obj.ansi) > File "c:\web2py\gluon\contrib\pypyodbc.py", line 966, in ctrl_err > raise DatabaseError(state,err_text) > DatabaseError: (u'08001', u'[08001] [Microsoft][ODBC SQL Server > Dri

[web2py] Re: Migrate web2py sqlite application to mssql

2020-08-12 Thread villas
Here are some notes which you may find helpful... The basic idea is this: - Create a new DB using your preferred MSSQL management tool. - Change your DAL connection string and run the app. - Check that the new DB has all the tables. - Migrate your data Please read the following

[web2py] Re: What happened to OptionsWidget

2020-08-11 Thread villas
OptionsWidget is still in the code (see gluon/sqlhtml.py) I guess you introduced a typo or something... On Tuesday, 11 August 2020 09:16:10 UTC+1, Annet wrote: > > I coded a custom radio widget: > > def inlineRadioOptions(field, value, **attributes): >... > > attr =

[web2py] Re: Altering reference table format in SQLFORM

2020-08-11 Thread villas
Off the top of my head, maybe these ideas would put you on a better track... :) 1. The reference field has a default validator, try changing it to something like this: db.assignments.marker.requires = IS_IN_DB(db, 'markers.id', '%(last_name)s, %(first_name)s (%(email)s)') 2. Check out the

[web2py] Re: How to shorten URL name for web2py with multiple controllers

2020-08-10 Thread villas
I'm pretty sure that you could omit the default_controller from all your routes, if you wish. Obviously additional controllers should be explicit. To shorten names, I suggest you set up aliases to your normal functions. You can do this on your webserver, or using the web2py routes file, or

[web2py] Re: Has anybody had experience with Visual Studio Code Remote Development?

2020-08-10 Thread villas
In the absence of other replies... Massimo has mentioned (in the py4web group) that he knows generally that many developers are using Visual Studio remotely and it is a very good set up, so he strongly recommends it. This

[web2py] Re: Error with FDB in new version of Web2py

2020-08-06 Thread villas
Best way to update is probably just using git. Read the notes referring to pyDAL here: https://github.com/web2py/web2py If you want a quick and dirty experiment, see whether updating the adapter file firebird.py

[web2py] Re: Error with FDB in new version of Web2py

2020-08-06 Thread villas
It's a good time to update pyDAL too! -- 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

[web2py] Re: data-tooltip from stupid.css gens exception when placed as an attribute into web2py html tag functions

2020-08-03 Thread villas
This is a known 'quirk'. You may find the following section of the book helpful... http://www.web2py.com/books/default/chapter/29/05/the-views?search=_data#HTML-helpers -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: How to force a redirect to login page when session expires

2020-07-29 Thread villas
This discussion should help On Wednesday, 29 July 2020 08:41:46 UTC+1, mostwanted wrote: > > Hi guys, is there a way to force a redirect to a login page when a session > expires to

Re: [web2py] Re: login expiration time

2020-07-27 Thread villas
> Regards > > On Fri, 24 Jul 2020 at 15:20, villas > > wrote: > >> If you are using an iframe to display a page from the same app, I have >> the impression that your design might be wrong. You will probably find a >> better way after you give this a little more thoug

[web2py] Re: login expiration time

2020-07-24 Thread villas
If you are using an iframe to display a page from the same app, I have the impression that your design might be wrong. You will probably find a better way after you give this a little more thought. Sorry if this answer does not seem so helpful. -- Resources: - http://web2py.com -

[web2py] Re: Radio Buttons basic inline editing in SQLFORM.grid

2020-07-24 Thread villas
Are you sure you cannot use ajax? I think that would be much easier. -- 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

[web2py] Re: import_from_csv_file and auth.signature

2020-07-24 Thread villas
Did you try... db.locations.created_by.default = 1 # or whateverdb.locations.modified_by.update = 1 prior to: import_from_csv_file -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-23 Thread villas
(conflict handling methods) in my validation function! > > With the above code I wanted to just keep up with the whole automatic > notion of it! > > On Thursday, July 23, 2020 at 1:12:17 PM UTC+2, villas wrote: >> >> Suggestion: >> Your idea of overriding the user's selec

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-23 Thread villas
already exists in the whole > database", _style="font-weight: bold;") > > The above code doesnt work but its the concept thats in my head, where can > I fix it? > > > On Tuesday, July 21, 2020 at 12:16:29 PM UTC+2, villas wrote: >> >> Your my_validator f

[web2py] Re: How to prevent submitting form details that already exist as a record in the database

2020-07-21 Thread villas
Your my_validator function iterates through the whole table. This is OK when you have a few records, but very inefficient if you have thousands/millions. Why not simply query the table? Something like this... def my_validator(form): if db((db.lecture.id == form.vars.id) &

[web2py] Re: problem with list:reference

2020-07-20 Thread villas
Your model deletes the records and recreates them every time the model runs. This is not such a good idea for testing. Furthermore, it seems to retain the first product, but deletes the referenced keys. Your table ids are not reset to zero, so your first product will probably have missing

Re: [web2py] display items only entered by a logged in user in a dropdown menu of a reference table

2020-07-20 Thread villas
>> Please advise how to create multiple rows insert by usung SQL form . You have to create a form with multiple rows and then loop through multiple records when the form is accepted. To give you a better idea, here is a snippet from some code I used in the distant past. It updates multiple

[web2py] Re: smart grid

2020-07-17 Thread villas
It seems that you are using two DBs (db and dblc). In my experience, you cannot make relationships across two distinct DBs. Suggestion: 1. Create a set of all the lc_vw_lc_master.lc_no possibilities 2. Create a normal string field for pm_events.lc_no with a IS_IN_SET validator. If the

[web2py] Re: Under what circumstances would db.define_table() return None

2020-07-17 Thread villas
That's great Andrew. BTW great to see that Anthony is helping - he is someone who really knows the nuts and bolts of web2py! On Friday, 17 July 2020 08:05:40 UTC+1, Andrew Rogers wrote: > > Thanks for your response Villas. My reason for this approach is that i > have a lo

[web2py] Re: how to update a database field with a random value selected from a list using random.choice()

2020-07-16 Thread villas
time2=the_time > > @auth.requires_login() > def index(): > form=SQLFORM(db.lecture) > if form.process(onvalidation=my_form_processing).accepted: > response.flash=T('Lecture Entered') > return locals() > > Thank you guys, much appreiated. > > On Wednes

[web2py] Re: how to update a database field with a random value selected from a list using random.choice()

2020-07-15 Thread villas
: > > Thank you Villas, i updated my controller like this & its giving results. > I a sure there is a better way to do this, a ore cleaner way & if anyone > cares to improve my code please dont hesitate so i could update mine & > learn more: >

[web2py] Re: Under what circumstances would db.define_table() return None

2020-07-15 Thread villas
You don't mention... - Which DB adapter you are using - Why just one of your tables is expected to be an in-memory table and the others not - Why you don't simply maintain the list of tables in a list(), or dict() or some other in-memory structure In any case, maybe this idea

[web2py] Re: how to update a database field with a random value selected from a list using random.choice()

2020-07-15 Thread villas
Before submission of form, use JS. or After submission, allocate the time in the controller using *onvalidation*. See http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#onvalidation On Wednesday, 15 July 2020 13:58:28 UTC+1, mostwanted wrote: > > I thought it would be

[web2py] Re: Schema for auth table

2020-07-03 Thread villas
Did you try this... auth = Auth(db) auth.define_tables() auth2 = Auth(db2) auth2.define_tables() On Saturday, 20 June 2020 21:14:58 UTC+1, Deep Shah wrote: > > Hi Team, > > I have 2 schemas A and B. Default schema for user is A. I am using > postgres. > I have authetication table in schema

[web2py] Re: pyDAL looks abandoned?

2020-05-25 Thread villas
d your ticket on > github and your fix worked for me too. > > I saw the other day that your fix was finally merged. > > I just wonder when the next version of pyDal will be released. > > On Wednesday, May 13, 2020 at 10:33:45 PM UTC+7, villas wrote: >> >> Val, I empa

[web2py] Re: pyDAL looks abandoned?

2020-05-13 Thread villas
Val, I empathize because I have been waiting for 3 months to include a test connect string for Firebird . Firebird simply won't work without this, but no one even adds a comment. I imagine that there are not enough devs, and I understand it is

[web2py] Re: Visual Studio Code

2020-05-01 Thread villas
Further to Andrew's reply you could also try these ideas: http://www.web2py.com/books/default/chapter/29/14/other-recipes?search=ide+#Using-general-purpose-IDEs-with-web2py https://github.com/Andyhasit/web2py_intellisense -- Resources: - http://web2py.com - http://web2py.com/book

Re: [web2py] Re: Py4web readonly Form

2020-03-21 Thread villas
Hi John What you say doesn't make much sense because you can style and view data however you wish, including in a readonly form. Similarly a button can redirect your users to wherever you wish. You don't need the framework forms for that. Just style your page how you wish. On Saturday, 21

[web2py] Re: web2py broken with Python 3.8

2020-03-14 Thread villas
Hi Jim I think you are understanding it correctly, there isn't enough explicit info to give you enough reassurance.about moving to 3.8. I do not use 3.8 myself, but if Massimo says it works, then I assume it now does, but you still have to test your own app in your own environment. As you

[web2py] Re: web2py broken with Python 3.8

2020-03-12 Thread villas
web2py itself is designed to work on both versions of python. Perhaps it goes without saying, any code that you write yourself must be compatible with the python that you are targeting. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

[web2py] Re: installing py4web using pip -- where is py4web-start.py?

2020-03-12 Thread villas
Tim, You are right, it is not so clear. However, the py4web Github home page states: *Notice "py4web-start" uses the pip installed py4web, "./py4web-start.py" uses the local one. Do not get confused. * I guess the docs should include the info from the Github page. On Thursday, 12 March 2020

[web2py] Re: Migration from sqlite to mysql - different field-order

2020-03-10 Thread villas
You are in a mess because your sqlite table does not reflect your define_table for 'repo'. If you include auth.signature, then you should also have these fields: Field('is_active', 'boolean', default=True), Field('created_on', 'datetime',

[web2py] Re: Many records in one transaction

2020-02-28 Thread villas
It seems this is a complex routine and I can only talk in general terms. Perhaps you do need a temporary table, and it should not be a problem to create one. However, it still seems strange that you think the problem might be the webserver rather than the DB. I do not know how to help with

[web2py] Re: Substituting an email address with a reference in a web2py emailing form

2020-02-28 Thread villas
If details.email_address is a var, then it shouldn't be in quotes. To avoid any doubt, just use a str: 'myt...@validemail.com' General approach: "first get it working, then improve it". Maybe this will help... def contact_us(): details=db.hotel_profile(request.args(0, cast=int))

[web2py] Re: How to make links to another page

2020-02-28 Thread villas
Maybe it is not finding the associated view? Look at these two examples... Controller: myapp/controllers/default.py function def myfunct() Uses this view file: myapp/views/default/myfunct.html Controller: myapp/controllers/newcont.py function def anewfunc() Uses this view file:

[web2py] Re: Py4Web "tags" should be SCOPES

2020-02-26 Thread villas
Hi Kevin JWT seems to have everything we might need, although I am not knowledgable enough to really help in implementing it. However, perhaps you know whether there is a *documented way for py4web to generate and verify signed urls?* (Hopefully with expiry). If at least that mechanism

Re: [web2py] Re: Setting a default reference value as that of a specific group the logging in user is a member of

2020-02-26 Thread villas
Naturally you can still use auth to identify the user. The auth groups is really just to identify the type of user, e.g. teachers, students, admins. This is useful for allowing access to certain functionality. You must still design your DB and create links between your tables using

[web2py] Re: Setting a default reference value as that of a specific group the logging in user is a member of

2020-02-25 Thread villas
Set the default hotel value in the SQLFORM field. You could also 'force' the hotel you want by using SQLFORM onvalidation On Tuesday, 25 February 2020 07:28:31 UTC, mostwanted wrote: > > I have 2 tables

[web2py] Re: web2py represent_none in SQLFORM.smartgrid in combination with date field throws exception

2020-02-25 Thread villas
I've never used represent_none, but it seems like a bug. Workaround: I guess you can try setting the field individually. Something like this.. db.mytable.somedate.represent = lambda v,r: v.strftime('%d %b %Y') if v else 'No Date' -- Resources: - http://web2py.com -

[web2py] Re: Redirect "website.pythonanywhere.com" to "www.newwebsite.de"

2020-02-22 Thread villas
Hi Alexander If you cannot redirect using the webserver, and you cannot figure out routes, I guess you could still do something simple in your web2py controller, like this... def index(): redirect('https://www.my_redirected_site.com{0}'.format(request.env.request_uri)) -- Resources: -

[web2py] Re: Many records in one transaction

2020-02-22 Thread villas
You do not explain why you would need to delete and then insert 25K records to prepare a timetable. It seems that you are creating a temporary table and that is seldom the correct approach. - If all the data is already available in the tables, then you should be able to write SQL

[web2py] Re: Saving a view as an file/image

2020-01-27 Thread villas
Generating PDFs can be a challenge, so it would be much easier to style the vouchers in HTML. Re: QRcodes. You can even generate QRcodes using Markmin, or, just use the Google Charts API directly. Search web for other solutions. On Sunday, 26 January 2020 14:25:47 UTC, John Bannister wrote:

[web2py] Re: Where do we place the routes.py file?

2019-10-11 Thread villas
'Reload Routes' button is at top right on main admin screen. Please read docs, you can simply search for routes, e.g.: http://www.web2py.com/books/default/chapter/29/04/the-core?search=routes#URL-rewrite -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Bugfixes for older versions of Web2Py?

2019-10-11 Thread villas
You should update to the latest version. In my experience, trying to do anything else will, in the long term, waste more time and effort (and be insecure). One of the main features of web2py is that it is backward-compatible. On Friday, 11 October 2019 06:38:52 UTC+1, Bruno Heremans wrote:

[web2py] Re: I want to delete the file created as a result of an upload field.

2019-10-09 Thread villas
I must confess that I had a sudden feeling of panic on seeing: DELETE xxx FROM yyy ... My experience is there is little or no benefit in deleting records. Record versioning and archiving is the way to go. That is_active field may have a purpose after all! And you can always write a function

[web2py] Re: Can't import gluon.contrib.simplejson after migrating to Python 3

2019-10-09 Thread villas
I think we stopped using simplejson some time ago. Just try this: from json import * -- 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

[web2py] Re: PyDAL+MSSQL+FreeTDS: pyodbc.ProgrammingError

2019-10-09 Thread villas
This is the "LIKE predicate escape character". It's harmless, but google it if you wish. https://github.com/web2py/pydal/blob/5a31738a28028392515b26d10a4a87df6a38d7a1/pydal/dialects/mssql.py#L163 FYI please also note: Driver / Unicode Support PyODBC works best with Microsoft ODBC drivers,

Re: [web2py] a first py4web video tutorial - running on pythonanywhere.com

2019-10-09 Thread villas
Isn't this mainly a CSS issue? Simply make sure you use a mobile-first CSS framework. -- 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

[web2py] Re: Db Creation Error Message : Adapter not found for sqLite

2019-10-09 Thread villas
Adapter not found for sqLite Isn't this a capitalisation problem? Should be *sqlite*? I recommend keeping everything as simple as possible. Therefore, place all your code into db.py and dispense with db1.py On Saturday, 28 September 2019 19:30:07 UTC+1, dangeo wrote: > > Hello to All, > >

[web2py] Re: Dropzone app thumbnail error in web2py appliances

2019-10-09 Thread villas
Clearly you are mixing character sets somewhere. This can happen when saving *utf8* characters into a *latin-1* database, for example (or vice versa). Look for any unusual characters (with accents or symbols) in your app, data or even filenames. You can inadvertently introduce the problem by

Re: [web2py] How do I solve an image validation error?

2019-10-08 Thread villas
Do you have Pillow image library installed? Check with python commandline: >> from PIL import Image If the system comes back with a ">>>", the Pillow modules are properly installed. If not, install it... pip install Pillow On Sunday, 6 October 2019 12:29:10 UTC+1, Maurice Waka wrote: > >

Re: [web2py] Re: How do I configure reading text for all images using Hide/Readmore code?

2019-10-08 Thread villas
the way to display the image and message. > Do you have an example of how I can do it? > Regards > > On Mon, 7 Oct 2019, 18:09 villas > wrote: > >> The HTML elements in your loop should be given *unique *ids and then you >> can address them individually. >>

[web2py] Re: auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-08 Thread villas
07:55:14 UTC+1, Annet wrote: > > Hi Villas, > > Will your solution still work when you change the value of role in the > auth_membership table? In your mygroupdict you define the role values > again, so that there is no single point of definition. > > I may be wrong

[web2py] Re: How do I configure reading text for all images using Hide/Readmore code?

2019-10-07 Thread villas
The HTML elements in your loop should be given *unique *ids and then you can address them individually. *Also, optionally...* I would advise you to only access your DB in the controller, (rather than the view). Create a list (or even 2 lists) containing your image links and associated data.

[web2py] Re: auth_membership grid with both, group id and group roles displayed when adding a new record

2019-10-07 Thread villas
By specifying requires = IS_IN_SET(ids), you are also overriding the represent too. See below, I hope it will point you in the right direction: mygroupdict = {1:'Public',2:'Private',3:'Admin'} db.auth_membership.group_id.requires = IS_IN_SET(mygroupdict,zero=None))

[web2py] Re: web2py seems to be ignoring my html page and just displaying function varibles

2019-10-04 Thread villas
As Massimo implies, your function is not finding your view, so it is using a generic view instead. Check carefully that your view is saved in the correct directory: pluralsight/views/basics/random_number.html -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: decremental subtraction of values in DB field 2

2019-09-19 Thread villas
Just a suggestion, but why not try something easy, like: - add a date field to your model - when saving a record from an entry form, use onvalidation - in the onvalidation function, find the previously dated record - compare the previous record with the current entries - calculate

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-12 Thread villas
Well done for getting it working... We're all learning from each other here! :) On Thursday, 12 September 2019 12:27:27 UTC+1, mostwanted wrote: > > Sorry @villas its just a bad habit that i have somehow over time gotten > used to but i will heed your advice, thank you. >

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-12 Thread villas
for item1 in item1: I mentioned this to you before -- please do not do this! It is a really bad practice which will cause terrible problems for you. For example, do this instead: for i in item1: Best wishes for your program. -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Gantt for python/Web2py

2019-09-08 Thread villas
What you posted already looks great, so my suggestion will probably not improve on that... I often use the Google Charts libraries. https://developers.google.com/chart/interactive/docs/gallery/ganttchart -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: How can I update the record in one table with value entry of another table as soon as the value is entered?

2019-09-08 Thread villas
Sorry to hear you are struggling with this. vat=round(total*0, 2) The above line would always produce: vat == 0.0 which doesn't seem intentional. text=int(request.vars.name) To make your program more robust, I suggest using try...except to catch any errors in the above line. -- Resources: -

[web2py] Re: Gostaria de saber se o web2py ou até mesmo o proprio python trabalha com steb by step guide

2019-09-08 Thread villas
Hi Kimus It seems you are looking for "web2py tutorials", so try searching for that. Also, this thread might help you get started... https://groups.google.com/forum/#!searchin/web2py/tutorial%7Csort:date/web2py/hncAG75rx3g/S_k4dBZdDwAJ -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Interaction between two selects

2019-09-05 Thread villas
Maybe one of these will help: https://www.jqueryscript.net/tags.php?/Cascading%20Dropdown/ https://github.com/scubism/sqlabs/blob/master/modules/plugin_lazy_options_widget.py http://www.web2pyslices.com/slice/show/1724/cascading-dropdowns-simplified

[web2py] Re: Validate Dates

2019-08-20 Thread villas
To validate a field within a range, use is_date_in_range To validate fields in relation to each other after form submission, use onvalidation

[web2py] Re: No being able to access all the details from a for loop in the view

2019-08-14 Thread villas
input @villas but i can't change the link to an id because > it already has a class is called *whatsapp *which is the one i am calling > on the *click *function> >> try: >> >> $(document).on("click", '#whatsapp', function(e) { >> >> >> &

[web2py] Re: No being able to access all the details from a for loop in the view

2019-08-13 Thread villas
Not sure, but maybe it is because you are using a class selector instead of id. In place of: $(document).on("click", '.whatsapp', function(e) { try: $(document).on("click", '#whatsapp', function(e) { On Tuesday, 13 August 2019 06:46:02 UTC+1, mostwanted wrote: > > I am working on a

[web2py] Re: A calculation gives unsupported operand type(s) for -: 'str' and 'str'

2019-08-13 Thread villas
Check in DB what kind of field is '*daysLoaned*'. Maybe it is defined as a Str field? Try: Field('daysLoaned', compute=lambda r: str(r['returning_date']-r['loaning_date']).days) Just an idea... -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: ASSIGNJS Decimals

2019-08-05 Thread villas
Here is an example. I think this is a problem: >>> from gluon.serializers import json >>> json(decimal.Decimal(123.456)) '"123.45600030695446184836328029632568359375"' I think this is what a user would intend: >>> json(float(decimal.Decimal(123.456))) '123.456' *Suggestion:* In

[web2py] ASSIGNJS Decimals

2019-08-02 Thread villas
It would be great if ASSIGNJS would serialize Decimal numbers as Float rather then quoted Str. Unless I'm overlooking something, I suppose this would be a bug? Thanks. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

Re: [web2py] Re: web3py -> py4web

2019-07-30 Thread villas
On Tuesday, 30 July 2019 07:35:08 UTC+1, Massimo Di Pierro wrote: > > I did not know about this. It has a cost. I'd rather not pay for it. > 1. Just so you know, from GitBook Pricing page: > GitBook is free for open-source & non-profit teams > 2. Markdown

  1   2   3   4   5   6   7   8   9   10   >