[web2py] Re: Exporting a table to csv
Hi there, Found a way to solve it, and thought I'd share in case others search on this topic. Replace the str(...) below with str(...).encode(), so that it looks like this: open('test.csv', 'wb').write(str(db(db.student).select()).encode()) Regards, Chris On Monday, 3 September 2018 22:53:11 UTC+8, Chris_I wrote: > > Hello All, > > Just started learning web2py a few days ago, and am really enjoying it! > > Working through the chapter on DAL in the Book, I noticed I got an error > when doing this: > > open('test.csv', 'wb').write(str(db(db.student).select())) > > > The message I get is: > > TypeError: a bytes-like object is required, not 'str' > > > It occurs in: > > > File "mypath/web2py/gluon/packages/dal/pydal/base.py", line 844, in > export_to_csv_file > > ofile.write('TABLE %s\r\n' % table) > > > > The select() returns 5 perfectly normal-looking rows. > > > Am I overlooking something obvious? > > > Thanks, > > > Chris > > > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: database field is added and deleted immediately afterwards
I had another *.py file as backup in my model folder. I changed the extension and all is works fine. thanks for the hint On Monday, September 3, 2018 at 4:42:07 PM UTC+2, Anthony wrote: > > Is it possible you have a second definition of the table that does not > include the c_total_difference column? > > On Monday, September 3, 2018 at 7:13:26 AM UTC-4, Yebach wrote: >> >> Hello >> >> When I add a field to my db.py I get an error saying field does not exist. >> If I check the sql log file there is >> >> timestamp: 2018-09-03T12:08:38.256000 >> ALTER TABLE counters ADD c_total_difference INTEGER; >> success! >> timestamp: 2018-09-03T12:08:38.381000 >> ALTER TABLE counters DROP COLUMN c_total_difference; >> success! >> >> Why is the field deleted?? >> >> My settings are migrate = True, fake_migrate = False >> >> Thank you >> > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Err while trying to submit a new web2py site
Hi All, I am not able to submit a new site [http://web2py.com/poweredby/default/submit]. While doing that a ticket is raised. Please see the screenshot attached. Rahul -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: global name 'Recaptcha' is not defined error when my app is run in web2py 2.17.1 (latest)
Thank you very much Anthony. I have opened a ticket in git #2001 Cheers, Rahul On Monday, September 3, 2018 at 8:21:21 PM UTC+5:30, Anthony wrote: > > On Monday, September 3, 2018 at 12:29:02 AM UTC-4, Rahul wrote: >> >> Hi Anthony, >>Yes - It is defined in db.py file as >> >> from gluon.tools import Recaptcha >> > > The above should generate an error, as there is no longer a Recaptcha in > gluon.tools. It has been replaced with Recaptcha2. > > Actually, I'm not sure why this was done, as it has broken backward > compatibility. At some point Recaptcha2 was added, but Recaptcha remained > as well. Feel free to post an issue on Github, as we should not have broken > backward compatibility. > > 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Can't understand this error in gluon/rewrite.py
On Monday, September 3, 2018 at 1:47:41 PM UTC-4, Leonel Câmara wrote: > > Since it only happens with some installations, my guess is that this is > happening in the case where this is the only web2py app (not even the admin > or welcome is installed). In this case the list of applications is probably > a single string instead of a list. > > Are you setting routers.BASE.applications somewhere in your routes.py? > > Otherwise, I think this is definitely a web2py bug where the default value > of routers.BASE.applications which is a string 'ALL' is being passed > without being converted to a list of all applications. > Doesn't look like routers.BASE.applications is set in routes.py, but it appears that somehow in the context of the scheduler, the default value of 'ALL' is not getting converted to a list of apps. It's hard to track down exactly where things are going wrong. Lisandro, maybe confirm the value of routers.BASE.applications at that point in rewrite.py by printing/logging it. 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py website shell not available?
Thank you for help! W dniu poniedziałek, 3 września 2018 17:36:34 UTC+2 użytkownik Anthony napisał: > > On Monday, September 3, 2018 at 10:52:44 AM UTC-4, bronek...@gmail.com > wrote: >> >> Dear All, >> >> First of all, I'm quite a newbie in web app dev, so there's a big chance >> I have a trival question - apologies for that (tried to find the answer >> here - without positive results). >> >> I want to perform a simple (let's say it's a one time activity) task => >> export one of tables in my db with use of *export_to_csv_file, *yet I am >> unable to find a shell in my web2py edit page. According to learning >> materials button to run the shell should be located below the controllers >> section. >> > > The admin shell was very buggy, so I think it was removed. Instead, start > a web2py Python shell from a console via: > > python web2py.py -S yourapp -M > > 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: how to get currently logged in user name for the component embedded in the wiki text area
I think I have answered myself. This does the job: db.define_table('comments', Field('logged_in_user', 'reference auth_user', default=auth.user_id), Field('user_comment', 'text',requires=IS_NOT_EMPTY()), ) On Monday, September 3, 2018 at 12:02:24 PM UTC-4, 98u...@gmail.com wrote: > > i am getting the error: > 'NoneType' object has no attribute > 'first_name'. > Field('logged_in_user', 'string',auth.user.first_name), > AttributeError: 'NoneType' object has no attribute 'first_name' > > > the site is behind the login page and even when I attempt to go the > homepage (can't open the site) I get above error. Because initially no user > is logged in and the table code is executed early on it seems to me. > > the model for component: > > db.define_table('comments', > Field('logged_in_user', 'string', > default=auth.user.first_name), > Field('user_comment', requires=IS_NOT_EMPTY())) > > the controller: > > @auth.requires_login()def manage_comments(): > return SQLFORM.grid(db.comments) > > > This is embedded as text in the text-area field of the markmin wiki: > > @{component:default/manage_comments} > > > Thanks in advance for any assistance! > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: IS_IN_SET handle dictionary
What Anthony said. But, shouldn't you be using IS_IN_DB for this? -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Can't understand this error in gluon/rewrite.py
Since it only happens with some installations, my guess is that this is happening in the case where this is the only web2py app (not even the admin or welcome is installed). In this case the list of applications is probably a single string instead of a list. Are you setting routers.BASE.applications somewhere in your routes.py? Otherwise, I think this is definitely a web2py bug where the default value of routers.BASE.applications which is a string 'ALL' is being passed without being converted to a list of all applications. -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Can't understand this error in gluon/rewrite.py
This is my routes.py: # -*- coding: utf-8 -*- # creates a dictionary that will map each domain with its own app, # based on the content of a text file called "domains_apps", and also # a list of all the apps installed domains = {} apps = [] _archivo = open('domains_apps', 'r') _lineas = _archivo.readlines() _archivo.close() for _linea in _lineas: domain, app = _linea.strip().split('!') domains[domain] = app if not app in apps: apps.append(app) routers = dict(\ BASE = dict(\ default_controller = 'default', \ default_function = 'index', \ domains = domains, \ root_static = ['robots.txt'], \ map_static = True, \ exclusive_domain = True, \ )\ ) routes_onerror = [] for app in apps: for code in ['403', '404', '500', '503']: routes_onerror.append((r'%s/%s' %(app, code), r'/%s/static/%s.html' %(app, code))) routes_onerror.append((r'%s/*' %app, r'/%s/static/500.html' %app)) The file "domains_apps" looks like this: adn979.com!adn panel.adn979.com!adn_panel blogdemedios.com.ar!blogmedios panel.blogdemedios.com.ar!blogmedios_panel demo.medios.com.ar!demo panel.demo.medios.com.ar!demo_panel diarioprimicia.com.ar!diarioprimicia panel.diarioprimicia.com.ar!diarioprimicia_panel Notice each domain has its own app associated. This web2py instance is running ~600 apps (that is, 600 copies of the same app). Do you see something odd here? In the meantime, I'll verify that all the apps referened in "domains_apps" file are in deed installed apps. El lunes, 3 de septiembre de 2018, 11:40:22 (UTC-3), Anthony escribió: > > What does your routes.py file look like? > > On Monday, September 3, 2018 at 10:25:22 AM UTC-4, Lisandro wrote: >> >> This problem is getting weirder. >> >> I've found that passing integer numbers as args to URL() helper isn't a >> problem for web2py. >> I could successfully run some examples using integer and long integers as >> URL args, and it always works ok. >> In fact, as I stated before, my application uses URL in that way since a >> long time ago, with no errors. >> Even more: in the apps where the code fails, it only fails when it is run >> from the scheduler, but it works ok if it is run from the controllers. >> But, just to remember, it doesn't fail in all the apps, only in some of >> them. But the apps are all the same, it's the same app installed several >> times. >> >> >> A quick resume: >> >> This sentence: >> URL('default', f=f, args=[contenido.id, contenido.slug], extension='', >> scheme=True, host=current.CONFIG.dominio) >> >> >> * from a controller, it always runs ok. >> * from the scheduler, it fails in some applications. >> >> The error points to gluon/rewrite.py: >> >> File "applications/pescaregional/modules/virtual_methods.py", line 248, >> in contenido_url return URL(c='default', f=f, args=[contenido.id, >> contenido.slug], extension='', scheme=True,host=current.CONFIG.dominio) >> if f else None >> File "/var/www/medios/gluon/html.py", line 391, in URL args, other, >> scheme, host, port, language=language) >> File "/var/www/medios/gluon/rewrite.py", line 197, in url_out function, >> args, other, scheme, host, port, language) >> File "/var/www/medios/gluon/rewrite.py", line 1366, in map_url_out return >> map.acf() >> File "/var/www/medios/gluon/rewrite.py", line 1292, in acf self.omit_acf >> () # try to omit a/c/f >> File "/var/www/medios/gluon/rewrite.py", line 1241, in omit_acf if self. >> args[0] in self.functions or self.args[0] in self.controllers or self. >> args[0] in applications: TypeError: 'in ' requires stringas left operand, >> not long >> >> >> I'm a bit lost. >> Where else should I look? >> >> >> El lunes, 3 de septiembre de 2018, 1:45:49 (UTC-3), Lisandro escribió: >>> >>> Thanks for that fast response. >>> If the cause of the problem is passing "contenido.id" as int, then the >>> error is even more weird, because my app uses URL like that in several >>> situations, for example: >>> >>> URL('contenido', 'editar', args=contenido.id) >>> URL('categoria', 'editar', args=categoria.id) >>> URL('default', 'index', args=[categoria.id, page_number]) >>> >>> >>> Now that I think it, the error that I reported happens within the >>> scheduler environment. >>> Could that difference be the reason? Well, even in that case, it >>> wouldn't explain why it works ok in other apps. >>> >>> >>> >>> >>> El lunes, 3 de septiembre de 2018, 1:25:19 (UTC-3), fiubarc escribió: Hello, I think it's more a matter of python language, contenido.id is long type then self.args[0] in 'any string' raise an exception because, as the message says : 'in ' requires string as left operand, not long You can do args=['%s' % contenido.id, or args=[str(contenido.id), Dont know why in others installed apps works, is really weird El lunes, 3 de septiembre de 2018, 0:54:32 (UTC-3), Lisandro escribió: > > I
[web2py] how to get currently logged in user name for the component embedded in the wiki text area
i am getting the error: 'NoneType' object has no attribute 'first_name'. Field('logged_in_user', 'string',auth.user.first_name), AttributeError: 'NoneType' object has no attribute 'first_name' the site is behind the login page and even when I attempt to go the homepage (can't open the site) I get above error. Because initially no user is logged in and the table code is executed early on it seems to me. the model for component: db.define_table('comments', Field('logged_in_user', 'string', default=auth.user.first_name), Field('user_comment', requires=IS_NOT_EMPTY())) the controller: @auth.requires_login()def manage_comments(): return SQLFORM.grid(db.comments) This is embedded as text in the text-area field of the markmin wiki: @{component:default/manage_comments} Thanks in advance for any assistance! -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Web2py website shell not available?
On Monday, September 3, 2018 at 10:52:44 AM UTC-4, broneksmig...@gmail.com wrote: > > Dear All, > > First of all, I'm quite a newbie in web app dev, so there's a big chance I > have a trival question - apologies for that (tried to find the answer here > - without positive results). > > I want to perform a simple (let's say it's a one time activity) task => > export one of tables in my db with use of *export_to_csv_file, *yet I am > unable to find a shell in my web2py edit page. According to learning > materials button to run the shell should be located below the controllers > section. > The admin shell was very buggy, so I think it was removed. Instead, start a web2py Python shell from a console via: python web2py.py -S yourapp -M 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Exporting a table to csv
Hello All, Just started learning web2py a few days ago, and am really enjoying it! Working through the chapter on DAL in the Book, I noticed I got an error when doing this: open('test.csv', 'wb').write(str(db(db.student).select())) The message I get is: TypeError: a bytes-like object is required, not 'str' It occurs in: File "mypath/web2py/gluon/packages/dal/pydal/base.py", line 844, in export_to_csv_file ofile.write('TABLE %s\r\n' % table) The select() returns 5 perfectly normal-looking rows. Am I overlooking something obvious? Thanks, Chris -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] import integer (E+12) from csv
Hello, I am using the database administration tool to import a small portion of data to one of the tables in my db (standard sqlite). The code to create the table: db.define_table('dict_prod_match', Field('prod_tes_id','integer'), #this field is causing troubles Field('prod_ros_id','integer') ) Even though, the first field is 13 digits long so should be valid for integer => ( IS_INT_IN_RANGE(-1e100, 1e100) ) , I have problems with uploading the data (and receive None instead of value). When I tried to insert one record manually I received an error notification to Enter an integer between -2.14748e+09 and 2.14748e+09. Could you please help me with resolving the issue? Thank you very much in advance! Best Regards, -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Web2py website shell not available?
Dear All, First of all, I'm quite a newbie in web app dev, so there's a big chance I have a trival question - apologies for that (tried to find the answer here - without positive results). I want to perform a simple (let's say it's a one time activity) task => export one of tables in my db with use of *export_to_csv_file, *yet I am unable to find a shell in my web2py edit page. According to learning materials button to run the shell should be located below the controllers section. Unfortunately, the only button I can see, while editing, is the *create one.* THank you very much in advance for help & patience. Best Regards, B -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: global name 'Recaptcha' is not defined error when my app is run in web2py 2.17.1 (latest)
On Monday, September 3, 2018 at 12:29:02 AM UTC-4, Rahul wrote: > > Hi Anthony, >Yes - It is defined in db.py file as > > from gluon.tools import Recaptcha > The above should generate an error, as there is no longer a Recaptcha in gluon.tools. It has been replaced with Recaptcha2. Actually, I'm not sure why this was done, as it has broken backward compatibility. At some point Recaptcha2 was added, but Recaptcha remained as well. Feel free to post an issue on Github, as we should not have broken backward compatibility. 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: IS_IN_SET handle dictionary
It is documented here: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Range-set-and-equality-validators. Assuming you want separate values and labels, you can use a dictionary or list of tuples (not a list of dictionaries as you have, though). Anthony On Monday, September 3, 2018 at 6:02:55 AM UTC-4, Yebach wrote: > > Hello > > Is it possible to use validator IS_IN_SET to handle dictionary. I want to > send a list of dicts for user to select [{"id": 1, "m:code": C-111}, {"id": > 2, "m:code": BC-222},.], so when I use on_validate I can handle with id. > > Thank you > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: database field is added and deleted immediately afterwards
Is it possible you have a second definition of the table that does not include the c_total_difference column? On Monday, September 3, 2018 at 7:13:26 AM UTC-4, Yebach wrote: > > Hello > > When I add a field to my db.py I get an error saying field does not exist. > If I check the sql log file there is > > timestamp: 2018-09-03T12:08:38.256000 > ALTER TABLE counters ADD c_total_difference INTEGER; > success! > timestamp: 2018-09-03T12:08:38.381000 > ALTER TABLE counters DROP COLUMN c_total_difference; > success! > > Why is the field deleted?? > > My settings are migrate = True, fake_migrate = False > > Thank you > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Can't understand this error in gluon/rewrite.py
What does your routes.py file look like? On Monday, September 3, 2018 at 10:25:22 AM UTC-4, Lisandro wrote: > > This problem is getting weirder. > > I've found that passing integer numbers as args to URL() helper isn't a > problem for web2py. > I could successfully run some examples using integer and long integers as > URL args, and it always works ok. > In fact, as I stated before, my application uses URL in that way since a > long time ago, with no errors. > Even more: in the apps where the code fails, it only fails when it is run > from the scheduler, but it works ok if it is run from the controllers. > But, just to remember, it doesn't fail in all the apps, only in some of > them. But the apps are all the same, it's the same app installed several > times. > > > A quick resume: > > This sentence: > URL('default', f=f, args=[contenido.id, contenido.slug], extension='', > scheme=True, host=current.CONFIG.dominio) > > > * from a controller, it always runs ok. > * from the scheduler, it fails in some applications. > > The error points to gluon/rewrite.py: > > File "applications/pescaregional/modules/virtual_methods.py", line 248, in > contenido_url return URL(c='default', f=f, args=[contenido.id, contenido. > slug], extension='', scheme=True,host=current.CONFIG.dominio) if f else > None > File "/var/www/medios/gluon/html.py", line 391, in URL args, other, scheme > , host, port, language=language) > File "/var/www/medios/gluon/rewrite.py", line 197, in url_out function, > args, other, scheme, host, port, language) > File "/var/www/medios/gluon/rewrite.py", line 1366, in map_url_out return > map.acf() > File "/var/www/medios/gluon/rewrite.py", line 1292, in acf self.omit_acf() # > try to omit a/c/f > File "/var/www/medios/gluon/rewrite.py", line 1241, in omit_acf if self. > args[0] in self.functions or self.args[0] in self.controllers or self.args > [0] in applications: TypeError: 'in ' requires stringas left operand, not > long > > > I'm a bit lost. > Where else should I look? > > > El lunes, 3 de septiembre de 2018, 1:45:49 (UTC-3), Lisandro escribió: >> >> Thanks for that fast response. >> If the cause of the problem is passing "contenido.id" as int, then the >> error is even more weird, because my app uses URL like that in several >> situations, for example: >> >> URL('contenido', 'editar', args=contenido.id) >> URL('categoria', 'editar', args=categoria.id) >> URL('default', 'index', args=[categoria.id, page_number]) >> >> >> Now that I think it, the error that I reported happens within the >> scheduler environment. >> Could that difference be the reason? Well, even in that case, it wouldn't >> explain why it works ok in other apps. >> >> >> >> >> El lunes, 3 de septiembre de 2018, 1:25:19 (UTC-3), fiubarc escribió: >>> >>> Hello, >>> >>> I think it's more a matter of python language, contenido.id is long type >>> then self.args[0] in 'any string' raise an exception because, as the >>> message says : >>> >>> 'in ' requires string as left operand, not long >>> >>> You can do args=['%s' % contenido.id, or args=[str(contenido.id), >>> >>> >>> Dont know why in others installed apps works, is really weird >>> >>> >>> >>> El lunes, 3 de septiembre de 2018, 0:54:32 (UTC-3), Lisandro escribió: I have the same app installed several times within a web2py instance (running version 2.16.1-stable+timestamp.2017.11.14.05.54.25). In some of them, this sentence: URL(c='default', f=f, args=[contenido.id, contenido.slug], extension='' , scheme=True, host=current.CONFIG.dominio) ... throws this traceback error: Traceback (most recent call last): File "/var/www/medios/gluon/scheduler.py", line 501, in executor result = dumps(_function(*args, **vars)) File "applications/pescaregional/compiled/models.db.py", line 519, in newsletter File "applications/pescaregional/modules/globales.py", line 938, in enviar_newsletter 'url_noticia': noticia.url() + utm_vars, File "/var/www/medios/gluon/packages/dal/pydal/objects.py", line 2407, in __call__ return self.method(self.row, *args, **kwargs) File "applications/pescaregional/compiled/models.db.py", line 295, in File "applications/pescaregional/modules/virtual_methods.py", line 248, in contenido_url return URL(c='default', f=f, args=[contenido.id, contenido.slug], extension='', scheme=True, host=current.CONFIG.dominio ) if f else None File "/var/www/medios/gluon/html.py", line 391, in URL args, other, scheme, host, port, language=language) File "/var/www/medios/gluon/rewrite.py", line 197, in url_out function, args, other, scheme, host, port, language) File "/var/www/medios/gluon/rewrite.py", line 1366, in map_url_out return map.acf() File "/var/www/medios/gluon/rewrite.py", line 1292, in acf self. omit_acf() # try to omit a/c/f File "/var/www/medios/gluon/r
[web2py] Re: Can't understand this error in gluon/rewrite.py
This problem is getting weirder. I've found that passing integer numbers as args to URL() helper isn't a problem for web2py. I could successfully run some examples using integer and long integers as URL args, and it always works ok. In fact, as I stated before, my application uses URL in that way since a long time ago, with no errors. Even more: in the apps where the code fails, it only fails when it is run from the scheduler, but it works ok if it is run from the controllers. But, just to remember, it doesn't fail in all the apps, only in some of them. But the apps are all the same, it's the same app installed several times. A quick resume: This sentence: URL('default', f=f, args=[contenido.id, contenido.slug], extension='', scheme=True, host=current.CONFIG.dominio) * from a controller, it always runs ok. * from the scheduler, it fails in some applications. The error points to gluon/rewrite.py: File "applications/pescaregional/modules/virtual_methods.py", line 248, in contenido_url return URL(c='default', f=f, args=[contenido.id, contenido. slug], extension='', scheme=True,host=current.CONFIG.dominio) if f else None File "/var/www/medios/gluon/html.py", line 391, in URL args, other, scheme, host, port, language=language) File "/var/www/medios/gluon/rewrite.py", line 197, in url_out function, args , other, scheme, host, port, language) File "/var/www/medios/gluon/rewrite.py", line 1366, in map_url_out return map.acf() File "/var/www/medios/gluon/rewrite.py", line 1292, in acf self.omit_acf() # try to omit a/c/f File "/var/www/medios/gluon/rewrite.py", line 1241, in omit_acf if self.args [0] in self.functions or self.args[0] in self.controllers or self.args[0] in applications: TypeError: 'in ' requires stringas left operand, not long I'm a bit lost. Where else should I look? El lunes, 3 de septiembre de 2018, 1:45:49 (UTC-3), Lisandro escribió: > > Thanks for that fast response. > If the cause of the problem is passing "contenido.id" as int, then the > error is even more weird, because my app uses URL like that in several > situations, for example: > > URL('contenido', 'editar', args=contenido.id) > URL('categoria', 'editar', args=categoria.id) > URL('default', 'index', args=[categoria.id, page_number]) > > > Now that I think it, the error that I reported happens within the > scheduler environment. > Could that difference be the reason? Well, even in that case, it wouldn't > explain why it works ok in other apps. > > > > > El lunes, 3 de septiembre de 2018, 1:25:19 (UTC-3), fiubarc escribió: >> >> Hello, >> >> I think it's more a matter of python language, contenido.id is long type >> then self.args[0] in 'any string' raise an exception because, as the >> message says : >> >> 'in ' requires string as left operand, not long >> >> You can do args=['%s' % contenido.id, or args=[str(contenido.id), >> >> >> Dont know why in others installed apps works, is really weird >> >> >> >> El lunes, 3 de septiembre de 2018, 0:54:32 (UTC-3), Lisandro escribió: >>> >>> I have the same app installed several times within a web2py instance >>> (running version 2.16.1-stable+timestamp.2017.11.14.05.54.25). >>> >>> In some of them, this sentence: >>> >>> URL(c='default', f=f, args=[contenido.id, contenido.slug], extension='', >>> scheme=True, host=current.CONFIG.dominio) >>> >>> ... throws this traceback error: >>> >>> Traceback (most recent call last): >>> File "/var/www/medios/gluon/scheduler.py", line 501, in executor result >>> = dumps(_function(*args, **vars)) >>> File "applications/pescaregional/compiled/models.db.py", line 519, in >>> newsletter >>> File "applications/pescaregional/modules/globales.py", line 938, in >>> enviar_newsletter 'url_noticia': noticia.url() + utm_vars, >>> File "/var/www/medios/gluon/packages/dal/pydal/objects.py", line 2407, >>> in __call__ return self.method(self.row, *args, **kwargs) >>> File "applications/pescaregional/compiled/models.db.py", line 295, in >>> File "applications/pescaregional/modules/virtual_methods.py", line 248, >>> in contenido_url return URL(c='default', f=f, args=[contenido.id, >>> contenido.slug], extension='', scheme=True, host=current.CONFIG.dominio) >>> if f else None >>> File "/var/www/medios/gluon/html.py", line 391, in URL args, other, >>> scheme, host, port, language=language) >>> File "/var/www/medios/gluon/rewrite.py", line 197, in url_out function, >>> args, other, scheme, host, port, language) >>> File "/var/www/medios/gluon/rewrite.py", line 1366, in map_url_out >>> return map.acf() >>> File "/var/www/medios/gluon/rewrite.py", line 1292, in acf self.omit_acf >>> () # try to omit a/c/f >>> File "/var/www/medios/gluon/rewrite.py", line 1241, in omit_acf if self. >>> args[0] in self.functions or self.args[0] in self.controllers or self. >>> args[0] in applications: TypeError: 'in ' requires string as left >>> operand, not long >>> >>> >>> >>> The problem is solved changing the sentence
[web2py] Re: Smartgrid links with many-to-many join tables
Hi, thanks for taking the time to answer. I quickly tested this and it's effectively the solution I referred to as circumventing the problem. I could define controller functions (response mappings) manually and then lambdaing the links to them, but it'd require a lot of code and I'd lose the really helpful hierarchy tree present in the smartgrid. In my project I've certain root objects that are referred to from multiple other objects (both directly and via join tables) and for as long as the relations are direct (ie. without join table but direct reference) the smartgrid works flawlessly and allows the user to navigate the tree, easily viewing what kind of elements are linked to the current object and adding new ones at arbitrary levels of hierarchy without any extra code. I was really impressed with this feature when I first tried it. I just wonder why the M-to-M breaks, as it does render otherwise perfectly but for that missing link to joined (by join table) entity. Since this probably isn't simple error from my part but more like an uncommon need (doubt join tables are really managed explicitly in many cases), the smartgrid does not support it out of the box. I'll try to fiddle with the source code and see if I could make it work. -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Can we commit the codes from web2py to Git
like pointed by tom's posted web2py repo is on https://github.com/web2py you can clone it and put it on your repo if you want (in previous posted *web2py itself not web2pyp app*) useful when you fix some bug in web2py core or add some feature to web2py core web2py app mean is whatever application you create by using web2py framework, e.g. welcome app, financial app, etc for testing after developer modified the file you can use selenium or web2py functional test or whatever tools you want. to integrate with jenkins, perhaps their forum or website can give more detail how to do it. best regards, stifan -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Error connecting to "Azure database for MySQL"
Did you find a solution ? *here is my connection string:* db = DAL('mysql://user%40w-mysql-001-se:water123...@w-mysql-1254-se.mysql.database.azure.com/dbname', decode_credentials=True) Now it is showing InternalError: (1043, u'Bad handshake') On Friday, December 1, 2017 at 6:40:29 AM UTC+6, Daniel Luna wrote: > > I Strill trying to connect, idk if my uri string is wrong, or if i did a > mistake. Anyway, my string is like this-> > mysql://user@db:password@server:3306/db > > And my DAL is like this -> DAL(myconf.get('db.uri'), > pool_size=myconf.get('db.pool_size'), > migrate_enabled=myconf.get('db.migrate'), > check_reserved=['all'], decode_credentials=True) > > Em domingo, 11 de junho de 2017 04:38:40 UTC-3, Massimo Di Pierro escreveu: >> >> I was having the same problem. >> >> DAL(..., decode_credentials=True) >> >> this will allow you to have urlencoded (@ -> %40) username and password. >> >> Massimo >> >> >> >> On Thursday, 8 June 2017 16:06:32 UTC-5, Raul Romay Barrero wrote: >>> >>> Hi all, >>> >>> Azure has just launched "Azure database for MySQL" a managed Mysql >>> service. It's in PREVIEW state and I was giving it a try with our web2py >>> based application. >>> >>> Any user name you configure to connect to the database instance gets >>> appended an "@database_name", so in our case it's something like >>> 'user@mnp-db'. This is creating a problem when connecting to database: >>> >>> 2017-06-08 13:49:45,437 - cmp - 114405 - models.db.py - 44 - - >>> ERROR - Exception generating DAL. Failure to connect, tried 5 times: >>> Traceback (most recent call last): >>> File "/home/www-data/web2py/gluon/dal.py", line 7563, in __init__ >>> self._adapter = ADAPTERS[self._dbname](**kwargs) >>> File "/home/www-data/web2py/gluon/dal.py", line 2573, in __init__ >>> if do_connect: self.reconnect() >>> File "/home/www-data/web2py/gluon/dal.py", line 606, in reconnect >>> self.connection = f() >>> File "/home/www-data/web2py/gluon/dal.py", line 2571, in connector >>> return self.driver.connect(**driver_args) >>> File "/home/www-data/web2py/gluon/contrib/pymysql/__init__.py", line >>> 93, in Connect >>> return Connection(*args, **kwargs) >>> File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", >>> line 575, in __init__ >>> self._connect() >>> File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", >>> line 741, in _connect >>> self._request_authentication() >>> File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", >>> line 796, in _request_authentication >>> self._send_authentication() >>> File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", >>> line 845, in _send_authentication >>> auth_packet.check_error() >>> File "/home/www-data/web2py/gluon/contrib/pymysql/connections.py", >>> line 341, in check_error >>> raise_mysql_exception(self.__data) >>> File "/home/www-data/web2py/gluon/contrib/pymysql/err.py", line 142, >>> in raise_mysql_exception >>> _check_mysql_exception(errinfo) >>> File "/home/www-data/web2py/gluon/contrib/pymysql/err.py", line 138, >>> in _check_mysql_exception >>> raise InternalError, (errno, errorvalue) >>> InternalError: (2001, u'The server name you tried cannot be found. >>> Please use the correct name and retry. Please check your server name >>> mnp.\x00') >>> >>> The error is missleading as it's not related to the server name but to >>> the fact the user name includes an "@". Encoding it as %40 in the URI is >>> not solving the issue. >>> >>> I was debugging inside pymysql when I relized I could change to >>> MySQL-python. It worked fine. >>> >>> So hopefully this will save some of you some time. >>> >>> Another thing to consider is that this service is in PREVIEW state but >>> from my point of view is more an ALPHA state: connections from virtual >>> machines in same resource group that the database instance are reaching the >>> database through the public IP address, via internet. It's not only a >>> latency issue, nor a bandwith concern, also a privacy issue... >>> >>> Best regards, >>> Raúl. >>> >> -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Can we commit the codes from web2py to Git
Hello expert, Little confused here. ”just a suggestion better to maintain your web2py app in your repo, not the web2py itself, except you want fix some bug or add some feature in web2py, but again better to separate it" So you are suggesting to put each the web2py application in my svn repo? So what will be the advantage? And if a developer is modifying the .py file how again he can test it using web2ph. Please correct me if I am wrong here. On Mon, Sep 3, 2018, 6:48 PM 黄祥 wrote: > think you can do whatever you like with your own repo, but the question is > ambigitous. > web2py in terms of web2py root folder that contain > -rw-rw-r-- 1 tetsu staff 66446 Aug 6 08:02 CHANGELOG > -rw-rw-r-- 1 tetsu staff5727 Aug 6 08:02 LICENSE > -rw-rw-r-- 1 tetsu staff 24 Aug 6 08:02 MANIFEST.in > -rw-rw-r-- 1 tetsu staff3896 Aug 6 08:02 README.markdown > -rw-rw-r-- 1 tetsu staff 52 Aug 6 08:02 VERSION > -rw-rw-r-- 1 tetsu staff 12960 Aug 6 08:02 anyserver.py > drwxr-xr-x 8 tetsu staff 272 Aug 7 11:30 applications > drwxr-xr-x 2 tetsu staff 68 Aug 7 11:30 deposit > drwxr-xr-x 11 tetsu staff 374 Aug 6 09:39 examples > drwxr-xr-x 4 tetsu staff 136 Aug 6 09:38 extras > -rw-rw-r-- 1 tetsu staff6091 Aug 6 08:02 fabfile.py > drwxr-xr-x 88 tetsu staff2992 Sep 3 09:27 gluon > drwxr-xr-x 11 tetsu staff 374 Aug 6 09:39 handlers > drwxr-xr-x 2 tetsu staff 68 Aug 7 11:30 logs > drwxr-xr-x 46 tetsu staff1564 Aug 6 09:39 scripts > drwxr-xr-x 3 tetsu staff 102 Aug 6 09:39 site-packages > -rwxrwxr-x 1 tetsu staff 900 Aug 6 08:02 web2py.py > -rw-r--r-- 1 tetsu staff 419727 Aug 7 11:30 welcome.w2p > > or web2py app e.g. welcome > -rw-rw-r-- 1 tetsu staff55 Aug 6 08:02 ABOUT > -rw-rw-r-- 1 tetsu staff 208 Aug 6 08:02 LICENSE > -rw-rw-r-- 1 tetsu staff 1 Aug 6 08:02 __init__.py > drwxrwxr-x 4 tetsu staff 136 Aug 6 08:02 controllers > drwxrwxr-x 4 tetsu staff 136 Aug 6 08:02 cron > drwxr-xr-x 10 tetsu staff 340 Aug 7 11:44 databases > drwxr-xr-x 2 tetsu staff68 Aug 7 11:44 errors > drwxrwxr-x 33 tetsu staff 1122 Aug 6 08:02 languages > drwxrwxr-x 4 tetsu staff 136 Aug 6 08:02 models > drwxrwxr-x 4 tetsu staff 136 Aug 7 21:32 modules > drwxrwxr-x 3 tetsu staff 102 Aug 6 08:02 private > -rw-rw-r-- 1 tetsu staff 2354 Aug 6 08:02 routes.example.py > drwxr-xr-x 2 tetsu staff68 Aug 7 11:44 sessions > drwxrwxr-x 9 tetsu staff 306 Aug 6 08:02 static > drwxr-xr-x 2 tetsu staff68 Aug 7 11:44 uploads > drwxrwxr-x 16 tetsu staff 544 Aug 6 08:02 views > > just a suggestion better to maintain your web2py app in your repo, not the > web2py itself, except you want fix some bug or add some feature in web2py, > but again better to separate it. > for integrate with jenkins after you commit it (svn or git) and trigger to > update the web2py app, think you can achieve it, but pls look in jenkins > website or ask in their forum about how to do it. > > best regards, > stifan > > -- > 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 > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Can we commit the codes from web2py to Git
think you can do whatever you like with your own repo, but the question is ambigitous. web2py in terms of web2py root folder that contain -rw-rw-r-- 1 tetsu staff 66446 Aug 6 08:02 CHANGELOG -rw-rw-r-- 1 tetsu staff5727 Aug 6 08:02 LICENSE -rw-rw-r-- 1 tetsu staff 24 Aug 6 08:02 MANIFEST.in -rw-rw-r-- 1 tetsu staff3896 Aug 6 08:02 README.markdown -rw-rw-r-- 1 tetsu staff 52 Aug 6 08:02 VERSION -rw-rw-r-- 1 tetsu staff 12960 Aug 6 08:02 anyserver.py drwxr-xr-x 8 tetsu staff 272 Aug 7 11:30 applications drwxr-xr-x 2 tetsu staff 68 Aug 7 11:30 deposit drwxr-xr-x 11 tetsu staff 374 Aug 6 09:39 examples drwxr-xr-x 4 tetsu staff 136 Aug 6 09:38 extras -rw-rw-r-- 1 tetsu staff6091 Aug 6 08:02 fabfile.py drwxr-xr-x 88 tetsu staff2992 Sep 3 09:27 gluon drwxr-xr-x 11 tetsu staff 374 Aug 6 09:39 handlers drwxr-xr-x 2 tetsu staff 68 Aug 7 11:30 logs drwxr-xr-x 46 tetsu staff1564 Aug 6 09:39 scripts drwxr-xr-x 3 tetsu staff 102 Aug 6 09:39 site-packages -rwxrwxr-x 1 tetsu staff 900 Aug 6 08:02 web2py.py -rw-r--r-- 1 tetsu staff 419727 Aug 7 11:30 welcome.w2p or web2py app e.g. welcome -rw-rw-r-- 1 tetsu staff55 Aug 6 08:02 ABOUT -rw-rw-r-- 1 tetsu staff 208 Aug 6 08:02 LICENSE -rw-rw-r-- 1 tetsu staff 1 Aug 6 08:02 __init__.py drwxrwxr-x 4 tetsu staff 136 Aug 6 08:02 controllers drwxrwxr-x 4 tetsu staff 136 Aug 6 08:02 cron drwxr-xr-x 10 tetsu staff 340 Aug 7 11:44 databases drwxr-xr-x 2 tetsu staff68 Aug 7 11:44 errors drwxrwxr-x 33 tetsu staff 1122 Aug 6 08:02 languages drwxrwxr-x 4 tetsu staff 136 Aug 6 08:02 models drwxrwxr-x 4 tetsu staff 136 Aug 7 21:32 modules drwxrwxr-x 3 tetsu staff 102 Aug 6 08:02 private -rw-rw-r-- 1 tetsu staff 2354 Aug 6 08:02 routes.example.py drwxr-xr-x 2 tetsu staff68 Aug 7 11:44 sessions drwxrwxr-x 9 tetsu staff 306 Aug 6 08:02 static drwxr-xr-x 2 tetsu staff68 Aug 7 11:44 uploads drwxrwxr-x 16 tetsu staff 544 Aug 6 08:02 views just a suggestion better to maintain your web2py app in your repo, not the web2py itself, except you want fix some bug or add some feature in web2py, but again better to separate it. for integrate with jenkins after you commit it (svn or git) and trigger to update the web2py app, think you can achieve it, but pls look in jenkins website or ask in their forum about how to do it. best regards, stifan -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] Can we commit the codes from web2py to Git
Hello expert, As we already have svn, can we commit the code that we changed from web2py framework to svn repo from there I can initiate a Jenkins job trigger to deploy the change to web2py server under that application path On Mon, Sep 3, 2018, 4:46 PM Tom Campbell wrote: > Yes it works fine with Git. In fact... https://github.com/web2py > > -- > 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 > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Can we commit the codes from web2py to Git
Yes it works fine with Git. In fact... https://github.com/web2py -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] database field is added and deleted immediately afterwards
Hello When I add a field to my db.py I get an error saying field does not exist. If I check the sql log file there is timestamp: 2018-09-03T12:08:38.256000 ALTER TABLE counters ADD c_total_difference INTEGER; success! timestamp: 2018-09-03T12:08:38.381000 ALTER TABLE counters DROP COLUMN c_total_difference; success! Why is the field deleted?? My settings are migrate = True, fake_migrate = False Thank you -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] AttributeError: 'DAL' object has no attribute 'definitions'
Thanks for the response. Great! On Mon, 3 Sep 2018, 10:24 Lovedie JC wrote: > Had to clean up cache, restart web2py. It's OK now. > > On Sun, 2 Sep 2018, 20:16 Maurice Waka wrote: > >> rows = db(db.definitions.definitions).select() >> File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 669, in >> __getattr__ >> return BasicStorage.__getattribute__(self, key) >> AttributeError: 'DAL' object has no attribute 'definitions' >> >> I am getting the above error with my code. >> >> I am using a function in the models that imports several functions like this >> below: >> >> def definitions(): db = current.db rows = >> db(db.definitions.definitions).select() for row in rows: return >> row.definitions >> >> The model code is this: >> >> db = DAL('sqlite://storage.sqlite', pool_size=100, folder=None, >> db_codec='UTF-8', check_reserved=None, migrate=False, fake_migrate=False >> ,)) >> db.define_table('definitions', Field('definitions', 'text', length= >> 100, default="", notnull=True)) >> >> >> >> >> What could be wrong with my code? and how do I correct it. >> >> Regards >> >> -- >> 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 >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/fVTULlaSNzQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] IS_IN_SET handle dictionary
Hello Is it possible to use validator IS_IN_SET to handle dictionary. I want to send a list of dicts for user to select [{"id": 1, "m:code": C-111}, {"id": 2, "m:code": BC-222},.], so when I use on_validate I can handle with id. Thank you -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Can we commit the codes from web2py to Git
I am planning to introduce Continuous Integration for our python web development activities. So as a first phase, we are planning to get a version control system GIT. So can i commit the code changes from Web2py to Git repo and from there I can trigger a job through Jenkins to modify the web page . -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: port 800 busy
just revised my previous post for checked another process using that port (8000) you can use either netstat -ltnp | grep -w ':8000' lsof -i :8000 fuser 8000/tcp ps use just to find the process name by process id : ps -p pid -o comm= best regards, stifan -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [web2py] AttributeError: 'DAL' object has no attribute 'definitions'
Had to clean up cache, restart web2py. It's OK now. On Sun, 2 Sep 2018, 20:16 Maurice Waka wrote: > rows = db(db.definitions.definitions).select() > File "/usr/local/lib/python2.7/dist-packages/pydal/base.py", line 669, in > __getattr__ > return BasicStorage.__getattribute__(self, key) > AttributeError: 'DAL' object has no attribute 'definitions' > > I am getting the above error with my code. > > I am using a function in the models that imports several functions like this > below: > > def definitions(): db = current.db rows = > db(db.definitions.definitions).select() for row in rows: return > row.definitions > > The model code is this: > > db = DAL('sqlite://storage.sqlite', pool_size=100, folder=None, > db_codec='UTF-8', check_reserved=None, migrate=False, fake_migrate=False > ,)) > db.define_table('definitions', Field('definitions', 'text', length= > 100, default="", notnull=True)) > > > > > What could be wrong with my code? and how do I correct it. > > Regards > > -- > 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 > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- 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 "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.