Re: [web2py] Re: Do we have Plugin solid form upgraded code for python 3 ?
Hey All, This is *finally fixed.* I spent some time debugging on it today. The fix was actually very simple, all I had to do was to convert some values to integer. Here is the final fixed version on *plugin_solidform.py. *For all the folks who want to use this awesome plugin with python 3.x.x can give it a try. [image: working.png] *Thanks snide.. and all* Regards, *Rahul* On Sunday, April 3, 2022 at 11:07:05 PM UTC+5:30 snide...@gmail.com wrote: > On Friday, March 25, 2022 at 11:14:07 PM UTC-7 Rahul wrote: > >> yes I used some things like *trunc *or *ceil *to fix it however the >> error persists on the same line. Pretty weird. Also used what was suggested >> like // >> but did not work for me. I want to get this fixed soon. However, >> If its not possible to fix it "quickly" perhaps someone can suggest me >> some plugin to manage fields in the layout for proper UI orientation. >> >> All suggestions are welcome >> >> Regards, >> *Rahul* >> >> > > Have you examined the type of structured_fields and it's components at > the time of the exception? I would add some debug prints just before the > for statement. > > /dps > > On Thursday, March 24, 2022 at 4:51:46 PM UTC+5:30 snide...@gmail.com >> wrote: >> >>> On Thursday, March 24, 2022 at 3:21:01 AM UTC-7 Massimiliano wrote: >>> >>>> This could be one problem: >>>> >>>> for i in range((max_row_lines - extra_colspan) / colspan): >>>> >>>> there are many of this. >>>> >>>> *range* take an integer, but a division in python3 return a float... >>>> >>>> >>> Interesting, but why doesn't the exception occur in the quoted line with >>> the range statement? >>> >>> The stack trace suggests it occurs after the for loop completes. >>> >>> (I' also dizzy from the number of places where self.structured fields >>> get redone by enumerating itself) >>> >>> /dps >>> >>> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/22201292-5249-4f25-a15d-84cdfef0840an%40googlegroups.com. # -*- coding: utf-8 -*- # This plugins is licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # Authors: Kenji Hosoda from gluon import * import copy class SOLIDFORM(SQLFORM): def __init__(self, *args, **kwds): self.structured_fields = kwds.get('fields') self.showid = kwds.get('showid', True) table = args and args[0] or kwds['table'] if not self.structured_fields: self.structured_fields = [f.name for f in table if self._is_show(f)] else: self.structured_fields = copy.copy(self.structured_fields) _precedent_row_len = 1 include_id = False flat_fields = [] max_row_lines = 1 for i, inner in enumerate(self.structured_fields): if type(inner) in (list, tuple): _inner = [] for field in inner: if field == 'id': include_id = True self.showid = True if field and self._is_show(table[field]): flat_fields.append(field) _inner.append(field) self.structured_fields[i] = _inner max_row_lines = max(len(_inner), max_row_lines) _precedent_row_len = len(_inner) elif inner: if inner == 'id': include_id = True self.showid = True if self._is_show(table[inner]): flat_fields.append(inner) else: self.structured_fields[i] = None else: self.structured_fields[i] = [inner for i in range(_precedent_row_len)] self.structured_fields = [e for e in self.structured_fields if e or e is None] row_spans = dict((e, 1) for e in flat_fields) col_spans = dict((e, 1) for e in flat_fields) row_lines = [[] for i in range(max_row_lines)] for row_no, inner in enumerate(self.structured_fields): if type(inn
Re: [web2py] Re: Do we have Plugin solid form upgraded code for python 3 ?
Do we have alternatives to this feature ? Rahul On Saturday, March 26, 2022 at 11:44:07 AM UTC+5:30 Rahul wrote: > yes I used some things like *trunc *or *ceil *to fix it however the error > persists on the same line. Pretty weird. Also used what was suggested like > // > but did not work for me. I want to get this fixed soon. However, > If its not possible to fix it "quickly" perhaps someone can suggest me > some plugin to manage fields in the layout for proper UI orientation. > > All suggestions are welcome > > Regards, > *Rahul* > > On Thursday, March 24, 2022 at 4:51:46 PM UTC+5:30 snide...@gmail.com > wrote: > >> On Thursday, March 24, 2022 at 3:21:01 AM UTC-7 Massimiliano wrote: >> >>> This could be one problem: >>> >>> for i in range((max_row_lines - extra_colspan) / colspan): >>> >>> there are many of this. >>> >>> *range* take an integer, but a division in python3 return a float... >>> >>> >> Interesting, but why doesn't the exception occur in the quoted line with >> the range statement? >> >> The stack trace suggests it occurs after the for loop completes. >> >> (I' also dizzy from the number of places where self.structured fields get >> redone by enumerating itself) >> >> /dps >> >> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/675bd526-d362-447d-80d7-df5657983ba1n%40googlegroups.com.
Re: [web2py] Re: Do we have Plugin solid form upgraded code for python 3 ?
yes I used some things like *trunc *or *ceil *to fix it however the error persists on the same line. Pretty weird. Also used what was suggested like // but did not work for me. I want to get this fixed soon. However, If its not possible to fix it "quickly" perhaps someone can suggest me some plugin to manage fields in the layout for proper UI orientation. All suggestions are welcome Regards, *Rahul* On Thursday, March 24, 2022 at 4:51:46 PM UTC+5:30 snide...@gmail.com wrote: > On Thursday, March 24, 2022 at 3:21:01 AM UTC-7 Massimiliano wrote: > >> This could be one problem: >> >> for i in range((max_row_lines - extra_colspan) / colspan): >> >> there are many of this. >> >> *range* take an integer, but a division in python3 return a float... >> >> > Interesting, but why doesn't the exception occur in the quoted line with > the range statement? > > The stack trace suggests it occurs after the for loop completes. > > (I' also dizzy from the number of places where self.structured fields get > redone by enumerating itself) > > /dps > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/2e802ab4-233d-45e9-ad27-fdc1bc46157cn%40googlegroups.com.
[web2py] Re: Do we have Plugin solid form upgraded code for python 3 ?
anyone has any ideas ? On Wednesday, March 23, 2022 at 5:13:15 PM UTC+5:30 Rahul wrote: > Hi All, > I am migrating my python 2.7 project to py 3.7 - I am facing > issues with plugin solid form conversion to py3 code. My code uses this > plugin a lot. Rest all code works fine except the plugin part - While using > it I am getting the error - I tried web recommendations but to no avail - > Please suggest ! > > 'float' object cannot be interpreted as an integer > Version > web2py™ > Version 2.22.3-stable+timestamp.2022.02.15.15.14.38 > Python > Python 3.7.5: C:\Python37\python.exe (prefix: C:\Python37)Traceback > > 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8. > 9. > 10. > 11. > 12. > Traceback (most recent call last): > File "E:\web2py_src\web2py\gluon\restricted.py", line 219, in restricted > exec(ccode, environment) > File "E:/web2py_src/web2py/applications/artpic/controllers/default.py" > <http://127.0.0.1:8000/admin/default/edit/artpic/controllers/default.py>, > line > 9599, in > File "E:\web2py_src\web2py\gluon\globals.py", line 430, in > self._caller = lambda f: f() > File "E:/web2py_src/web2py/applications/artpic/controllers/default.py" > <http://127.0.0.1:8000/admin/default/edit/artpic/controllers/default.py>, > line > 6200, in contact > form = SOLIDFORM(db.contactus, fields=fields, submit_button='Submit') > File "E:\web2py_src\web2py\applications\artpic\modules\plugin_solidform.py", > line 59, in __init__ > for row_no, inner in enumerate(self.structured_fields): > TypeError: 'float' object cannot be interpreted as an integer > > > Attached is the file > > also here is the code - > > > # -*- coding: utf-8 -*- > # This plugins is licensed under the MIT license: > http://www.opensource.org/licenses/mit-license.php# > #Authors: Kenji Hosoda > from gluon import * > import copy > from math import trunc, ceil > > class SOLIDFORM(SQLFORM): > def __init__(self, *args, **kwds): > self.structured_fields = kwds.get('fields') > self.showid = kwds.get('showid', True) > table = args and args[0] or kwds['table'] > if not self.structured_fields: > self.structured_fields = [f.name for f in table if > self._is_show(f)] > else: > self.structured_fields = copy.copy(self.structured_fields) > _precedent_row_len = 1 > > include_id = False > flat_fields = [] > max_row_lines = 1 > for i, inner in enumerate(self.structured_fields): > if type(inner) in (list, tuple): > _inner = [] > for field in inner: > if field == 'id': > include_id = True > self.showid = True > if field and self._is_show(table[field]): > flat_fields.append(field) > _inner.append(field) > self.structured_fields[i] = _inner > max_row_lines = max(len(_inner), max_row_lines) > _precedent_row_len = len(_inner) > elif inner: > if inner == 'id': > include_id = True > self.showid = True > if self._is_show(table[inner]): > flat_fields.append(inner) > else: > self.structured_fields[i] = None > else: > self.structured_fields[i] = [inner for i in > range(_precedent_row_len)] > self.structured_fields = [e for e in self.structured_fields if e > or e is None] > row_spans = dict((e, 1) for e in flat_fields) > col_spans = dict((e, 1) for e in flat_fields) > row_lines = [[] for i in range(max_row_lines)] > for row_no, inner in enumerate(self.structured_fields): > if type(inner) in (list, tuple): > num_lines = trunc (len(inner)) > colspan = max_row_lines / num_lines > extra_colspan = max_row_lines % num_lines > for i in range((max_row_lines - extra_colspan) / colspan): > field = inner[i] > if field: > col_spans[field] = colspan > row_lines[i * colspan].append(field) > else: > for _row_no in reversed(list(range(row_no))): > try: > > row_spans[self.structured_fields[_row_no][i]] += 1 > break
[web2py] Do we have Plugin solid form upgraded code for python 3 ?
0] == 'id': self.ignore_first = False else: self.ignore_first = include_id self.readonly = kwds.get('readonly', False) kwds['showid'] = self.showid SQLFORM.__init__(self, *args, **kwds) def _is_show(self, fieldobj): return (fieldobj.writable or fieldobj.readable) and (fieldobj.type != 'id' or (self.showid and fieldobj.readable)) def createform(self, xfields): table_inner = [] if self.showid and self.record and (not self.readonly or self.ignore_first): if not self.ignore_first: id, a, b, c = xfields[0] tr_inner = [] tr_inner.append(TD(a, _class='w2p_fl')) tr_inner.append(TD(b, _class='w2p_fw', _colspan=(2 * self.max_row_lines) - 1)) table_inner.append(TR(*tr_inner)) xfields = xfields[1:] n = len(self.flat_fields) xfield_dict = dict([(x, y) for x, y in zip(self.flat_fields, xfields[:n])]) row_lines = copy.copy(self.row_lines) for i in range(max(len(line) for line in row_lines) * self.max_row_lines): if i >= len(row_lines[0]): break tr_inner = [] for j, row_line in enumerate(row_lines): if i < len(row_line): field = row_line[i] if field is None: tr_inner.append(TD()) elif field is False: pass else: row_span = self.row_spans[field] if row_span > 1: for k in range(1, row_span): row_lines[j].insert(i + k, False) col_span = self.col_spans[field] if col_span > 1: for k in range(1, col_span): row_lines[j + k].insert(i, False) tr_inner += self.create_td(xfield_dict[field], row_span, col_span) table_inner.append(TR(*tr_inner)) for id, a, b, c in xfields[n:]: td_b = self.field_parent[id] = TD(b, _class='w2p_fw', _colspan=(2 * self.max_row_lines) - 1) tr_inner = [] tr_inner.append(TD(a, _class='w2p_fl')) tr_inner.append(td_b) table_inner.append(TR(*tr_inner)) return TABLE(*table_inner) def create_td(self, xfield, row_span, col_span): id, a, b, c = xfield if self.formstyle == 'table3cols': td_b = self.field_parent[id] = TD( b, c and not self.readonly and DIV(c, _class='notation') or '', # do not show when readonly _class='w2p_fw', _rowspan=row_span, _colspan=2 * col_span - 1) return (TD(a, _class='w2p_fl', _rowspan=row_span, _colspan=1), td_b) else: raise RuntimeError('formstyle not supported') @staticmethod def factory(*fields, **attributes): table_name = attributes.get('table_name', 'no_table') if 'table_name' in attributes: del attributes['table_name'] flat_fields = [] structured_fields = [] for inner in fields: if type(inner) in (list, tuple): _inner = [] for field in inner: _inner.append(field.name) if field: flat_fields.append(field) structured_fields.append(_inner) elif inner: flat_fields.append(inner) structured_fields.append(inner.name) return SOLIDFORM(DAL(None).define_table(table_name, *flat_fields), fields=structured_fields, **attributes) @staticmethod def formstyle(id, a, td_b, c): if c: td_b.components = td_b.components + [DIV(c, _class='notation')] return TR(TD(a, _class='w2p_fl'), td_b, _id=id) Any help or pointers would be greatly appreciated. Do we have upgraded version of plugin solid form ? Regards, 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/3d61814f-57c7-4eb7-9ad0-52bc40101101n%40googlegroups.com. # -*- coding: utf-8 -*- # This plugins is licensed under the MIT license: ht
[web2py] Re: How to add multiple onvalidation
Nevermind, I was able to achieve that using nested functions. Thanks! Rahul On Wednesday, June 2, 2021 at 3:05:32 PM UTC+5:30 Rahul wrote: > Hi All, > It may be simple one but I want to know how to *add multiple > onvalidation functions/methods* in my code. For example If I want to > check for userlimit reached for users before adding one as well as want to > check for duplicate users for the same form which exists in other function. > > form = SQLFORM(db.numbers) > if form.process(*onvalidation*=*my_form_processing*).accepted: > do something > > def my_form_processing(form): > do something ... > > Regards, > > 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/573b1857-388b-4460-aa44-1d4850867816n%40googlegroups.com.
[web2py] How to add multiple onvalidation
Hi All, It may be simple one but I want to know how to *add multiple onvalidation functions/methods* in my code. For example If I want to check for userlimit reached for users before adding one as well as want to check for duplicate users for the same form which exists in other function. form = SQLFORM(db.numbers) if form.process(*onvalidation*=*my_form_processing*).accepted: do something def my_form_processing(form): do something ... Regards, 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/3d4fcb20-8e3b-483e-afe9-dbf40739df60n%40googlegroups.com.
[web2py] Re: Auto-generate PUT and DELETE methods
Hi All, Not sure if this is the right thread to put this up -- I was trying to use this code for rest/json -- however -- with slight changes and wrong parameters in the URL my entire table got exposed -- Here is the code -- *CONTROLLER : DEFAULT.PY CODE* ## API --- @request.restful() def api(): response.view = 'generic.'+request.extension def GET(*args,**vars): patterns = 'auto' parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): return db[table_name].validate_and_insert(**vars) def PUT(table_name,record_id,**vars): return db(db[table_name]._id==record_id).update(**vars) def DELETE(table_name,record_id): return db(db[table_name]._id==record_id).delete() return dict(GET=GET, POST=POST, PUT=PUT, DELETE=DELETE) When some adds the url like this in the browser -- http://127.0.0.1:8000/artpic/default/api/mblog?id=%221%22=%222%22 ( http://127.0.0.1:8000/artpic/default/api/mblog?id="1"="2; ) it poses a huge risk as all the data in the table is exposed. All tables are exposed and even username and password from my tables get exposed and easily accessible This works properly -- but above url exposes a huge security risk -- http://127.0.0.1:8000/artpic/default/api/mblog/id/37.json Am I doing this properly ?? Is there something I am missing -- The above code in controller is the only code I am using -- Please see the image attached -- It looks like a huge security risk. Regards, *Rahul* On Friday, June 22, 2012 at 7:55:19 PM UTC+5:30 Massimo Di Pierro wrote: > wow. done that. > > On Thursday, 21 June 2012 18:04:04 UTC-5, Anthony wrote: >> >> Using my new Google Groups super powers >> <https://groups.google.com/d/msg/web2py/trtS-S-4exs/aTLXn1yESboJ>, I >> have edited your original post, so if you'd like, you can delete this >> correction and we can pretend this never happened. ;-) >> >> Anthony >> >> On Thursday, June 21, 2012 6:40:37 PM UTC-4, Massimo Di Pierro wrote: >>> >>> Silly me. This >>> >>> def PUT(table_name,record_id): >>> >>> return db(db[table_name]._id==record_id).delete() >>> >>> >>> was supposed to be >>> >>> >>> def DELETE(table_name,record_id): >>> >>> return db(db[table_name]._id==record_id).delete() >>> >>> >>> On Thursday, 21 June 2012 13:38:01 UTC-5, Derek wrote: >>>> >>>> Looks like you have Get, Post, and PUT and PUT. Where's Delete? >>>> >>>> On Wednesday, June 20, 2012 4:39:33 PM UTC-7, Massimo Di Pierro wrote: >>>>> >>>>> You can do >>>>> >>>>> @request.restful() >>>>> def api(): >>>>> response.view = 'generic.'+request.extension >>>>> def GET(*args,**vars): >>>>> patterns = 'auto' >>>>> parser = db.parse_as_rest(patterns,args,vars) >>>>> if parser.status == 200: >>>>> return dict(content=parser.response) >>>>> else: >>>>> raise HTTP(parser.status,parser.error) >>>>> def POST(table_name,**vars): >>>>> return db[table_name].validate_and_insert(**vars) >>>>> >>>>> def PUT(table_name,record_id,**vars): >>>>> >>>>> return db(db[table_name]._id==record_id).update(**vars) >>>>> >>>>> def PUT(table_name,record_id): >>>>> >>>>> return db(db[table_name]._id==record_id).delete() >>>>> >>>>> return locals() >>>>> >>>>> >>>>> On Wednesday, 20 June 2012 11:30:26 UTC-5, Osama Hussain wrote: >>>>>> >>>>>> Using the following code web2py generated all possible patterns for >>>>>> all my tables for GET and POST methods: >>>>>> >>>>>> @request.restful() >>>>>> def api(): >>>>>> response.view = 'generic.'+request.extension >>>>>> def GET(*args,**vars): >>>>>> patterns = 'auto' >>>>>> parser = db.parse_as_rest(patterns,args,vars) >>>>>> if parser.status == 200: >>>>>> return dict(content=parser.response) >>>>>> else: >>>>>> raise HTTP(parser.status,parser.error) >>>>>> def POST(table_name,**vars): >>>>>> return db[table_name].validate_and_insert(**vars) >>>>>> return locals() >>>>>> >>>>>> >>>>>> Is it possible to have patterns generated for PUT and DELETE methods? >>>>>> >>>>>> -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/eb1325a1-ee80-4054-a9f4-9a13e4b5ba8bn%40googlegroups.com.
Re: [web2py] Re: How do I prevent going back to previous page after user is logged out?
Another simple way is -- To pop out session variables like in code below for all the login session variables and redirect the user wherer-ever you want them to be. This way since no valid session exists the user would be redirected to page where you intend them to be. def sign_out(): session.pop('user_name', None) redirect(URL(r=request, f='login')) return dict() Regards, Rahul Dhakate On Sunday, August 2, 2020 at 3:29:25 PM UTC+5:30 lbjc...@gmail.com wrote: > Hi > Thanks for this. > I put these functions in the model.py, I hope its correct. > > def __on_login(): > redirect(URL('index')) > return None > > def __on_logout(): > redirect(URL('index')) > return None > > On Fri, 31 Jul 2020 at 11:49, 'Annet' via web2py-users < > web...@googlegroups.com> wrote: > >> What about the following? >> >> auth.settings.login_onaccept = lambda form: __on_login() >> auth.settings.logout_onlogout = lambda user: __on_logout() >> >> >> def __on_login(): >> # whatever you want to do >> return None >> >> >> def __on_logout(): >> # whatever you want to do >> return None >> >> To solve your problem use the request object to redirect >> >> >> HTH, >> >> Annet >> >> -- >> 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+un...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/e80c749a-cc2e-496f-89bd-7de4c0f1ef2fo%40googlegroups.com >> >> <https://groups.google.com/d/msgid/web2py/e80c749a-cc2e-496f-89bd-7de4c0f1ef2fo%40googlegroups.com?utm_medium=email_source=footer> >> . >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/32df90f2-a489-47de-9b5f-b4a7fcacd804n%40googlegroups.com.
Re: [web2py] Re: does having similar controller names or app folder names cause conflict in web2py?
All, I tested this scenario can now confirm that it does not have an impact for the issue I mentioned below. Thank you. Rahul On Sun, 22 Sep 2019 at 3:55 PM, Rahul Dhakate wrote: > Hi Massimo, > I appreciate your reply. I had an application where in I had two > controllers one called as default.py and the other called as > default_0001.py in the same folder. I experienced strange issues which were > fixed in the new default.py but were still there reflecting in the > application. When I remove the back up default_0001.py the issues were > fixed automatically. Due to this I derived that there might be issues with > having the same controller name. Sort of. So now I have deleted the back up > files and it worked fine. > I will still investigate this and get back with my findings. > > > Regards, > > Rahul > > On Sun, 22 Sep 2019 at 12:15 PM, Massimo Di Pierro < > massimo.dipie...@gmail.com> wrote: > >> I do not see any problem with that >> >> On Saturday, 21 September 2019 01:09:36 UTC-7, Rahul wrote: >>> >>> >>> Hello All, >>>Will having a structure like below cause conflicts with web2py >>> controllers or applications ? I've found it does and when removed it >>> removes a few issues automatically. >>> >>> >>> >>> 1] *Controllers *- >>> >>> Example we have default.py in controllers folder along with >>> default_01.py .. default_02.py >>> >>> 2] *Applications *- Multple applications in web2py Applications folder >>> >>> Example app1, app1_001, app1_002 >>> >>> Regards, >>> >>> *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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/web2py/So2bg9Zd9iA/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/8220d18c-d9bf-4b4c-a5ec-9f2238c0161b%40googlegroups.com >> <https://groups.google.com/d/msgid/web2py/8220d18c-d9bf-4b4c-a5ec-9f2238c0161b%40googlegroups.com?utm_medium=email_source=footer> >> . >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjem4epLg4RPaM%2B0XEYo71nkEjLX%2Bg4qsD9kpWx59W2vbw%40mail.gmail.com.
Re: [web2py] Re: does having similar controller names or app folder names cause conflict in web2py?
Hi Massimo, I appreciate your reply. I had an application where in I had two controllers one called as default.py and the other called as default_0001.py in the same folder. I experienced strange issues which were fixed in the new default.py but were still there reflecting in the application. When I remove the back up default_0001.py the issues were fixed automatically. Due to this I derived that there might be issues with having the same controller name. Sort of. So now I have deleted the back up files and it worked fine. I will still investigate this and get back with my findings. Regards, Rahul On Sun, 22 Sep 2019 at 12:15 PM, Massimo Di Pierro < massimo.dipie...@gmail.com> wrote: > I do not see any problem with that > > On Saturday, 21 September 2019 01:09:36 UTC-7, Rahul wrote: >> >> >> Hello All, >>Will having a structure like below cause conflicts with web2py >> controllers or applications ? I've found it does and when removed it >> removes a few issues automatically. >> >> >> >> 1] *Controllers *- >> >> Example we have default.py in controllers folder along with >> default_01.py .. default_02.py >> >> 2] *Applications *- Multple applications in web2py Applications folder >> >> Example app1, app1_001, app1_002 >> >> Regards, >> >> *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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/So2bg9Zd9iA/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/8220d18c-d9bf-4b4c-a5ec-9f2238c0161b%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/8220d18c-d9bf-4b4c-a5ec-9f2238c0161b%40googlegroups.com?utm_medium=email_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjfVoNxafw9n95On2SLE6p7WbT9jpeqmsXNtz50ezBeEEQ%40mail.gmail.com.
[web2py] does having similar controller names or app folder names cause conflict in web2py?
Hello All, Will having a structure like below cause conflicts with web2py controllers or applications ? I've found it does and when removed it removes a few issues automatically. 1] *Controllers *- Example we have default.py in controllers folder along with default_01.py .. default_02.py 2] *Applications *- Multple applications in web2py Applications folder Example app1, app1_001, app1_002 Regards, *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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/23df8ef6-dde5-4026-bf10-2c9624d0429c%40googlegroups.com.
[web2py] Error that I couldnt catch - TypeError: getattr(): attribute name must be string Error
postprocessing : session_client : 109.102.111.32 session_cookie_compression_level : None session_cookie_expires : None session_data_name : session_data_artpic session_file : None session_filename : /home/www-data/web2py/applications/artpic/sessions/109.102.111.32-6e1c8c1d-79c7-41ab-a937-cfd6539e8d87 session_id : 109.102.111.32-6e1c8c1d-79c7-41ab-a937-cfd6539e8d87 session_id_name : session_id_artpic session_masterapp : artpic session_new : True session_storage_type : file status : 200 In file: Framework 1. Regards, 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/7732baa9-9345-4fb0-9867-b6e2e3e96dce%40googlegroups.com.
Re: [web2py] Re: Whats the best way to create an Android or iOS app for web2py project
Hi All, Any clues anyone on the questions asked? Regards, *Rahul* On Fri, 13 Sep 2019 at 12:53 PM, Rahul Dhakate wrote: > Thanks! Dave and Pbop for getting back with the answers. Sorry about > posting less details > > *@dave* - No, I do not intend to run web2py on mobile device. Web2py > would serve my application on the web as it usually does. > > The idea is to write another simple iOS or Android application in some > tool like say what *Pbop* mentioned.( Or Python if we can and if > supported!) > > I want to connect to my web2py web application from the mobile or PDA > app. > So yes - I wanna do the following - > > *Do you want to access a [remote] web2py server from a native app on the > portable device?* > * YES sort of where I will only access postgres database of the > application by passing web2py app. I was researching if python could come > in handy for this..* > > My application already works on mobile device in responsive fashion > however I would want a stripped down version with a few mobile specific > features added for a great user experience. > > *So for —- * > 2) How can we access a postgres database residing on linux server for a > web2py application from such an application? > *To Add *- Here The application and database reside on the same linux box. > > > Let me know on these and a couple questions I posted below. > > > Regards, > > *Rahul* > > On Wed, 11 Sep 2019 at 2:24 PM, Dave S wrote: > >> >> On Friday, September 6, 2019 at 4:28:30 AM UTC-7, Rahul wrote: >>> >>> Hey Everyone, >>> I have some interesting questions (It might have been asked before) >>> I want to know - >>> >>> 1) Whats the best way to create an Android or iOS app for web2py project? >>> >> >> What's the goal? Do you want web2py running as a server on the portable >> device? Do you want to display on the portable device pages served by a >> [remote] webserver? Do you want to access a [remote] web2py server from a >> native app on the portable device? >> >> Note that a remote web2py server using the view tools that come with it >> produces pages that are mobile-friendly (er, "responsive") in the sense of >> adapting to the screen size in various ways. >> >> >>> 2) How can we access a postgres database residing on linux server for a >>> web2py application from such an application? >>> >> >> Can't answer this one without knowing more about what #1 means. A quick >> note that a remote web2py server could be running on the linux server with >> the database, or on a separate server, just as for any "normal" web2py >> installation. >> >> >>> 3) Can we use python to write such apps? >>> >> >> See above. I think I've seen mention of native python on mobile devices, >> but perhaps not included in any of the development tools for the device. >> >> >>> 4) Has anyone written any apps that do the above successfully? >>> >>> >>> Rahul >>> >> >> >> Good luck! >> >> /dps >> >> >> -- >> 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/33bOyQHDtfM/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> web2py+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/web2py/76f02897-1f23-4503-919e-3df81cfee1eb%40googlegroups.com >> <https://groups.google.com/d/msgid/web2py/76f02897-1f23-4503-919e-3df81cfee1eb%40googlegroups.com?utm_medium=email_source=footer> >> . >> > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjdd3S60t3DgdGh%3D-52PGoEpJcaL%3D8N6cuvZihWstZNkpA%40mail.gmail.com.
Re: [web2py] Re: Whats the best way to create an Android or iOS app for web2py project
Thanks! Dave and Pbop for getting back with the answers. Sorry about posting less details *@dave* - No, I do not intend to run web2py on mobile device. Web2py would serve my application on the web as it usually does. The idea is to write another simple iOS or Android application in some tool like say what *Pbop* mentioned.( Or Python if we can and if supported!) I want to connect to my web2py web application from the mobile or PDA app. So yes - I wanna do the following - *Do you want to access a [remote] web2py server from a native app on the portable device?* * YES sort of where I will only access postgres database of the application by passing web2py app. I was researching if python could come in handy for this..* My application already works on mobile device in responsive fashion however I would want a stripped down version with a few mobile specific features added for a great user experience. *So for —- * 2) How can we access a postgres database residing on linux server for a web2py application from such an application? *To Add *- Here The application and database reside on the same linux box. Let me know on these and a couple questions I posted below. Regards, *Rahul* On Wed, 11 Sep 2019 at 2:24 PM, Dave S wrote: > > On Friday, September 6, 2019 at 4:28:30 AM UTC-7, Rahul wrote: >> >> Hey Everyone, >> I have some interesting questions (It might have been asked before) >> I want to know - >> >> 1) Whats the best way to create an Android or iOS app for web2py project? >> > > What's the goal? Do you want web2py running as a server on the portable > device? Do you want to display on the portable device pages served by a > [remote] webserver? Do you want to access a [remote] web2py server from a > native app on the portable device? > > Note that a remote web2py server using the view tools that come with it > produces pages that are mobile-friendly (er, "responsive") in the sense of > adapting to the screen size in various ways. > > >> 2) How can we access a postgres database residing on linux server for a >> web2py application from such an application? >> > > Can't answer this one without knowing more about what #1 means. A quick > note that a remote web2py server could be running on the linux server with > the database, or on a separate server, just as for any "normal" web2py > installation. > > >> 3) Can we use python to write such apps? >> > > See above. I think I've seen mention of native python on mobile devices, > but perhaps not included in any of the development tools for the device. > > >> 4) Has anyone written any apps that do the above successfully? >> >> >> Rahul >> > > > Good luck! > > /dps > > > -- > 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/33bOyQHDtfM/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/76f02897-1f23-4503-919e-3df81cfee1eb%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/76f02897-1f23-4503-919e-3df81cfee1eb%40googlegroups.com?utm_medium=email_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjejg-MR-ORJi2qURH-26WH-DeVhqmQn6jsaq0Q%2B8mAbTQ%40mail.gmail.com.
[web2py] Whats the best way to create an Android or iOS app for web2py project
Hey Everyone, I have some interesting questions (It might have been asked before) I want to know - 1) Whats the best way to create an Android or iOS app for web2py project? 2) How can we access a postgres database residing on linux server for a web2py application from such an application? 3) Can we use python to write such apps? 4) Has anyone written any apps that do the above successfully? 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/b0a2b6c5-7d7f-4884-94da-cabe292747e5%40googlegroups.com.
Re: [web2py] Re: Question with saving the thumbnail name on linux disk
Hi Dave, Sorry for the delay - I got busy but - Thanks for pushing me I worked on it today and now it is finally *RESOLVED!! Yay!! * There were two errors - 1] (cannot open resource) 2] NameError: global name 'watermark_font' is not defined These were because the system could not find the *font *I specified in the code. As usual it worked flawlessly on windows but failed on Linux - I applied the previous os checks and specified default fonts from the system and then it worked. I re-instated my try-except blocks back and tested it. It is working properly now. One major error resolved. THANK YOU FOR ALL THE SUGGESTIONS AND GUIDANCE :-) Regards, *Rahul * On Wednesday, September 4, 2019 at 1:54:48 AM UTC+5:30, Dave S wrote: > > > > On Saturday, August 31, 2019 at 6:54:21 PM UTC-7, Rahul wrote: >> >> To Add - >> >> [Sat Aug 31 18:02:10.901023 2019] [wsgi:error] [pid 3810] [client >>> 95.163.255.151:41074 >>> <http://www.google.com/url?q=http%3A%2F%2F95.163.255.151%3A41074=D=1=AFQjCNHSbY1o2xX_PM4TgsoVfr-l9gKKDA>] >>> >>> WARNING:root:Unable to write to file >>> /home/www-data/web2py/applications/artpic/languages/ru.py >>> >> >> What's trying to write to this file? >> [Rahul] This is not me. I am not trying to write anything to this file as >> I dont use it - I donk know about it. I gave the write permissions to >> language folder to resolve the issue. It got resolved and it is not showing >> that error in the logs >> >> > That may be a web2py thing. I see that some of my languages/*.py don't > have the same date; most show 2015-12-26, but zh-cn is 2019-08-06. > > (and a couple of them have the +x permission). > > >> I am not sure about the r artifact - I did not put anything like that. >> >> > I suspect your logging tool, but keep an eye on it. > > Aside from that, I'm missing whatever is wrong. Let's know when you have > the traceback from the exception. > > > Rahul >> >> >> > /dps > > >> On Sun, Sep 1, 2019 at 5:15 AM Dave S wrote: >> >>> >>> >>> On Saturday, August 31, 2019 at 6:40:26 AM UTC-7, Rahul wrote: >>>> >>>> Hi Dave, >>>> I finally found the issue where the magic was with default >>>> folder path specified in db.py. I rectified it in code where-ever I had >>>> defined for other upload types aswell and it works properly. Now the files >>>> do get saved to the desired path. >>>> >>> >>> Yay! >>> >>> >>> >>>> *but the THUMBNAIL file saving issue still persists on linux.* Again >>>> this works properly in Windows. >>>> [...] >>>> >>> >>> >>>> [Sat Aug 31 18:00:20.813518 2019] [wsgi:error] [pid 3806] [client >>>> 42.108.232.228:38975] Cannot create thumbnail (un-recognized format) >>>> for: /home/www-data/web2py/applications/artpic/stati$ >>>> >>> >>> Hmmm >>> >>>> >>>> [Sat Aug 31 18:02:09.456898 2019] [wsgi:error] [pid 3810] [client >>>> 95.163.255.151:41074] WARNING:root:Unable to write to file >>>> /home/www-data/web2py/applications/artpic/languages/ru.py >>>> [Sat Aug 31 18:02:09.685699 2019] [wsgi:error] [pid 3810] [client >>>> 95.163.255.151:41074] WARNING:root:Unable to write to file >>>> /home/www-data/web2py/applications/artpic/languages/ru.py >>>> [Sat Aug 31 18:02:10.900764 2019] [wsgi:error] [pid 3810] [client >>>> 95.163.255.151:41074] WARNING:root:Unable to write to file >>>> /home/www-data/web2py/applications/artpic/languages/ru.py >>>> [Sat Aug 31 18:02:10.901023 2019] [wsgi:error] [pid 3810] [client >>>> 95.163.255.151:41074 >>>> <http://www.google.com/url?q=http%3A%2F%2F95.163.255.151%3A41074=D=1=AFQjCNHSbY1o2xX_PM4TgsoVfr-l9gKKDA>] >>>> >>>> WARNING:root:Unable to write to file >>>> /home/www-data/web2py/applications/artpic/languages/ru.py >>>> >>> >>> What's trying to write to this file? >>> >>> >>> >>>> [...] >>>> >>> [Sat Aug 31 18:27:17.451565 2019] [wsgi:error] [pid 5696] [client >>>> 42.108.232.228:34651] , referer: >>>> http://artpic.in/upload-fotoz >>>> [Sat Aug 31 18:27:17.451647 2019] [wsgi:error] [pid 5696] [client >>>> 42.108.232.228:34651] infile: >>>> /home/www-data/web2py/applications/a
Re: [web2py] Re: Question with saving the thumbnail name on linux disk
To Add - [Sat Aug 31 18:02:10.901023 2019] [wsgi:error] [pid 3810] [client > 95.163.255.151:41074 > <http://www.google.com/url?q=http%3A%2F%2F95.163.255.151%3A41074=D=1=AFQjCNHSbY1o2xX_PM4TgsoVfr-l9gKKDA>] > WARNING:root:Unable to write to file > /home/www-data/web2py/applications/artpic/languages/ru.py > What's trying to write to this file? [Rahul] This is not me. I am not trying to write anything to this file as I dont use it - I donk know about it. I gave the write permissions to language folder to resolve the issue. It got resolved and it is not showing that error in the logs I am not sure about the r artifact - I did not put anything like that. Rahul On Sun, Sep 1, 2019 at 5:15 AM Dave S wrote: > > > On Saturday, August 31, 2019 at 6:40:26 AM UTC-7, Rahul wrote: >> >> Hi Dave, >> I finally found the issue where the magic was with default folder >> path specified in db.py. I rectified it in code where-ever I had defined >> for other upload types aswell and it works properly. Now the files do get >> saved to the desired path. >> > > Yay! > > > >> *but the THUMBNAIL file saving issue still persists on linux.* Again >> this works properly in Windows. >> [...] >> > > >> [Sat Aug 31 18:00:20.813518 2019] [wsgi:error] [pid 3806] [client >> 42.108.232.228:38975] Cannot create thumbnail (un-recognized format) >> for: /home/www-data/web2py/applications/artpic/stati$ >> > > Hmmm > >> >> [Sat Aug 31 18:02:09.456898 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074] WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> [Sat Aug 31 18:02:09.685699 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074] WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> [Sat Aug 31 18:02:10.900764 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074] WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> [Sat Aug 31 18:02:10.901023 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074 >> <http://www.google.com/url?q=http%3A%2F%2F95.163.255.151%3A41074=D=1=AFQjCNHSbY1o2xX_PM4TgsoVfr-l9gKKDA>] >> WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> > > What's trying to write to this file? > > > >> [...] >> > [Sat Aug 31 18:27:17.451565 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] , referer: >> http://artpic.in/upload-fotoz >> [Sat Aug 31 18:27:17.451647 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] infile: >> /home/www-data/web2py/applications/artpic/static/user_uploads/fotoz.upload_photo.b404a9b372$ >> [Sat Aug 31 18:27:17.451668 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] thumbnail_filename: 133.thumbnail.jpg, referer: >> http://artpic.in/upload-fotoz >> [Sat Aug 31 18:27:17.451690 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] thumbpath and outfile: >> /home/www-data/web2py/applications/artpic/static/thumbs/133.thumbnail.jpg, >> r$ >> [Sat Aug 31 18:27:19.289744 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] Cannot create thumbnail (un-recognized format) >> for: /home/www-data/web2py/applications/artpic/stati$ >> >> *CODE - FOR THUMBNAIL* >> [...] >> > except IOError: >> print "Cannot create thumbnail (un-recognized format) >> for: ", infile >> >> >> * Please suggest on how to get the thumbnail to save in debian box - >> I'll try it again after removing the try and catch blocks and get* >> >> > *raw ticket if any tomorrow* >> > > Your except is not printing the exception itself, and what it does print > is misleading (un-recognized format for an IOError?) and the filename > printed may not be the one with the IOError. First check ... make sure > the thumbs directory exists and is writable. Is the ', r' appended to the > line just an artifact of your logging tool? (I see "referer: > hsttp://artpic.ini/upload-fotoz" on some other lines). > > You're definitely getting closer! > > /dps > > -- > 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 fro
Re: [web2py] Re: Question with saving the thumbnail name on linux disk
Yes the thumbs directory exists and I have given all the rights to it. Strange enough it did write a few files to this directory before. As I mentioned before, the previous problem was that thumbnail file name was not properly named, now it does not write to it at all. Also after the patch I did yesterday I executed this command *chmod *... to give appropriate write permissions to it again. I will remove the try catch block today to check it gives me the raw error. Thanks and regards Rahul On Sun, Sep 1, 2019 at 5:15 AM Dave S wrote: > > > On Saturday, August 31, 2019 at 6:40:26 AM UTC-7, Rahul wrote: >> >> Hi Dave, >> I finally found the issue where the magic was with default folder >> path specified in db.py. I rectified it in code where-ever I had defined >> for other upload types aswell and it works properly. Now the files do get >> saved to the desired path. >> > > Yay! > > > >> *but the THUMBNAIL file saving issue still persists on linux.* Again >> this works properly in Windows. >> [...] >> > > >> [Sat Aug 31 18:00:20.813518 2019] [wsgi:error] [pid 3806] [client >> 42.108.232.228:38975] Cannot create thumbnail (un-recognized format) >> for: /home/www-data/web2py/applications/artpic/stati$ >> > > Hmmm > >> >> [Sat Aug 31 18:02:09.456898 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074] WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> [Sat Aug 31 18:02:09.685699 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074] WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> [Sat Aug 31 18:02:10.900764 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074] WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> [Sat Aug 31 18:02:10.901023 2019] [wsgi:error] [pid 3810] [client >> 95.163.255.151:41074 >> <http://www.google.com/url?q=http%3A%2F%2F95.163.255.151%3A41074=D=1=AFQjCNHSbY1o2xX_PM4TgsoVfr-l9gKKDA>] >> WARNING:root:Unable to write to file >> /home/www-data/web2py/applications/artpic/languages/ru.py >> > > What's trying to write to this file? > > > >> [...] >> > [Sat Aug 31 18:27:17.451565 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] , referer: >> http://artpic.in/upload-fotoz >> [Sat Aug 31 18:27:17.451647 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] infile: >> /home/www-data/web2py/applications/artpic/static/user_uploads/fotoz.upload_photo.b404a9b372$ >> [Sat Aug 31 18:27:17.451668 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] thumbnail_filename: 133.thumbnail.jpg, referer: >> http://artpic.in/upload-fotoz >> [Sat Aug 31 18:27:17.451690 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] thumbpath and outfile: >> /home/www-data/web2py/applications/artpic/static/thumbs/133.thumbnail.jpg, >> r$ >> [Sat Aug 31 18:27:19.289744 2019] [wsgi:error] [pid 5696] [client >> 42.108.232.228:34651] Cannot create thumbnail (un-recognized format) >> for: /home/www-data/web2py/applications/artpic/stati$ >> >> *CODE - FOR THUMBNAIL* >> [...] >> > except IOError: >> print "Cannot create thumbnail (un-recognized format) >> for: ", infile >> >> >> * Please suggest on how to get the thumbnail to save in debian box - >> I'll try it again after removing the try and catch blocks and get* >> >> > *raw ticket if any tomorrow* >> > > Your except is not printing the exception itself, and what it does print > is misleading (un-recognized format for an IOError?) and the filename > printed may not be the one with the IOError. First check ... make sure > the thumbs directory exists and is writable. Is the ', r' appended to the > line just an artifact of your logging tool? (I see "referer: > hsttp://artpic.ini/upload-fotoz" on some other lines). > > You're definitely getting closer! > > /dps > > -- > 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/Gn-cqZjDURk/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@goo
[web2py] Re: Question with saving the thumbnail name on linux disk
Hi Dave and Everyone, I followed your advice -- Thanks for the code cleanup - However the issues still exist *ISSUE*#1 - The photo is still being saved in [E:\web2py_src\web2py\applications\*artpicstatic*\user_uploads] Correct path where it should be saved is [infile: E:\web2py_src\web2py\applications\artpic\static\user_uploads\] I simply do not understand why the application is saving the file in above path and not in the correct path in green. We have removed the problem causing code [foto_path = (request.folder + "static/user_uploads/" + upload_pic) ] from this method so where is it pulling it from and saving the files to this location only. Where is this magic happening from? Is it web2py *ISSUE*#2 - As the application cannot find the file in the correct path mentioned above it fails to create a thumbnail for it UPDATED CODE listing form = SOLIDFORM(db.fotoz , fields=fields, submit_button='Upload Foto') #if form.accepts(request.vars, session): if form.process().accepted: upload_pic = form.vars.upload_photo recordsID= form.vars.id #Thumbnail code print ("") infile = os.path.join(request.folder, "static", "user_uploads", upload_pic) print "infile: " , infile thumbnail_filename = "%s.thumbnail.jpg" % recordsID print "thumbnail_filename: ", thumbnail_filename thumbpath = outfile = os.path.join(request.folder, "static", "thumbs" , thumbnail_filename) print "thumbpath and outfile: ", outfile #Insert thumbnail and thumbnail path in db imgthumb field. db(db.fotoz.id==recordsID).update(imgthumb=thumbnail_filename, imgthumbpath=thumbpath) ##outfile if infile != outfile: try: im = Image.open(infile) im.thumbnail(size) #Check for image format image_format = (im.format) #print ("Image format: ", image_format) ### Watermark stuff == ## Watermark Text -- width, height = im.size draw = ImageDraw.Draw(im) watermark_text = "WATER" watermark_font = ImageFont.truetype('arial.ttf', 20) textwidth, textheight = draw.textsize(watermark_text, watermark_font) # calculate the x,y coordinates of the text margin = 5 x = width - textwidth - margin y = height - textheight - margin # draw watermark in the bottom right corner ## Specify this to fill font with red color , fill=(128,0,0,128)) OR #, fill=shadowcolor) OR fill="red" or fill="#ff" -- work draw.text((x, y), watermark_text, font=watermark_font, opacity=0.25) ## --- Watermark text ends --- #Process various image formats for making thumbnails. Currently supporting JPG/JPEG, GIF and PNG if (image_format == "JPEG"): im.save(outfile, "JPEG") if (image_format == "JPG"): im.save(outfile, "JPG") if (image_format == "GIF"): im.save(outfile, "GIF") if (image_format == "PNG"): im.save(outfile, "PNG") except IOError: print "Cannot create thumbnail (un-recognized format) for: " , infile #pass response.flash='Photo uploaded' *OUTPUT *- Path output for above code --* NOTE The infile must be saved in the path mentioned below but it does not exist there. * infile: E:\web2py_src\web2py\applications\artpic\static\user_uploads\fotoz.upload_photo.bf976468faa81f30.3030372e4a5047.JPG thumbnail_filename: 99.thumbnail.jpg thumbpath and outfile: E:\web2py_src\web2py\applications\artpic\static\thumbs\99.thumbnail.jpg Cannot create thumbnail (un-recognized format) for: E:\web2py_src\web2py\applications\artpic\static\user_uploads\fotoz.upload_photo.bf976468faa81f30.3030372e4a5047.JPG Regards, Rahul On Friday, August 30, 2019 at 1:42:44 AM UTC+5:30, Dave S wrote: > > > > On Thursday, August 29, 2019 at 12:21:41 PM UTC-7, Rahul wrote: >> >> Hi Val and Dave, >> >> Have a look at the code below - the line foto_path=... below works but it >> uploads the photos to"web2py\applications\artpicstatic\user_uploads" >> folder instead o
[web2py] Re: Question with saving the thumbnail name on linux disk
And apparently this is what is causing the issue on Linux the wrong path and the folder that does not have the permission. If the above path problem is corrected and if the file is properly saved and thumbnail created then I guess the Linux disk issue might be resolved too. Please suggest Regards, Rahul On Friday, August 30, 2019 at 12:51:41 AM UTC+5:30, Rahul wrote: > > Hi Val and Dave, > > Have a look at the code below - the line foto_path=... below works but it > uploads the photos to"web2py\applications\artpicstatic\user_uploads" > folder instead of web2py\applications\artpic\static\user_uploads folder. It > also generates the thumbnail file. Now if I use *foto_path = > os.path.join(request.folder + "static/user_uploads/" + upload_pic)* it > shows the right path after normalization but does not upload the photo at > all. And since it does not upload the photo the rest of the code fails to > generate thumbnails etc and throws this error . m using windows 10 with > python 2.7.13 > > - [Errno 2] No such file or directory: > 'E:\\web2py_src\\web2py\\applications\\artpic\\static\\user_uploads\\fotoz.upload_photo.82bfeee5a1affabd.3033372e4a5047.JPG' > > CODE: > --- > #foto_path = (request.folder + "static/user_uploads/" + upload_pic) > print ("") > foto_path = (request.folder + "static/user_uploads/" + upload_pic) > print "Foto Path: ", foto_path > > normal_foto_path = os.path.normpath(foto_path) > print "Normal Foto Path: ", normal_foto_path > > infile = normal_foto_path > print "infile: " , infile > > thumbnail_filename = ("%s" % recordsID + ".thumbnail.jpg") > print "thumbnail_filename :", thumbnail_filename > > outfile_path = os.path.join(request.folder, "static/thumbs/" + > thumbnail_filename) > print "outfile_path: ", outfile_path > > normal_outfile_path = os.path.normpath(outfile_path) > print "normal_outfile_path ", normal_outfile_path > > outfile = normal_outfile_path > print "outfile: ", outfile > --- > OUTPUT ITERATIONS: > > [1] > > Foto Path: > E:\web2py_src\web2py\applications\artpicstatic/user_uploads/fotoz.upload_photo.8c9837615e4fa932.3035382e4a5047.JPG > Normal Foto Path: > E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.8c9837615e4fa932.3035382e4a5047.JPG > infile: > E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.8c9837615e4fa932.3035382e4a5047.JPG > thumbnail_filename : 64.thumbnail.jpg > outfile: > E:\web2py_src\web2py\applications\artpic\static\thumbs\64.thumbnail.jpg > > [2] > > Foto Path: > E:\web2py_src\web2py\applications\artpicstatic/user_uploads/fotoz.upload_photo.838dbfb13f66470d.3030312e4a5047.JPG > Normal Foto Path: > E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.838dbfb13f66470d.3030312e4a5047.JPG > infile: > E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.838dbfb13f66470d.3030312e4a5047.JPG > thumbnail_filename : 65.thumbnail.jpg > outfile_path: > E:\web2py_src\web2py\applications\artpic\static/thumbs/65.thumbnail.jpg > normal_outfile_path > E:\web2py_src\web2py\applications\artpic\static\thumbs\65.thumbnail.jpg > outfile: > E:\web2py_src\web2py\applications\artpic\static\thumbs\65.thumbnail.jpg > > > [3] > > infile: > E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.862f9808c7622ca7.3033372e4a5047.JPG > thumbnail_filename: 79.thumbnail.jpg > outfile: > E:\web2py_src\web2py\applications\artpic\static\thumbs\79.thumbnail.jpg > thumbpath: > E:\web2py_src\web2py\applications\artpic\static\thumbs\79.thumbnail.jpg > Cannot create thumbnail (un-recognized format) for: > E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.862f9808c7622ca7.3033372e4a5047.JPG > > > SCREENSHOT > > > > > CODELISTING IS ATTACHED > > Looks like a simple answer but feels like my code is badly written... > > Regards, > > Rahul > > > > > > > > > > On Thursday, August 29, 2019 at 2:17:49 AM UTC+5:30, Val K wrote: >> >> It is no need to use different code for win/linux, since it is Python! >> There is os.path.normpath(your_path) that does all stuff with slashes, I >> have app that works on both platforms just fine (without pl
[web2py] Re: Question with saving the thumbnail name on linux disk
Hi Val and Dave, Have a look at the code below - the line foto_path=... below works but it uploads the photos to"web2py\applications\artpicstatic\user_uploads" folder instead of web2py\applications\artpic\static\user_uploads folder. It also generates the thumbnail file. Now if I use *foto_path = os.path.join(request.folder + "static/user_uploads/" + upload_pic)* it shows the right path after normalization but does not upload the photo at all. And since it does not upload the photo the rest of the code fails to generate thumbnails etc and throws this error . m using windows 10 with python 2.7.13 - [Errno 2] No such file or directory: 'E:\\web2py_src\\web2py\\applications\\artpic\\static\\user_uploads\\fotoz.upload_photo.82bfeee5a1affabd.3033372e4a5047.JPG' CODE: --- #foto_path = (request.folder + "static/user_uploads/" + upload_pic) print ("") foto_path = (request.folder + "static/user_uploads/" + upload_pic) print "Foto Path: ", foto_path normal_foto_path = os.path.normpath(foto_path) print "Normal Foto Path: ", normal_foto_path infile = normal_foto_path print "infile: " , infile thumbnail_filename = ("%s" % recordsID + ".thumbnail.jpg") print "thumbnail_filename :", thumbnail_filename outfile_path = os.path.join(request.folder, "static/thumbs/" + thumbnail_filename) print "outfile_path: ", outfile_path normal_outfile_path = os.path.normpath(outfile_path) print "normal_outfile_path ", normal_outfile_path outfile = normal_outfile_path print "outfile: ", outfile --- OUTPUT ITERATIONS: [1] Foto Path: E:\web2py_src\web2py\applications\artpicstatic/user_uploads/fotoz.upload_photo.8c9837615e4fa932.3035382e4a5047.JPG Normal Foto Path: E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.8c9837615e4fa932.3035382e4a5047.JPG infile: E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.8c9837615e4fa932.3035382e4a5047.JPG thumbnail_filename : 64.thumbnail.jpg outfile: E:\web2py_src\web2py\applications\artpic\static\thumbs\64.thumbnail.jpg [2] Foto Path: E:\web2py_src\web2py\applications\artpicstatic/user_uploads/fotoz.upload_photo.838dbfb13f66470d.3030312e4a5047.JPG Normal Foto Path: E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.838dbfb13f66470d.3030312e4a5047.JPG infile: E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.838dbfb13f66470d.3030312e4a5047.JPG thumbnail_filename : 65.thumbnail.jpg outfile_path: E:\web2py_src\web2py\applications\artpic\static/thumbs/65.thumbnail.jpg normal_outfile_path E:\web2py_src\web2py\applications\artpic\static\thumbs\65.thumbnail.jpg outfile: E:\web2py_src\web2py\applications\artpic\static\thumbs\65.thumbnail.jpg [3] infile: E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.862f9808c7622ca7.3033372e4a5047.JPG thumbnail_filename: 79.thumbnail.jpg outfile: E:\web2py_src\web2py\applications\artpic\static\thumbs\79.thumbnail.jpg thumbpath: E:\web2py_src\web2py\applications\artpic\static\thumbs\79.thumbnail.jpg Cannot create thumbnail (un-recognized format) for: E:\web2py_src\web2py\applications\artpicstatic\user_uploads\fotoz.upload_photo.862f9808c7622ca7.3033372e4a5047.JPG SCREENSHOT CODELISTING IS ATTACHED Looks like a simple answer but feels like my code is badly written... Regards, Rahul On Thursday, August 29, 2019 at 2:17:49 AM UTC+5:30, Val K wrote: > > It is no need to use different code for win/linux, since it is Python! > There is os.path.normpath(your_path) that does all stuff with slashes, I > have app that works on both platforms just fine (without platform checking > at all) > My way - always use '/' in path, and at the end of all manipulations > performs normalisation: path = os.path.normpath(path) > And keep in mind that os.path.join() also works with filenames, so you can > just os.path.join('foo', 'bar', 'baz.thumbnail.jpg') > > > > On Wednesday, August 28, 2019 at 9:05:11 PM UTC+3, Rahul wrote: >> >> Hi Dave, >> >> upload_pic is the form variable that user specifies for uploading the >> file from local disk. Basically it is the filename. I removed the braces for >> outfile = (thumbpath) >> but this is still not working. Any more suggestions ? >> >> >> Regards >> Rahul >> >> On Tuesday, August 27, 2019 at 2:21:45 PM UTC+5:30, Rahul wrote: >>> >>> Hey Dave, >>>
[web2py] Re: Question with saving the thumbnail name on linux disk
Hi Dave, upload_pic is the form variable that user specifies for uploading the file from local disk. Basically it is the filename. I removed the braces for outfile = (thumbpath) but this is still not working. Any more suggestions ? Regards Rahul On Tuesday, August 27, 2019 at 2:21:45 PM UTC+5:30, Rahul wrote: > > Hey Dave, > I was facing issues with path storage in a db field so I started > using this method. I dont need outfiles curly braces will revisit the code > today if possible and get back with the details. This is my modified code, > previous one was straight forward and streamlined code and was using simple > code.Thanks for the questions I’ll try getting in details. > > Regards, > > 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/1c2717cb-6b94-4025-9b82-844f4938bea1%40googlegroups.com.
[web2py] Re: Question with saving the thumbnail name on linux disk
Hey Dave, I was facing issues with path storage in a db field so I started using this method. I dont need outfiles curly braces will revisit the code today if possible and get back with the details. This is my modified code, previous one was straight forward and streamlined code and was using simple code.Thanks for the questions I’ll try getting in details. Regards, 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/584d42e5-ba11-4d8c-b289-f5cc4ea3d462%40googlegroups.com.
[web2py] Question with saving the thumbnail name on linux disk
Hi All, I have an issue with the following code which I ain't able to trace. The code is for uploading images, generating the thumbnails ,watermarking the image and saving the watermarked thumbnail to a path on the system. While this is working fine on windows system, it *fails *miserably on linux system. On debian system it does not save the file name as the record name and it saves it with an incremental valued name. For example if the thumbnail should be 114.thumbnail.jpg on the system it saves as 91.thumbnail.jpg or such name. Note that there is a gap in naming for example there are a few files with names 88.thumbnail.jpg then 90.thumbnail.jpg .. and then 112.thumbnail.jpg. Basically the records ID value appended with .thumbnail.jpg. When a new image is uploaded it should ideally start from 115.thumbnail.jpg as that is the value that is generated and saved in the database. but it takes other value instead when saving the file on the disk may be (if 90.thumnail.. exists already) it will save it as 91.thumbnail.jpg CODE BELOW - if form.accepts(request.vars,session): recordsID= form.vars.id import platform is_windows=(platform.system().lower().find("win") > -1) is_linux=(platform.system().lower().find("lin") > -1) is_mac=(platform.system().lower().find("mac") > -1) if (is_windows == True): #print "is windows" foto_path = (request.folder + "static\\user_uploads\\" + upload_pic) infile = foto_path thumbnail_filename = ("%s" % recordsID + ".thumbnail.jpg") outfile = (request.folder + "static\\thumbs\\" + thumbnail_filename ) thumbpath = os.path.join(request.folder, 'static', 'thumbs\\') + thumbnail_filename elif (is_linux == True): #print "is linux" foto_path = (request.folder + "static/user_uploads/" + upload_pic) infile = foto_path thumbnail_filename = ("%s" % recordsID + ".thumbnail.jpg") #outfile = (request.folder + "static/thumbs/" + thumbnail_filename ) thumbpath = os.path.join(request.folder, 'static', 'thumbs/') + thumbnail_filename outfile = (thumbpath) ## Changed on AUG 25 db(db.fotoz.id==recordsID).update(imgthumb=thumbnail_filename, imgthumbpath=thumbpath) ##outfile if infile != outfile: try: im = Image.open(infile) im.thumbnail(size) #Check for image format image_format = (im.format) #print ("Image format: ", image_format) ### Watermark stuff == width, height = im.size draw = ImageDraw.Draw(im) watermark_text = "WATERMARK" watermark_font = ImageFont.truetype('arial.ttf', 20) textwidth, textheight = draw.textsize(watermark_text, watermark_font) # calculate the x,y coordinates of the text margin = 5 x = width - textwidth - margin y = height - textheight - margin # draw watermark in the bottom right corner ## Specify this to fill font with red color , fill=(128,0,0,128)) OR #, fill=shadowcolor) OR fill="red" or fill="#ff" -- work draw.text((x, y), watermark_text, font=watermark_font, opacity=0.25) ## --- Watermark text ends --- #Process various image formats for making thumbnails. Currently supporting JPG/JPEG, GIF and PNG if (image_format == "JPEG"): im.save(outfile, "JPEG") if (image_format == "GIF"): im.save(outfile, "GIF") if (image_format == "PNG"): im.save(outfile, "PNG") except IOError: print("Cannot create thumbnail (un-recognized format) for ", infile) pass If any one has any idea please suggest - Regards, 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/6e7eb787-8a70-44e9-9e14-e0c87ace57e8%40googlegroups.com.
Re: [web2py] Re: Hosting question
Hi Jose, Thank you !! That worked ... the point #4 resolved that issue. So now no need to work with Apache and all is working well. Thanks a million!! artpic.in and targetsoft.co.in work fine now. Regards, Rahul On Fri, Aug 2, 2019 at 1:53 PM Jose C wrote: > Hi Rahul, > > ok,.. > 1) no the routes.examples.py files don't cause any problems. > 4) Can you make sure that both *'www.domain.in <http://www.domain.in>': > 'app1'* as well as *'domain.in <http://domain.in>': 'app1'* are specified > in the domains key of the BASE dict? I would hope this finally resolves > your issue. > > I don't have any experience at all with Apache and if point 4) above > doesn't resolve your issue then the Apache config is where I would be > inclined to look. Unfortunately I'm unable to help you with that, sorry. > > Jose > > -- > 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/lvOxb_mb6kQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/e37f315e-0ae4-4f36-8f44-9dec2fcb3065%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/e37f315e-0ae4-4f36-8f44-9dec2fcb3065%40googlegroups.com?utm_medium=email_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjct-Gqju0aikPPzwaLSaKFh3dz69A%2BMQt1yF2nJrDfSsA%40mail.gmail.com.
Re: [web2py] Re: Hosting question
Hi Jose, Thanks for getting back - I am using nano for editing routes.py in the live server, it isn't so friendly but gets the job done. Might be one of the reasons for my typo - Here are the answers to rest of the questions - 1) First of all, can you confirm this is a routes.py file in the web2py root directory and that there are not any routes.py (app-specific routers) files present in the app directories as well (that could be overriding the main routes.py)? [Rahul] There exists a *routes.example.py <http://routes.example.py>* (not routes.py) in every application folder - It also exists in web2py\ folder. Do I need to delete it ? Does it cause issues? 2) The config I posted is my live config (other then changing domain names and apps to make it easier to read). It routes to the relevant apps based on the domains as expected, even with the one app set as default. [Rahul]Okay it routes for me tool 3) Also in the routes.py code you posted, the default_function key is misspelt as default_*fucn*tion, which would mean it is ignored (although I think web2py looks for 'index' anyway if none specified, but am not 100% certain). [Rahul] Yes I rectified that issue yesterday itself as I gave error when accessing sites 4) Not sure about the www part. I have a frontend redirect for my www. domains to the normal domain. But, what if you specify www.domain.com as well as domain.com going to 'app1'. Haven't tested this but would expect it to work. [Rahul] If I dont specify www part it redirects to /welcome saying "The page isn’t redirecting properly" 5) Earlier I accessed both your sites at site.in/welcome and was served the welcome app. Now I retried and get the expected error message that it is invalid. Not sure if that helps. [Rahul] This helps but still would need a cleaner way to have access to the app mentioned only 6) Critical... you must restart the server for any change you make to routes.py to come into effect. Not sure if you saw this on the last post. [Rahul] Yes this was done for every change I did.. I restarted Apache after changes to routes.py to reload it. Regards, Rahul On Fri, Aug 2, 2019 at 12:05 AM Jose C wrote: > Strange... > > 1) First of all, can you confirm this is a routes.py file in the web2py > root directory and that there are not any routes.py (app-specific routers) > files present in the app directories as well (that could be overriding the > main routes.py)? > > 2) The config I posted is my live config (other then changing domain names > and apps to make it easier to read). It routes to the relevant apps based > on the domains as expected, even with the one app set as default. > > 3) Also in the routes.py code you posted, the default_function key is > misspelt as default_*fucn*tion, which would mean it is ignored (although > I think web2py looks for 'index' anyway if none specified, but am not 100% > certain). > > 4) Not sure about the www part. I have a frontend redirect for my www. > domains to the normal domain. But, what if you specify www.domain.com as > well as domain.com going to 'app1'. Haven't tested this but would expect > it to work. > > 5) Earlier I accessed both your sites at site.in/welcome and was served > the welcome app. Now I retried and get the expected error message that it > is invalid. Not sure if that helps. > > 6) Critical... you must restart the server for any change you make to > routes.py to come into effect. Not sure if you saw this on the last post. > > > > -- > 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/lvOxb_mb6kQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/030d7db3-c097-4e97-82c8-55c0ae80b57d%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/030d7db3-c097-4e97-82c8-55c0ae80b57d%40googlegroups.com?utm_medium=email_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjcFxKk5mE6nHgFqzcFD1byfYPbebTJk3X0W-b8Uo0vHEw%40mail.gmail.com.
Re: [web2py] Re: Hosting question
Hi Jose, I did the changes as per your suggestion. Now when I specify a default application it takes me to the same application when I access any domain. Secondly - If I specify my domain name without a www. prefix (example: artpic.in) I am navigated to welcome however the app is not show as its not allowed in routes.py . If I specify the complete address it works properly example: www.artpic.in . Have a look at the screenshot. Also you can check it as I havent reverted the changes yet. Let me know. *My routes.py is * routers = dict( > #base router > BASE=dict( > #default_application='Target', > domains= { > 'www.targetsoft.co.in' : 'Target', > 'www.artpic.in' : 'artpic', > }, > #default_application = 'Target', > applications=['Target', 'artpic', ], > default_fucntion = 'index', > ), > Target = dict( > default_language = 'en', >languages = ['en'], > default_function = 'index', > ), > artpic = dict( > default_language = 'en', > languages = ['en'], >default_function = 'index', > map_hyphen = True, > ), > > ) Regards, *Rahul* On Thu, Aug 1, 2019 at 2:07 PM Jose C wrote: > I use Lets encrypt certificates and redirecting from 80 to 443, and I >> don't touch virtualhost file in port 80 so for sure, i'm doing something >> wrong with apache3 and for sure with host names in appconfig.ini >> >> [host] >>> names = localhost:*, 127.0.0.1:*, *:*, * >>> >>> > That is worrying. I can only suspect some kind of misconfiguration with > apache to be causing this. Unfortunately I know nothing about apache conf > so can't help. I'd recommend creating a new post with this issue you're > having... one of the more knowledgeable folks might be able to help you > figure out what is going on. > > > -- > 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/lvOxb_mb6kQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/3611fe72-085d-459b-97b4-e5ed4fb9d34e%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/3611fe72-085d-459b-97b4-e5ed4fb9d34e%40googlegroups.com?utm_medium=email_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMje7cWPJtXH1h0ySDz_GYLj%3DV6ddvv8a-e89MhLigKnYHA%40mail.gmail.com.
Re: [web2py] Re: Hosting question
Hi Jose, Have you removed welcome application from web2py applications folder or it still resides there but when accessed gives 404? I am using python 2.7.13 . I will try your settings for routes and get back to you. In the meantime you may access the sites here that I referred to - 1. www.targetsoft.co.in - is linked with app1 2. www.artpic.in is linked with app2 ( Just set-it-up yesterday but work remains to be done for a production launch) Regards, Rahul On Thu, Aug 1, 2019 at 12:56 PM Jose C wrote: > > I added the line in routes.py - While it restricts allowing >> access to other applications like welcome it does not restrict >> redirection - so in my case it still redirected to welcome application >> mentioning something is wrong message. >> >> Odd. I have a similar setup to you with multiple domains, 2.18.5, py3 > using rocket server. If I do not place 'welcome' in the 'allowed_apps' > any attempt to get to any page on the welcome app returns a 404 (as > expected). > One thing that may be different... I have additional parameters in > routes.py which specifies the default for each app... perhaps in the > absence of this it tries to go back to 'welcome'? > > routers = dict( > # base router > BASE = dict( > domains={'domain1.com' : 'app1', > 'domain2.com' : 'app2', > }, > default_application = 'app1', > applications = ['app1', 'app2'], > default_function = 'home', > ), > app1 = dict( > default_language = 'en', > languages = ['en'], > default_function = 'home', > ), > app2 = dict( > default_language = 'en', > languages = ['en'], > default_function = 'index', > map_hyphen = True, > ), > > > ) > > Paco: Surely appconfig.ini should never be reachable via the url due to > the security risks of allowing access to config info? I paniced for a sec > and tried accessing mine with a link like yours but get 404 (as expected). > Are you saying you can see your appconfig.ini, without specifically doing > something to expose it, by simply accessing a link the way you formatted > it? > > > -- > 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/lvOxb_mb6kQ/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/web2py/4cdc72a0-de86-4850-915c-35a5f8eeafd9%40googlegroups.com > <https://groups.google.com/d/msgid/web2py/4cdc72a0-de86-4850-915c-35a5f8eeafd9%40googlegroups.com?utm_medium=email_source=footer> > . > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/CA%2B6uMjdusvvrEbkFNv68aXVxcP-RdTdMP-9onkReXd2MEpY4Tg%40mail.gmail.com.
[web2py] Re: Hosting question
Hi Jose, I added the line in routes.py - While it restricts allowing access to other applications like welcome it does not restrict redirection - so in my case it still redirected to welcome application mentioning something is wrong message. *Paco,* I checked for this "http://vps_ip/applications/app1/private/appconfig.ini; , the problem is my application does not have an *appconfig.ini*. I started writing it in 2014 or late 2013 so it does not have it as we now have in a default in scaffolding application. I do host the sites on web2py 2.18.5 but that's about it. Regards, *Rahul* On Thursday, August 1, 2019 at 2:30:25 AM UTC+5:30, Paco Bernal wrote: > > Hi > Please can you test this url and tell me what you have as result? > http://vps_ip/applications/app1/private/appconfig.ini > > Change vps_ip for the ip of your server and app1 for the name of your > application (folder name) > > Thx > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/48a7faaf-3559-4de9-aef6-fa0fd28ad32a%40googlegroups.com.
[web2py] GEVENT error even for imports
Hi All, I am getting gevent error even only when doing import on production linux machine (Debian 9.5) . I am trying to register a new user and I use recaptcha2 for that. File "/home/www-data/web2py/applications/application/controllers/default.py", line 4222, in register if form.accepts(request.vars, session): This operation would block forever Hub: >> threadpool=> thread_ident=0x7f9f8a218040> Handles: [] Any clue ? 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/448beef3-6824-4514-ad72-5f4bdc928c36%40googlegroups.com.
[web2py] Hosting question
Hi All, This may sound silly but I have a hosting question - I am already hosting two of my web2py sites on personal VPS server. And I only want anyone who access it to these sites only. I have multiple applications running under same web2py and two of which I use as separate domains. I have default welcome application as well in the application folder. When some access my site they sometimes get redirected to this welcome app. I want to avoid this and the users must only get redirected to the two sites that are hosted. What should I do ? routers = dict( #base router BASE=dict( #default_application='Target', domains= { 'www.domain1.co.in' : 'app1', 'www.domain2.in' : 'app2', } ), ) 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/a2cc4721-f62c-414b-9042-cf48cdef55bc%40googlegroups.com.
[web2py] Re: how can I pass a parameter from the view get the return value from a function of controller?
Hey Lynn, Not sure if this is what you ask for - I am passing query values as parameters in the view here #Sample Function in controller def showmyimage(): # Some db query you want to see data for displayimage = db.tableName(request.args(0,cast=int)) or redirect(URL('index')) return dict (dispimage=dispimage) In view - showmyimage.html Rahul On Wednesday, July 24, 2019 at 8:50:57 PM UTC+5:30, Lynn wrote: > > > It seems that i cannot call a function with a parameter of a controller > from the view. > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/1b4bbd0c-0269-4607-a29e-0367862088f6%40googlegroups.com.
[web2py] Re: Error PIL path
Hi It looks like your escape sequence is missing *\\ *try using these before or after the folder path you are specifying. Again , just to add I used Pillow instead of PIL it works properly on windows. Rahul On Monday, July 1, 2019 at 11:50:10 AM UTC+5:30, Márcio Luis Dresch wrote: > > Hi, I'm new to web2py and am looking for a solution to a problem. The > library is returning a path error while fetching an image for the > thumbnail. > I took the example from: > > > http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box, > > > > which returns > > File "C: \ Users \ marcio.INTRANET \ AppData \ Local \ Programs \ Python \ > Python37-32 \ lib \ site-packages \ PIL \ Image.py", line 2652, in open fp > = builtins.open (filename, "rb") > > FileNotFoundError: [Errno 2] No such file or directory: 'D: \\ web2py \\ > applications \\ ImageUploads / > article.picture.99b1bed4d9cf8a04.636172726f2e6a7067.jpg' > Can anyone help a clarify about the error? > > windows10 64 > Web2py 2.18.5-stable+timestamp.2019.04.08.04.22.03 > (Rodando em Rocket 1.2.6, Python 3.7.2) > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/f5f7da02-7875-434f-8574-754caf9a8fba%40googlegroups.com.
[web2py] Re: Web2py Thumbnail App
Hi Jeff, I have an app here (http://www.targetsoft.co.in/artpic) but it isn't open source yet. Besides, I am working heavily to transform it to a new pro level app which would include a social platform and loads of goodies. Also it would be an independent app/site. This app does let the users upload pics to albums they create and view it in thumbnails. It may be broken at places but ofcourse a new version will be out soon.that will address all these issues. Rahul On Tuesday, March 5, 2019 at 2:53:26 AM UTC+5:30, Jeff Lipkowitz wrote: > > Does anyone have a open source web2py application that users can upload > images and select the image from a tumbnail gallery. > > I want to make a write up of how to make a web app hitting keras model > hosted on google ml. > -- 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: 2.18.1 is OUT
Hi Alex, I got the same reportlab platypus import error on my machine only when I installed PIL package over existing reportlab installation. To rectify this I had to remove PIL from my VPS (Debian) also reportlab and then reinstall pillow (PIL fork) and reportlab again to fix this issue. Hope this helps. *Congratulations! to web2py community for bringing in the new framework.* Keep bringing it on.. :-) *Once small concern* - I am sure that the web2py manual is updated however how about renaming the manual file to web2py version as we have been seeing. For example instead of "*web2py_manual_5th*" we can rename it to " *web2py_manual_2.18.x.pdf*". This will remove the ambiguity that the manual is old one and not updated. What do you think ? Regards, *Rahul* On Monday, February 25, 2019 at 8:56:45 AM UTC+5:30, 黄祥 wrote: > > perhaps you should use web2py source then install reportlab manually > ref: > https://www.reportlab.com/opensource/installation > > 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 when sending email from my custom web app [Errno 111] Connection refuse
Hi All, This is fixed. This wasn't the specific python error - It was email server error. Solution: I edited my postfix *master.cf* file and changed the below line . Restarted the postfix server. That eliminated the connection error. */etc/postfix/master.cf* #smtps inet n - - - - smtpd to: *smtps inet n - - - - smtpd* Thanks! Rahul. On Monday, January 14, 2019 at 5:13:57 PM UTC+5:30, Rahul wrote: > > Hi All, > I have a custom email function that was working fine previously > (with gmail). Now after gmail's policies got updated, I am not able to use > it properly. I got myself an email server which works on port 465 (SSL) or > port 26(Not secure/not recommended version) for SMTP. Also, I am able to > send and receive mails using outlook or thunderbird for my mail server. > However, I am not able to send emails using my server settings from my own > custom software. > > I feed my application with below - > >1. smtp server, - mail.tsoft.xx.xx >2. port_no, - 465 or 26 >3. user_name, -- username@ >4. password -- password for the user > > Now I am getting Connection refused error. > [Errno 111] Connection refused > > File "/home/www-data/web2py/applications/Target/controllers/default.py", line > 408, in new_ticket > email(team_name, mail_Subject , final_mail_body, img1) > File "/home/www-data/web2py/applications/Target/controllers/default.py", > line 6151, in email > server = smtplib.SMTP(host, port) > File "/usr/lib/python2.7/smtplib.py", line 256, in __init__ > (code, msg) = self.connect(host, port) > File "/usr/lib/python2.7/smtplib.py", line 316, in connect > self.sock = self._get_socket(host, port, self.timeout) > File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket > return socket.create_connection((host, port), timeout) > File "/usr/lib/python2.7/socket.py", line 575, in create_connection > raise err > error: [Errno 111] Connection refused > > > I referred to this group (below) but to no avail > > > https://groups.google.com/forum/#!searchin/web2py/Connection$20refused|sort:date/web2py/_cgI-jPfoIM/9p21qXtqHdEJ > > > > I have tried changing my ports to 465, and 26 ( ironically only 26 works > from my local for sending mails but not in production where the application > is hosted. Even tried with it IP of the mail server but it wont work. even > tried with username without @ sign. Please suggest if you have any > idea/clues. > > > Thanks, > > 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] Error when sending email from my custom web app [Errno 111] Connection refuse
Hi All, I have a custom email function that was working fine previously (with gmail). Now after gmail's policies got updated, I am not able to use it properly. I got myself an email server which works on port 465 (SSL) or port 26(Not secure/not recommended version) for SMTP. Also, I am able to send and receive mails using outlook or thunderbird for my mail server. However, I am not able to send emails using my server settings from my own custom software. I feed my application with below - 1. smtp server, - mail.tsoft.xx.xx 2. port_no, - 465 or 26 3. user_name, -- username@ 4. password -- password for the user Now I am getting Connection refused error. [Errno 111] Connection refused File "/home/www-data/web2py/applications/Target/controllers/default.py", line 408, in new_ticket email(team_name, mail_Subject , final_mail_body, img1) File "/home/www-data/web2py/applications/Target/controllers/default.py", line 6151, in email server = smtplib.SMTP(host, port) File "/usr/lib/python2.7/smtplib.py", line 256, in __init__ (code, msg) = self.connect(host, port) File "/usr/lib/python2.7/smtplib.py", line 316, in connect self.sock = self._get_socket(host, port, self.timeout) File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket return socket.create_connection((host, port), timeout) File "/usr/lib/python2.7/socket.py", line 575, in create_connection raise err error: [Errno 111] Connection refused I referred to this group (below) but to no avail https://groups.google.com/forum/#!searchin/web2py/Connection$20refused|sort:date/web2py/_cgI-jPfoIM/9p21qXtqHdEJ I have tried changing my ports to 465, and 26 ( ironically only 26 works from my local for sending mails but not in production where the application is hosted. Even tried with it IP of the mail server but it wont work. even tried with username without @ sign. Please suggest if you have any idea/clues. Thanks, 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.
Re: [web2py] Re: Auth question
Hi Jim, This works like a charm. Thank you for this. It is what I expected and wanted to achieve with Auth. I'll check my new project for what I may be doing wrong, for now it seems that the scaffolding admin interface I want to use for my app is the one that is the culprit. It has lots of custom js and css files. I would need to figure out a way to merge them with it properly. Again, Thank you! for your patience and wonderful support. And thank you everyone. Regards, Rahul. On Sunday, October 28, 2018 at 6:33:25 AM UTC+5:30, Jim S wrote: > > Rahul > > Let's try this a different way. > > Attached is a simple multi-tenant app with one table. > > Does this do what you need? > > 1. Create a new project in web2py > 2. Replace db.py in your models dir with this one > 3. Replace default.py in your controllers dir with this one > 4. Replace index.html in views/default with this one > 5. Add notes.html to views/default > 6. Replace storage.sqlite in your databases dir with this one > > Depending on your version of web2py this should all work. > > I've created 2 logins > > elvis - password is password > blueeyes - password is password > > Click on the notes link logged in as each of them and you'll see different > notes show up based on the common filter. > > -Jim > > On Sat, Oct 27, 2018 at 12:52 PM Rahul > > wrote: > >> Hi Dave and Jim, >>Please find the files in the zipped archive. I have added >> default.py, db.py, index.html and also layout file which I am converting to >> use with web2py. called ace.html. I have also attached the views\login.html >> file since I am extending this file specifically for login form as it is >> different than layout file. Let me know. Thanks! >> >> >> Regards, >> >> Rahul >> >> On Friday, October 26, 2018 at 5:11:12 PM UTC+5:30, Jim S wrote: >>> >>> Can you show the entire db.py, default py and index.html? >>> >>> Jim >>> >>> >>> On Fri, Oct 26, 2018, 1:44 AM Rahul wrote: >>> >>>> Nope - doesnt help. I commented out all the user functions defined in >>>> the controller and >>>> >>>> >>>> # User functions --- >>>> '''def login(): return dict(form=auth.login()) >>>> def register(): return dict(form=auth.register()) >>>> def retrieve_password(): return dict(form=auth.reset_password()) >>>> def logout(): return dict(form=auth.logout()) >>>> def profile(): return dict(form=auth.profile()) >>>> ''' >>>> >>>> I even decorated index - It does take me to the login screen but from >>>> there nothing happens. It just wont log me in like it did before. Also, I >>>> have two users in database but none work now. Again, register seems to >>>> fail (It did work earlier) but now it doesnt. See screenshot of both >>>> screens. Looks like I must be really doing something weird. If this wont >>>> work by this Sunday. I may go back to my old style of coding and do it all >>>> by myself. I've seriously lost 10 days reading and experimenting with Auth >>>> to make it work . Not too much coded. >>>> >>>> @auth.requires_login() >>>> def index(): >>>> response.flash = T("Hello User") >>>> #redirect(URL(r=request, c='default/user', f='login')) # Redirects >>>> user to login page >>>> return dict(message=T('Welcome to web2py!')) >>>> >>>> >>>> >>>> Thanks, >>>> >>>> Rahul >>>> >>>> >>>> >>>> On Thursday, October 25, 2018 at 6:02:45 PM UTC+5:30, Jim S wrote: >>>>> >>>>> Having the default user() functions is all you need. I'd try >>>>> commenting out your 'user' functions. >>>>> >>>>> -Jim >>>>> >>>>> On Wednesday, October 24, 2018 at 10:59:45 PM UTC-5, Rahul wrote: >>>>>> >>>>>> Yes this is in default.py. Please excuse me for my bad code as I am >>>>>> still experimenting with Auth and not totally familiar with the >>>>>> implementation. Is this the right way that I am doing it? or only having >>>>>> user() function is enough ? >>>>>> >>>>>> Thanks, Rahul >>>>>> >>>>>> On Wednesday, October 24, 2018 at 9:45:21 PM UTC+5:30, Jim S wrote: >>>>>>> >>
Re: [web2py] Re: Auth question
Hi Dave and Jim, Please find the files in the zipped archive. I have added default.py, db.py, index.html and also layout file which I am converting to use with web2py. called ace.html. I have also attached the views\login.html file since I am extending this file specifically for login form as it is different than layout file. Let me know. Thanks! Regards, Rahul On Friday, October 26, 2018 at 5:11:12 PM UTC+5:30, Jim S wrote: > > Can you show the entire db.py, default py and index.html? > > Jim > > > On Fri, Oct 26, 2018, 1:44 AM Rahul > > wrote: > >> Nope - doesnt help. I commented out all the user functions defined in the >> controller and >> >> >> # User functions --- >> '''def login(): return dict(form=auth.login()) >> def register(): return dict(form=auth.register()) >> def retrieve_password(): return dict(form=auth.reset_password()) >> def logout(): return dict(form=auth.logout()) >> def profile(): return dict(form=auth.profile()) >> ''' >> >> I even decorated index - It does take me to the login screen but from >> there nothing happens. It just wont log me in like it did before. Also, I >> have two users in database but none work now. Again, register seems to >> fail (It did work earlier) but now it doesnt. See screenshot of both >> screens. Looks like I must be really doing something weird. If this wont >> work by this Sunday. I may go back to my old style of coding and do it all >> by myself. I've seriously lost 10 days reading and experimenting with Auth >> to make it work . Not too much coded. >> >> @auth.requires_login() >> def index(): >> response.flash = T("Hello User") >> #redirect(URL(r=request, c='default/user', f='login')) # Redirects >> user to login page >> return dict(message=T('Welcome to web2py!')) >> >> >> >> Thanks, >> >> Rahul >> >> >> >> On Thursday, October 25, 2018 at 6:02:45 PM UTC+5:30, Jim S wrote: >>> >>> Having the default user() functions is all you need. I'd try commenting >>> out your 'user' functions. >>> >>> -Jim >>> >>> On Wednesday, October 24, 2018 at 10:59:45 PM UTC-5, Rahul wrote: >>>> >>>> Yes this is in default.py. Please excuse me for my bad code as I am >>>> still experimenting with Auth and not totally familiar with the >>>> implementation. Is this the right way that I am doing it? or only having >>>> user() function is enough ? >>>> >>>> Thanks, Rahul >>>> >>>> On Wednesday, October 24, 2018 at 9:45:21 PM UTC+5:30, Jim S wrote: >>>>> >>>>> I'm confused. Is this code in your controller somewhere? >>>>> >>>>> # User functions --- >>>>> def login(): return dict(form=auth.login()) >>>>> def register(): return dict(form=auth.register()) >>>>> def retrieve_password(): return dict(form=auth.reset_password()) >>>>> def logout(): return dict(form=auth.logout()) >>>>> def profile(): return dict(form=auth.profile()) >>>>> >>>>> You shouldn't need it. To override the default login stuff I've just >>>>> modified the one in default.py. >>>>> >>>>> -Jim >>>>> >>>>> >>>>> >>>>> On Tuesday, October 23, 2018 at 11:26:45 PM UTC-5, Rahul wrote: >>>>>> >>>>>> The user function remains as-is - No modifications done. >>>>>> >>>>>> def user(): >>>>>> """ >>>>>> exposes: >>>>>> http:///[app]/default/user/login >>>>>> http:///[app]/default/user/logout >>>>>> http:///[app]/default/user/register >>>>>> http:///[app]/default/user/profile >>>>>> http:///[app]/default/user/retrieve_password >>>>>> http:///[app]/default/user/change_password >>>>>> http:///[app]/default/user/bulk_register >>>>>> use @auth.requires_login() >>>>>> @auth.requires_membership('group name') >>>>>> @auth.requires_permission('read','table name',record_id) >>>>>> to decorate functions that need access control >>>>>> also notice there is http:///[app]/appadmin/manage/auth to >>>>>> allow administrator to manag
Re: [web2py] Re: Auth question
Nope - doesnt help. I commented out all the user functions defined in the controller and # User functions --- '''def login(): return dict(form=auth.login()) def register(): return dict(form=auth.register()) def retrieve_password(): return dict(form=auth.reset_password()) def logout(): return dict(form=auth.logout()) def profile(): return dict(form=auth.profile()) ''' I even decorated index - It does take me to the login screen but from there nothing happens. It just wont log me in like it did before. Also, I have two users in database but none work now. Again, register seems to fail (It did work earlier) but now it doesnt. See screenshot of both screens. Looks like I must be really doing something weird. If this wont work by this Sunday. I may go back to my old style of coding and do it all by myself. I've seriously lost 10 days reading and experimenting with Auth to make it work . Not too much coded. @auth.requires_login() def index(): response.flash = T("Hello User") #redirect(URL(r=request, c='default/user', f='login')) # Redirects user to login page return dict(message=T('Welcome to web2py!')) Thanks, Rahul On Thursday, October 25, 2018 at 6:02:45 PM UTC+5:30, Jim S wrote: > > Having the default user() functions is all you need. I'd try commenting > out your 'user' functions. > > -Jim > > On Wednesday, October 24, 2018 at 10:59:45 PM UTC-5, Rahul wrote: >> >> Yes this is in default.py. Please excuse me for my bad code as I am still >> experimenting with Auth and not totally familiar with the implementation. >> Is this the right way that I am doing it? or only having user() function is >> enough ? >> >> Thanks, Rahul >> >> On Wednesday, October 24, 2018 at 9:45:21 PM UTC+5:30, Jim S wrote: >>> >>> I'm confused. Is this code in your controller somewhere? >>> >>> # User functions --- >>> def login(): return dict(form=auth.login()) >>> def register(): return dict(form=auth.register()) >>> def retrieve_password(): return dict(form=auth.reset_password()) >>> def logout(): return dict(form=auth.logout()) >>> def profile(): return dict(form=auth.profile()) >>> >>> You shouldn't need it. To override the default login stuff I've just >>> modified the one in default.py. >>> >>> -Jim >>> >>> >>> >>> On Tuesday, October 23, 2018 at 11:26:45 PM UTC-5, Rahul wrote: >>>> >>>> The user function remains as-is - No modifications done. >>>> >>>> def user(): >>>> """ >>>> exposes: >>>> http:///[app]/default/user/login >>>> http:///[app]/default/user/logout >>>> http:///[app]/default/user/register >>>> http:///[app]/default/user/profile >>>> http:///[app]/default/user/retrieve_password >>>> http:///[app]/default/user/change_password >>>> http:///[app]/default/user/bulk_register >>>> use @auth.requires_login() >>>> @auth.requires_membership('group name') >>>> @auth.requires_permission('read','table name',record_id) >>>> to decorate functions that need access control >>>> also notice there is http:///[app]/appadmin/manage/auth to >>>> allow administrator to manage users >>>> """ >>>> return dict(form=auth()) >>>> >>>> I am using the specified functions to expose methods as below - >>>> # User functions --- >>>> def login(): return dict(form=auth.login()) >>>> def register(): return dict(form=auth.register()) >>>> def retrieve_password(): return dict(form=auth.reset_password()) >>>> def logout(): return dict(form=auth.logout()) >>>> def profile(): return dict(form=auth.profile()) >>>> >>>> >>>> >>>> and the corresponding files reside in \views\ *not in* \views\default >>>> - I am not sure if the application is even picking up these files. >>>> >>>> Note - I have extended the Auth (auth_user) table and added workspace >>>> and other fields - This will be specified everytime I add a new user. I >>>> would filter out the results as you mentioned but only after all the login >>>> stuff works properly. >>>> >>>> auth.settings.extra_fields['auth_user'] = [ >>>> Field ('workspace', length=128), >>>> >>>> Sincerely, >>>> >>>> Rahul >>>
Re: [web2py] Re: Auth question
Yes this is in default.py. Please excuse me for my bad code as I am still experimenting with Auth and not totally familiar with the implementation. Is this the right way that I am doing it? or only having user() function is enough ? Thanks, Rahul On Wednesday, October 24, 2018 at 9:45:21 PM UTC+5:30, Jim S wrote: > > I'm confused. Is this code in your controller somewhere? > > # User functions --- > def login(): return dict(form=auth.login()) > def register(): return dict(form=auth.register()) > def retrieve_password(): return dict(form=auth.reset_password()) > def logout(): return dict(form=auth.logout()) > def profile(): return dict(form=auth.profile()) > > You shouldn't need it. To override the default login stuff I've just > modified the one in default.py. > > -Jim > > > > On Tuesday, October 23, 2018 at 11:26:45 PM UTC-5, Rahul wrote: >> >> The user function remains as-is - No modifications done. >> >> def user(): >> """ >> exposes: >> http:///[app]/default/user/login >> http:///[app]/default/user/logout >> http:///[app]/default/user/register >> http:///[app]/default/user/profile >> http:///[app]/default/user/retrieve_password >> http:///[app]/default/user/change_password >> http:///[app]/default/user/bulk_register >> use @auth.requires_login() >> @auth.requires_membership('group name') >> @auth.requires_permission('read','table name',record_id) >> to decorate functions that need access control >> also notice there is http:///[app]/appadmin/manage/auth to allow >> administrator to manage users >> """ >> return dict(form=auth()) >> >> I am using the specified functions to expose methods as below - >> # User functions --- >> def login(): return dict(form=auth.login()) >> def register(): return dict(form=auth.register()) >> def retrieve_password(): return dict(form=auth.reset_password()) >> def logout(): return dict(form=auth.logout()) >> def profile(): return dict(form=auth.profile()) >> >> >> >> and the corresponding files reside in \views\ *not in* \views\default - >> I am not sure if the application is even picking up these files. >> >> Note - I have extended the Auth (auth_user) table and added workspace and >> other fields - This will be specified everytime I add a new user. I would >> filter out the results as you mentioned but only after all the login stuff >> works properly. >> >> auth.settings.extra_fields['auth_user'] = [ >> Field ('workspace', length=128), >> >> Sincerely, >> >> Rahul >> >> On Tuesday, October 23, 2018 at 7:49:48 PM UTC+5:30, Jim S wrote: >>> >>> Did you modify the user() function in default.py? Or, are you using >>> your own custom login functions? >>> >>> -Jim >>> >>> On Tuesday, October 23, 2018 at 7:59:21 AM UTC-5, Rahul wrote: >>>> >>>> Hi Jim, All, >>>> Okay I tried this - And I also decorated index() function in >>>> controller like below as I want to redirect the user to login page rather >>>> than directly jumping to index.html >>>> >>>> # example index page >>>> @auth.requires_login() >>>> def index(): >>>> response.flash= T("Hello World") >>>> return dict(message=T('Welcome to web2py!')) >>>> >>>> However, now when I put the credentials username and password, it >>>> doesnt log me in - I generates the below URL like below and appends it to >>>> url box. What might I be missing because it was logging me in fine >>>> sometime >>>> ago but now it doesnt allow. Note I did cleanup a lot of HTML code from my >>>> login page. There sure is something going on here that I am not catching - >>>> >>>> >>>> >>>> http:// >>>> 127.0.0.1:8000/scaffolding_app/default/user/login?username=rahul=integer10&_next=%2Fscaffolding_ace_admin%2Fdefault%2Findex&_formkey=0c0c022a-377d-47dd-bd72-a13e8ee6f387&_formname=login >>>> >>>> >>>> >>>> >>>> >>>> Sincerely, Rahul D. >>>> >>>> >>>> On Friday, October 19, 2018 at 12:24:19 PM UTC+5:30, Rahul wrote: >>>>> >>>>> Hi Jim, >>>>> That makes sense. I will check it out on which option to
Re: [web2py] Re: Auth question
The user function remains as-is - No modifications done. def user(): """ exposes: http:///[app]/default/user/login http:///[app]/default/user/logout http:///[app]/default/user/register http:///[app]/default/user/profile http:///[app]/default/user/retrieve_password http:///[app]/default/user/change_password http:///[app]/default/user/bulk_register use @auth.requires_login() @auth.requires_membership('group name') @auth.requires_permission('read','table name',record_id) to decorate functions that need access control also notice there is http:///[app]/appadmin/manage/auth to allow administrator to manage users """ return dict(form=auth()) I am using the specified functions to expose methods as below - # User functions --- def login(): return dict(form=auth.login()) def register(): return dict(form=auth.register()) def retrieve_password(): return dict(form=auth.reset_password()) def logout(): return dict(form=auth.logout()) def profile(): return dict(form=auth.profile()) and the corresponding files reside in \views\ *not in* \views\default - I am not sure if the application is even picking up these files. Note - I have extended the Auth (auth_user) table and added workspace and other fields - This will be specified everytime I add a new user. I would filter out the results as you mentioned but only after all the login stuff works properly. auth.settings.extra_fields['auth_user'] = [ Field ('workspace', length=128), Sincerely, Rahul On Tuesday, October 23, 2018 at 7:49:48 PM UTC+5:30, Jim S wrote: > > Did you modify the user() function in default.py? Or, are you using your > own custom login functions? > > -Jim > > On Tuesday, October 23, 2018 at 7:59:21 AM UTC-5, Rahul wrote: >> >> Hi Jim, All, >> Okay I tried this - And I also decorated index() function in >> controller like below as I want to redirect the user to login page rather >> than directly jumping to index.html >> >> # example index page >> @auth.requires_login() >> def index(): >> response.flash= T("Hello World") >> return dict(message=T('Welcome to web2py!')) >> >> However, now when I put the credentials username and password, it doesnt >> log me in - I generates the below URL like below and appends it to url box. >> What might I be missing because it was logging me in fine sometime ago but >> now it doesnt allow. Note I did cleanup a lot of HTML code from my login >> page. There sure is something going on here that I am not catching - >> >> >> >> http:// >> 127.0.0.1:8000/scaffolding_app/default/user/login?username=rahul=integer10&_next=%2Fscaffolding_ace_admin%2Fdefault%2Findex&_formkey=0c0c022a-377d-47dd-bd72-a13e8ee6f387&_formname=login >> >> >> >> >> >> Sincerely, Rahul D. >> >> >> On Friday, October 19, 2018 at 12:24:19 PM UTC+5:30, Rahul wrote: >>> >>> Hi Jim, >>> That makes sense. I will check it out on which option to go. >>> Thanks! for all the guidance. >>> >>> Thank you, >>> >>> *Rahul Dhakate* >>> >>> On Wednesday, October 17, 2018 at 7:57:32 PM UTC+5:30, Jim S wrote: >>>> >>>> Rahul >>>> >>>> First, what I was referring to was common_filters, not common fields. >>>> Here is the scenario as I see it. >>>> >>>> In you auth_user table you have a workspace field. Then in other >>>> tables that are workspace-specific you also have a workspace field to show >>>> which workspace they relate to >>>> >>>> Here is how I think I would handle it, assuming I am understanding your >>>> need. And, assuming that the workspace identifier is stored on the user >>>> record. You wouldn't gather it on the login page. >>>> >>>> In db.py I'd have code that would check to see if the user is logged >>>> in. If so, then set the common filters for the workspace-specific tables >>>> >>>> if auth.is_logged_in: >>>>> db.related_table_1._common_filter = lambda query: >>>>> db.related_table_1.workspace = auth.user.workspace >>>>> db.related_table_2._common_filter = lambda query: >>>>> db.related_table_2.workspace = auth.user.workspace >>>>> db.related_table_3._common_filter = lambda query: >>>>> db.related_table_3.workspace = auth.user.workspace >>>>> db.related_table_4._common_filter = lam
Re: [web2py] Re: Auth question
Hi Jim, All, Okay I tried this - And I also decorated index() function in controller like below as I want to redirect the user to login page rather than directly jumping to index.html # example index page @auth.requires_login() def index(): response.flash= T("Hello World") return dict(message=T('Welcome to web2py!')) However, now when I put the credentials username and password, it doesnt log me in - I generates the below URL like below and appends it to url box. What might I be missing because it was logging me in fine sometime ago but now it doesnt allow. Note I did cleanup a lot of HTML code from my login page. There sure is something going on here that I am not catching - http: //127.0.0.1:8000/scaffolding_app/default/user/login?username=rahul=integer10&_next=%2Fscaffolding_ace_admin%2Fdefault%2Findex&_formkey=0c0c022a-377d-47dd-bd72-a13e8ee6f387&_formname=login Sincerely, Rahul D. On Friday, October 19, 2018 at 12:24:19 PM UTC+5:30, Rahul wrote: > > Hi Jim, > That makes sense. I will check it out on which option to go. > Thanks! for all the guidance. > > Thank you, > > *Rahul Dhakate* > > On Wednesday, October 17, 2018 at 7:57:32 PM UTC+5:30, Jim S wrote: >> >> Rahul >> >> First, what I was referring to was common_filters, not common fields. >> Here is the scenario as I see it. >> >> In you auth_user table you have a workspace field. Then in other tables >> that are workspace-specific you also have a workspace field to show which >> workspace they relate to >> >> Here is how I think I would handle it, assuming I am understanding your >> need. And, assuming that the workspace identifier is stored on the user >> record. You wouldn't gather it on the login page. >> >> In db.py I'd have code that would check to see if the user is logged in. >> If so, then set the common filters for the workspace-specific tables >> >> if auth.is_logged_in: >>> db.related_table_1._common_filter = lambda query: >>> db.related_table_1.workspace = auth.user.workspace >>> db.related_table_2._common_filter = lambda query: >>> db.related_table_2.workspace = auth.user.workspace >>> db.related_table_3._common_filter = lambda query: >>> db.related_table_3.workspace = auth.user.workspace >>> db.related_table_4._common_filter = lambda query: >>> db.related_table_4.workspace = auth.user.workspace >>> ...etc... >> >> >> Make sense? >> >> Anyone else out there that's done this and can show a better way? >> >> -Jim >> >> >> NOTE - you might also skip the common filters if you're logging in as an >> admin. Then you might want to see data for all workspaces >> >> NOTE 2 - If you really want people to specify their workspace when they >> login (meaning they have access to all of them but they choose which one on >> login) then you'd have to override the default login code to gather that >> extra variable and store it in your session somewhere. Then use that >> instead of auth.user.workspace when building your filters. >> >> >> >> On Wed, Oct 17, 2018 at 2:06 AM Rahul wrote: >> >>> Hi Jim, >>> I am afraid no I didn't check that section but I just finished >>> reading it. Thanks! for directing me to it. Looks like a new addition to >>> DAL (might be a couple of versions back) & looks promising. So now, we can >>> specify something like request_tenant using db._common_fields field >>> parameter. >>> >>> I would need it for all tables so is there a specific syntax like below >>> that I am required to specify in each table I create ? >>> >>> db._common_fields.append(Field('request_tenant', >>>default=request.env.http_host, >>>writable=False)) >>> >>> >>> Also, can we set the default value to a field value that we can query or >>> pass as a session variable like session.workspace == 'some workspace name' >>> while the user logs in ? >>> >>> default=session.workspace, >>> >>> >>> If yes - what do I need to modify to add this additional field in Auth >>> so it will be an input field for the user to key in the workspace name. >>> Then I can store this workspace in session variable and use it. The reason >>> is I want a group of users (accessing the same app and database from >>> different locations) belonging to same workspace. This is how
Re: [web2py] Re: Auth question
Hi Jim, That makes sense. I will check it out on which option to go. Thanks! for all the guidance. Thank you, *Rahul Dhakate* On Wednesday, October 17, 2018 at 7:57:32 PM UTC+5:30, Jim S wrote: > > Rahul > > First, what I was referring to was common_filters, not common fields. > Here is the scenario as I see it. > > In you auth_user table you have a workspace field. Then in other tables > that are workspace-specific you also have a workspace field to show which > workspace they relate to > > Here is how I think I would handle it, assuming I am understanding your > need. And, assuming that the workspace identifier is stored on the user > record. You wouldn't gather it on the login page. > > In db.py I'd have code that would check to see if the user is logged in. > If so, then set the common filters for the workspace-specific tables > > if auth.is_logged_in: >> db.related_table_1._common_filter = lambda query: >> db.related_table_1.workspace = auth.user.workspace >> db.related_table_2._common_filter = lambda query: >> db.related_table_2.workspace = auth.user.workspace >> db.related_table_3._common_filter = lambda query: >> db.related_table_3.workspace = auth.user.workspace >> db.related_table_4._common_filter = lambda query: >> db.related_table_4.workspace = auth.user.workspace >> ...etc... > > > Make sense? > > Anyone else out there that's done this and can show a better way? > > -Jim > > > NOTE - you might also skip the common filters if you're logging in as an > admin. Then you might want to see data for all workspaces > > NOTE 2 - If you really want people to specify their workspace when they > login (meaning they have access to all of them but they choose which one on > login) then you'd have to override the default login code to gather that > extra variable and store it in your session somewhere. Then use that > instead of auth.user.workspace when building your filters. > > > > On Wed, Oct 17, 2018 at 2:06 AM Rahul > > wrote: > >> Hi Jim, >> I am afraid no I didn't check that section but I just finished >> reading it. Thanks! for directing me to it. Looks like a new addition to >> DAL (might be a couple of versions back) & looks promising. So now, we can >> specify something like request_tenant using db._common_fields field >> parameter. >> >> I would need it for all tables so is there a specific syntax like below >> that I am required to specify in each table I create ? >> >> db._common_fields.append(Field('request_tenant', >>default=request.env.http_host, >>writable=False)) >> >> >> Also, can we set the default value to a field value that we can query or >> pass as a session variable like session.workspace == 'some workspace name' >> while the user logs in ? >> >> default=session.workspace, >> >> >> If yes - what do I need to modify to add this additional field in Auth so >> it will be an input field for the user to key in the workspace name. Then I >> can store this workspace in session variable and use it. The reason is I >> want a group of users (accessing the same app and database from different >> locations) belonging to same workspace. This is how they are grouped. >> please see the screenshot posted from my actual application login. In it I >> use workspace name as well to validate but after reading the book seems >> like we would not require workspace for validation if we can have the user >> provide the field for redirection and for us to grab the session variable. >> >> Or is this not needed at all after we use common fields ? >> >> I hope I am clear and make sense :-) >> >> Regards, >> >> Rahul >> >> >> >> >> >> On Tuesday, October 16, 2018 at 7:49:49 PM UTC+5:30, Jim S wrote: >>> >>> Have you looked at common filters? >>> >>> >>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=common+filter#Common-filters >>> >>> -Jim >>> >>> On Tuesday, October 16, 2018 at 7:35:04 AM UTC-5, Rahul wrote: >>>> >>>> Hey Everyone, >>>>Greetings! I have a question. I went through Auth documentation >>>> and understood that we can add extra fields to the Auth tables. However, I >>>> still want to be a little more clear to achieve below - I am currently >>>> using three fields for a multi-tenant system lik
[web2py] Re: Auth question
Hi Jim, I am afraid no I didn't check that section but I just finished reading it. Thanks! for directing me to it. Looks like a new addition to DAL (might be a couple of versions back) & looks promising. So now, we can specify something like request_tenant using db._common_fields field parameter. I would need it for all tables so is there a specific syntax like below that I am required to specify in each table I create ? db._common_fields.append(Field('request_tenant', default=request.env.http_host, writable=False)) Also, can we set the default value to a field value that we can query or pass as a session variable like session.workspace == 'some workspace name' while the user logs in ? default=session.workspace, If yes - what do I need to modify to add this additional field in Auth so it will be an input field for the user to key in the workspace name. Then I can store this workspace in session variable and use it. The reason is I want a group of users (accessing the same app and database from different locations) belonging to same workspace. This is how they are grouped. please see the screenshot posted from my actual application login. In it I use workspace name as well to validate but after reading the book seems like we would not require workspace for validation if we can have the user provide the field for redirection and for us to grab the session variable. Or is this not needed at all after we use common fields ? I hope I am clear and make sense :-) Regards, Rahul On Tuesday, October 16, 2018 at 7:49:49 PM UTC+5:30, Jim S wrote: > > Have you looked at common filters? > > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer?search=common+filter#Common-filters > > -Jim > > On Tuesday, October 16, 2018 at 7:35:04 AM UTC-5, Rahul wrote: >> >> Hey Everyone, >>Greetings! I have a question. I went through Auth documentation >> and understood that we can add extra fields to the Auth tables. However, I >> still want to be a little more clear to achieve below - I am currently >> using three fields for a multi-tenant system like workspace, username and >> password. Here workspace depicts where the user belongs to (see explanation >> in Q1 below) I am currently using my own code to manage this stuff manually >> (almost everything that auth does), now though I want to give Auth a try >> and tailor it to fit my needs. I dont want to maintain that amount of code >> and use the existing API. Can I get help on achieving that in the simplest >> way. If it works, I would switch to using Auth >> >> * Q1]* How can we use Auth to add one more extra field for >> authentication when I want a system to validate login based on three >> parameters like - Validation needs to be done based on all three parameters >> specified. For each application I can use 'n' number of unique workspaces >> and 'n' number of users would belong to these workspaces. How to do this ? >> >>1. *workspace *- An alpha numeric field that would store a unique >>name denoting users belonging to a particular set (For example users >>working in a specific location like los-angeles or washington) or an >>office location like michigan, nevada or Zones like north, south .. >>sort-of etc. ) >>2. *username *- Its available already >>3. *password *- Its available already >> >> >> *Q2]* Which all tables need to be modified ? >> >> *Q3] *Any changes in any other code in any files ? >> >> I know I can clone my app multiple times and support multi-tenancy >> however, if this can be achieved with Auth - that would be great. >> >> Regards, >> >> *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] Auth question
Hey Everyone, Greetings! I have a question. I went through Auth documentation and understood that we can add extra fields to the Auth tables. However, I still want to be a little more clear to achieve below - I am currently using three fields for a multi-tenant system like workspace, username and password. Here workspace depicts where the user belongs to (see explanation in Q1 below) I am currently using my own code to manage this stuff manually (almost everything that auth does), now though I want to give Auth a try and tailor it to fit my needs. I dont want to maintain that amount of code and use the existing API. Can I get help on achieving that in the simplest way. If it works, I would switch to using Auth * Q1]* How can we use Auth to add one more extra field for authentication when I want a system to validate login based on three parameters like - Validation needs to be done based on all three parameters specified. For each application I can use 'n' number of unique workspaces and 'n' number of users would belong to these workspaces. How to do this ? 1. *workspace *- An alpha numeric field that would store a unique name denoting users belonging to a particular set (For example users working in a specific location like los-angeles or washington) or an office location like michigan, nevada or Zones like north, south .. sort-of etc. ) 2. *username *- Its available already 3. *password *- Its available already *Q2]* Which all tables need to be modified ? *Q3] *Any changes in any other code in any files ? I know I can clone my app multiple times and support multi-tenancy however, if this can be achieved with Auth - that would be great. Regards, *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: Err while trying to submit a new web2py site
Oops.. Looks like a low priority issue ;-) Thanks! Rahul On Monday, September 17, 2018 at 12:01:43 PM UTC+5:30, Rahul wrote: > > Hi Everyone, > Any updates on this yet ? > > Rahul > > On Tuesday, September 4, 2018 at 10:19:02 AM UTC+5:30, Rahul wrote: >> >> 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: Postgres migration errors
Thank you so much! It means a lot to me :-) Cheers, Rahul On Friday, September 28, 2018 at 11:28:44 AM UTC+5:30, Massimo Di Pierro wrote: > > Congratulations! > > On Monday, 17 September 2018 23:39:50 UTC-7, Rahul wrote: >> >> Hi Everyone, >> I am glad to say that my application ( >> http://www.targetsoft.co.in/ ) is up and running on personal VPS. I've >> added links to total of three applications all written in web2py >> >> 1. HMS (Hospital Management system ) coded back in 2016 - may have a few >> issues >> 2. Target+ (Ticketing and Project Management system) - This is being >> written from last 9+ years and was iteratively developed from desktop >> single user with SQLite to now full fledged web application with multiple >> users and workspaces. Again this is my first huge application. You can read >> the details online. If anyone wants to go through the demo workspace let me >> know and I'll publish the access credentials. >> 3. Artpic [Artful pictures] (This is a review, news, blogging, social >> and photography site) for photogs. Although its huge application and would >> need its own space which will be available shortly :-) but currently it can >> be accessed as a web2py application from within the site. >> >> I admit there can be issues lingering in a few applications (and some may >> need updates) but nonetheless I am excited to launch my product in my >> favorite language python and my favorite web framework web2py :-) Do let >> me know if you encounter any issues OR if you have any suggestions or >> change request you can write here, mail me personally or use Contact us >> page of the website. I will be glad to hear from you. >> >> I want to thank all of you & Anthony specially for all the support >> provided to me with my issues. Web2py is superb. >> >> Thank you, >> >> Rahul Dhakate. >> >> On Thursday, August 2, 2018 at 10:17:17 AM UTC+5:30, Rahul wrote: >>> >>> Hi Anthony, >>> Yes there are many queries that are being fired - Since it is a >>> dashboard I have multiple queries being fired sequentially/simultaneously. >>> I have a number of those queries in try catch block as well. I certainly >>> agree that rolling back is not a good solution and in-fact I am in process >>> of getting rid of all try -catch block queries with proper DAL supported >>> queries. I also had quite a few *db.executesql (...)* statements which >>> I am replacing with appropriate DAL queries for maximum compatibility. I >>> would share the queries with you once my cleanup is done and if even after >>> that by removing *db.rollback()* they still throw errors. Since the >>> code is scattered in multiple functions, it is taking time for me to fix >>> it. >>> >>> Application in brief - The application I've written is huge with 26 >>> different modules (Dashboard being one of them). All other modules are >>> working fine except Dashboard which serves the users to view different >>> statistics, drill down in charts, with all sort of notifications, alerts >>> etc (eight sections in all), There are settings centrally for each section >>> to control its visibility. This is the reason for multiple queries that >>> provide data for viewing, analysis and updates are carried out separately >>> when required. >>> >>> Thanks, >>> Rahul >>> >>> - >>> >>> >>> On Wednesday, August 1, 2018 at 8:59:27 PM UTC+5:30, Anthony wrote: >>>> >>>> On Wednesday, August 1, 2018 at 8:48:54 AM UTC-4, Rahul wrote: >>>>> >>>>> Hi Anthony, >>>>> I used *db.rollback**()* and viola - A lot of my failing >>>>> stuff started to work. I am rectifying the failing queries and still >>>>> trying to figure out the incorrect SQL statement that is causing the >>>>> error. >>>>> For below question - Again if I print db.rollback() a *None* is >>>>> returned. >>>>> What happens if you call db.rollback() right before running these >>>>> queries that are generating the error? >>>>> I still want to know what all does - >>>>> db.rollback() function what does it do exactly ? rollback previously >>>>> executed queries? It is working like a charm. >>>>> >>>> >>>> This is not the ideal solution because you may be rolling back good >
[web2py] Re: lose focus events in form fields
Hey All, This is essential - I can do what Donald has said but I want to do it at runtime. It would also be helpful when I try to implement say for example select a country from drop down and then populate states as per the country selected in another dropdown. may more use cases like that including calculations like age by selecting date fro date widget and populating years based on selected date in another field. I think these use cases are pretty valid and have seen them in a lot of web apps (typically aspx, php and java/jsp). How I achieve it in web2py with SQL forms or CRUD forms is what I am looking for. Regards, Rahul On Thursday, September 27, 2018 at 2:24:04 AM UTC+5:30, Dave S wrote: > > > > On Wednesday, September 26, 2018 at 10:43:31 AM UTC-7, Donald McClymont > wrote: >> >> Hi Rahul >> >> You could just do this with Jquery as events that run when any of the 3 >> fields are exited however I am not convinced that's really a great approach >> - I haven't seen an example of doing this as part of the actual SQLFORM. >> Another question would be do you really need to concatenate them as part of >> your data entry? If you need them later you could use a >> computed/calculated field or some function to concatenate them when >> required? >> >> Regards >> Donald >> >> > I haven't done the concatenation part [1], but I've done the lost focus > thing as a way to walk through the proper fields of an SQLFORM where which > fields apply depend on the value of the first field. This has worked > pretty well, except for some oddities ... like deciding to click a sidebar > [or breadcrumb] link instead of finishing the form, or wanting to correct a > single field. > > /dps > > >> >> >> On Tuesday, September 25, 2018 at 1:57:32 PM UTC+1, Rahul wrote: >>> >>> Hi Everyone, >>> Is it possible to have lost focus events in web2py SQLForms or >>> CRUD ? By lost focus I mean building the Full name automatically from >>> First, Middle and Last Name provided while filling the form and display it >>> in Full name filled upon lost focus of either field.. Can we do it ... how >>> ? >>> >>> 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] lose focus events in form fields
Hi Everyone, Is it possible to have lost focus events in web2py SQLForms or CRUD ? By lost focus I mean building the Full name automatically from First, Middle and Last Name provided while filling the form and display it in Full name filled upon lost focus of either field.. Can we do it ... how ? 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: Postgres migration errors
Hi Everyone, I am glad to say that my application (http://www.targetsoft.co.in/ ) is up and running on personal VPS. I've added links to total of three applications all written in web2py 1. HMS (Hospital Management system ) coded back in 2016 - may have a few issues 2. Target+ (Ticketing and Project Management system) - This is being written from last 9+ years and was iteratively developed from desktop single user with SQLite to now full fledged web application with multiple users and workspaces. Again this is my first huge application. You can read the details online. If anyone wants to go through the demo workspace let me know and I'll publish the access credentials. 3. Artpic [Artful pictures] (This is a review, news, blogging, social and photography site) for photogs. Although its huge application and would need its own space which will be available shortly :-) but currently it can be accessed as a web2py application from within the site. I admit there can be issues lingering in a few applications (and some may need updates) but nonetheless I am excited to launch my product in my favorite language python and my favorite web framework web2py :-) Do let me know if you encounter any issues OR if you have any suggestions or change request you can write here, mail me personally or use Contact us page of the website. I will be glad to hear from you. I want to thank all of you & Anthony specially for all the support provided to me with my issues. Web2py is superb. Thank you, Rahul Dhakate. On Thursday, August 2, 2018 at 10:17:17 AM UTC+5:30, Rahul wrote: > > Hi Anthony, > Yes there are many queries that are being fired - Since it is a > dashboard I have multiple queries being fired sequentially/simultaneously. > I have a number of those queries in try catch block as well. I certainly > agree that rolling back is not a good solution and in-fact I am in process > of getting rid of all try -catch block queries with proper DAL supported > queries. I also had quite a few *db.executesql (...)* statements which I > am replacing with appropriate DAL queries for maximum compatibility. I > would share the queries with you once my cleanup is done and if even after > that by removing *db.rollback()* they still throw errors. Since the code > is scattered in multiple functions, it is taking time for me to fix it. > > Application in brief - The application I've written is huge with 26 > different modules (Dashboard being one of them). All other modules are > working fine except Dashboard which serves the users to view different > statistics, drill down in charts, with all sort of notifications, alerts > etc (eight sections in all), There are settings centrally for each section > to control its visibility. This is the reason for multiple queries that > provide data for viewing, analysis and updates are carried out separately > when required. > > Thanks, > Rahul > > - > > > On Wednesday, August 1, 2018 at 8:59:27 PM UTC+5:30, Anthony wrote: >> >> On Wednesday, August 1, 2018 at 8:48:54 AM UTC-4, Rahul wrote: >>> >>> Hi Anthony, >>> I used *db.rollback**()* and viola - A lot of my failing stuff >>> started to work. I am rectifying the failing queries and still trying to >>> figure out the incorrect SQL statement that is causing the error. For below >>> question - Again if I print db.rollback() a *None* is returned. >>> What happens if you call db.rollback() right before running these >>> queries that are generating the error? >>> I still want to know what all does - >>> db.rollback() function what does it do exactly ? rollback previously >>> executed queries? It is working like a charm. >>> >> >> This is not the ideal solution because you may be rolling back good >> queries that you would otherwise want to commit. You should try to identify >> what queries are causing problems. Do you have any queries in a try/except >> that could be causing (uncaught) errors? What other queries are running >> before you get to the queries you have shown? >> >> 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: Err while trying to submit a new web2py site
Hi Everyone, Any updates on this yet ? Rahul On Tuesday, September 4, 2018 at 10:19:02 AM UTC+5:30, Rahul wrote: > > 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] 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: global name 'Recaptcha' is not defined error when my app is run in web2py 2.17.1 (latest)
Oops accidentaly posted it earlier - All, I wanted to know is with earlier version of web2py the same code does not give an error. But it gives me a message as I attached in my earlier mail. But now when I deployed my web2py application on production with latest version, I am being given a ticket. I was expecting the message instead. So I wanted to know if it there is an issue with web2py or some modifications need in my code. *Rahul* On Monday, September 3, 2018 at 9:59:02 AM UTC+5:30, Rahul wrote: > > Hi Anthony, >Yes - It is defined in db.py file as > > from gluon.tools import Recaptcha > > > and is utilized in my controller as - > publickey = "key" > privatekey = "key" > crud.settings.create_captcha= Recaptcha(request, publickey, privatekey > ) > crud.settings.create_captcha.label = 'Recaptcha' > #crud.settings.create_captcha.comment = 'Try get it right!' > > # The crud works for the form > form = crud.create(db.reguser) > form[0][-2][0].append(LABEL("Spam Check ")) > > > On Monday, September 3, 2018 at 7:30:34 AM UTC+5:30, Anthony wrote: >> >> Recaptcha must be imported somewhere for you to use it. Do you have an >> import somewhere in your code? We need more details. >> >> Anthony >> >> On Friday, August 31, 2018 at 8:48:49 AM UTC-4, Rahul wrote: >>> >>> Hi All, >>> There seems to be an issue with latest version of web2py 2.17.1. I >>> am getting an exception like below for my project . However the same seems >>> to be working fine in web2py 2.15.3 but it gives the message shown in >>> attached image. >>> >>> global name 'Recaptcha' is not defined >>> >>> >>> File "web2py/applications/artpic/controllers/default.py", line 1759, in >>> register >>> crud.settings.create_captcha= Recaptcha(request, publickey, >>> privatekey) >>> NameError: global name 'Recaptcha' is not defined >>> >>> Any idea ? >>> >>> 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)
Hi Anthony, Yes - It is defined in db.py file as from gluon.tools import Recaptcha and is utilized in my controller as - publickey = "key" privatekey = "key" crud.settings.create_captcha= Recaptcha(request, publickey, privatekey) crud.settings.create_captcha.label = 'Recaptcha' #crud.settings.create_captcha.comment = 'Try get it right!' # The crud works for the form form = crud.create(db.reguser) form[0][-2][0].append(LABEL("Spam Check ")) On Monday, September 3, 2018 at 7:30:34 AM UTC+5:30, Anthony wrote: > > Recaptcha must be imported somewhere for you to use it. Do you have an > import somewhere in your code? We need more details. > > Anthony > > On Friday, August 31, 2018 at 8:48:49 AM UTC-4, Rahul wrote: >> >> Hi All, >> There seems to be an issue with latest version of web2py 2.17.1. I am >> getting an exception like below for my project . However the same seems to >> be working fine in web2py 2.15.3 but it gives the message shown in attached >> image. >> >> global name 'Recaptcha' is not defined >> >> >> File "web2py/applications/artpic/controllers/default.py", line 1759, in >> register >> crud.settings.create_captcha= Recaptcha(request, publickey, >> privatekey) >> NameError: global name 'Recaptcha' is not defined >> >> Any idea ? >> >> 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] global name 'Recaptcha' is not defined error when my app is run in web2py 2.17.1 (latest)
Hi All, There seems to be an issue with latest version of web2py 2.17.1. I am getting an exception like below for my project . However the same seems to be working fine in web2py 2.15.3 but it gives the message shown in attached image. global name 'Recaptcha' is not defined File "web2py/applications/artpic/controllers/default.py", line 1759, in register crud.settings.create_captcha= Recaptcha(request, publickey, privatekey) NameError: global name 'Recaptcha' is not defined Any idea ? 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: Postgres migration errors
Hi Anthony, Yes there are many queries that are being fired - Since it is a dashboard I have multiple queries being fired sequentially/simultaneously. I have a number of those queries in try catch block as well. I certainly agree that rolling back is not a good solution and in-fact I am in process of getting rid of all try -catch block queries with proper DAL supported queries. I also had quite a few *db.executesql (...)* statements which I am replacing with appropriate DAL queries for maximum compatibility. I would share the queries with you once my cleanup is done and if even after that by removing *db.rollback()* they still throw errors. Since the code is scattered in multiple functions, it is taking time for me to fix it. Application in brief - The application I've written is huge with 26 different modules (Dashboard being one of them). All other modules are working fine except Dashboard which serves the users to view different statistics, drill down in charts, with all sort of notifications, alerts etc (eight sections in all), There are settings centrally for each section to control its visibility. This is the reason for multiple queries that provide data for viewing, analysis and updates are carried out separately when required. Thanks, Rahul - On Wednesday, August 1, 2018 at 8:59:27 PM UTC+5:30, Anthony wrote: > > On Wednesday, August 1, 2018 at 8:48:54 AM UTC-4, Rahul wrote: >> >> Hi Anthony, >> I used *db.rollback**()* and viola - A lot of my failing stuff >> started to work. I am rectifying the failing queries and still trying to >> figure out the incorrect SQL statement that is causing the error. For below >> question - Again if I print db.rollback() a *None* is returned. >> What happens if you call db.rollback() right before running these queries >> that are generating the error? >> I still want to know what all does - >> db.rollback() function what does it do exactly ? rollback previously >> executed queries? It is working like a charm. >> > > This is not the ideal solution because you may be rolling back good > queries that you would otherwise want to commit. You should try to identify > what queries are causing problems. Do you have any queries in a try/except > that could be causing (uncaught) errors? What other queries are running > before you get to the queries you have shown? > > 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: Postgres migration errors
Hi Anthony, I used *db.rollback**()* and viola - A lot of my failing stuff started to work. I am rectifying the failing queries and still trying to figure out the incorrect SQL statement that is causing the error. For below question - Again if I print db.rollback() a *None* is returned. What happens if you call db.rollback() right before running these queries that are generating the error? I still want to know what all does - db.rollback() function what does it do exactly ? rollback previously executed queries? It is working like a charm. Thank you very very much *Anthony*! for this tip however I would have to make sure that my code works fine even if this is not there Rahul On Tuesday, July 31, 2018 at 11:50:57 PM UTC+5:30, Anthony wrote: > > It sounds like this error can happen when you run an incorrect SQL > statement within a transaction and then follow with another statement. Is > it possible there is some earlier query you are running (maybe in one of > your model files) that does not work in Postgres? What happens if you call > db.rollback() right before running these queries that are generating the > error? > > Anthony > > On Tuesday, July 31, 2018 at 7:48:26 AM UTC-4, Rahul wrote: >> >> Hi Anthony, >> I am printing this to console - The query is trying to fetch >> records that have an ETA in next 15 days >> >> print db(((db.issues.eta_date > today) & (db.issues.eta_date <= >> fifteen_days_ahead)) & (db.issues.workspace == user_workspace) & (db. >> issues.created_by == logged_in_user))._select() >> >> Here is the query output (Just removed a few fields only in between as >> there were many) - If needed I will send the entire query. >> SELECT "issues"."id", "issues"."ticket_no", "issues"."project_name", >> "issues"."sub_project", "issues"."team", "issues"."date_today", "issues". >> "category", "issues"."created_by", "issues"."workspace", "issues". >> "eta_date", "issues"."notify" FROM "issues" WHERE "issues"."eta_date" >> > '2018-07-31') AND ("issues"."eta_date" <= '2018-08-14')) AND ("issues". >> "workspace" = 'WS1')) AND ("issues"."created_by" = 'rahul')); >> >> Let me know if anything else is needed - >> >> Thank you >> Rahul >> >> >> On Monday, July 30, 2018 at 11:23:05 PM UTC+5:30, Anthony wrote: >>> >>> Can you print out the raw SQL via ._select() so we can see exactly what >>> is being sent to the database when the error occurs? >>> >>> On Monday, July 30, 2018 at 5:39:35 AM UTC-4, Rahul wrote: >>>> >>>> Okay I followed everyones instructions >>>> I installed psycopg2 and the application is using this by default. >>>> However it is giving me the same errors I got before. I did not earlier >>>> use >>>> "%s" % but in the example I provided I just gave it a try as somewhere I >>>> think it referred to a string issue. >>>> >>>> 1. >>>> 2. >>>> 3. >>>> 4. >>>> 5. >>>> 6. >>>> 7. >>>> 8. >>>> 9. >>>> 10. >>>> 11. >>>> 12. >>>> 13. >>>> 14. >>>> 15. >>>> 16. >>>> 17. >>>> 18. >>>> 19. >>>> 20. >>>> 21. >>>> 22. >>>> 23. >>>> >>>> Traceback (most recent call last): >>>> File "D:\web2py\web2py\gluon\restricted.py", line 219, in restricted >>>> exec(ccode, environment) >>>> File "D:/web2py/web2py/applications/Target/controllers/default.py" >>>> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, >>>> line 15360, in >>>> File "D:\web2py\web2py\gluon\globals.py", line 409, in >>>> self._caller = lambda f: f() >>>> File "D:/web2py/web2py/applications/Target/controllers/default.py" >>>> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, >>>> line 714, in dashboard >>>> alertRows=s.select() >>>> File "D:\web2py\web2py\gluon\packages\dal\pydal\objects.py", line 2211, >>>> in select >>>> return ada
[web2py] Re: Postgres migration errors
Basically, I am trying to compare *between *dates here. One other query works but the ones specified earlier (below) do not. I am sure that there is some programming mistake from my side. But I am not sure what it is - Tickets = db((db.issues.date_today >= daysix) & (db.issues.date_today <= today)).select(db.issues.ticket_no) Here, today = datetime.date.today()# day 1 daysix = today - datetime.timedelta(days=5) # day6 Rahul On Tuesday, July 31, 2018 at 5:18:26 PM UTC+5:30, Rahul wrote: > > Hi Anthony, > I am printing this to console - The query is trying to fetch > records that have an ETA in next 15 days > > print db(((db.issues.eta_date > today) & (db.issues.eta_date <= > fifteen_days_ahead)) & (db.issues.workspace == user_workspace) & (db. > issues.created_by == logged_in_user))._select() > > Here is the query output (Just removed a few fields only in between as > there were many) - If needed I will send the entire query. > SELECT "issues"."id", "issues"."ticket_no", "issues"."project_name", > "issues"."sub_project", "issues"."team", "issues"."date_today", "issues". > "category", "issues"."created_by", "issues"."workspace", "issues". > "eta_date", "issues"."notify" FROM "issues" WHERE "issues"."eta_date" > > '2018-07-31') AND ("issues"."eta_date" <= '2018-08-14')) AND ("issues". > "workspace" = 'WS1')) AND ("issues"."created_by" = 'rahul')); > > Let me know if anything else is needed - > > Thank you > Rahul > > > On Monday, July 30, 2018 at 11:23:05 PM UTC+5:30, Anthony wrote: >> >> Can you print out the raw SQL via ._select() so we can see exactly what >> is being sent to the database when the error occurs? >> >> On Monday, July 30, 2018 at 5:39:35 AM UTC-4, Rahul wrote: >>> >>> Okay I followed everyones instructions >>> I installed psycopg2 and the application is using this by default. >>> However it is giving me the same errors I got before. I did not earlier use >>> "%s" % but in the example I provided I just gave it a try as somewhere I >>> think it referred to a string issue. >>> >>> 1. >>> 2. >>> 3. >>> 4. >>> 5. >>> 6. >>> 7. >>> 8. >>> 9. >>> 10. >>> 11. >>> 12. >>> 13. >>> 14. >>> 15. >>> 16. >>> 17. >>> 18. >>> 19. >>> 20. >>> 21. >>> 22. >>> 23. >>> >>> Traceback (most recent call last): >>> File "D:\web2py\web2py\gluon\restricted.py", line 219, in restricted >>> exec(ccode, environment) >>> File "D:/web2py/web2py/applications/Target/controllers/default.py" >>> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, >>> line 15360, in >>> File "D:\web2py\web2py\gluon\globals.py", line 409, in >>> self._caller = lambda f: f() >>> File "D:/web2py/web2py/applications/Target/controllers/default.py" >>> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, >>> line 714, in dashboard >>> alertRows=s.select() >>> File "D:\web2py\web2py\gluon\packages\dal\pydal\objects.py", line 2211, >>> in select >>> return adapter.select(self.query, fields, attributes) >>> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >>> 762, in select >>> return self._select_aux(sql, fields, attributes, colnames) >>> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >>> 718, in _select_aux >>> rows = self._select_aux_execute(sql) >>> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >>> 712, in _select_aux_execute >>> self.execute(sql) >>> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", >>> line 67, in wrap >>> return f(*args, **kwargs) >>> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >>> 412, in execute >>> rv = self.cursor.execute(command, *args[1:], **kwargs) >>> InternalError: current transaction is aborted, commands ignored until end >>> of transaction block >>> >>> >>> current transaction is aborted, >>> commands ignored until end of transaction block >>> >>> Any suggestions? >>> >>> Rahul >>> >>> On Sunday, July 29, 2018 at 10:24:07 PM UTC+5:30, Joe Barnhart wrote: >>>> >>>> I’d get rid of the idiom: >>>> >>>> db.colname==“%s”%pythonvar >>>> >>>> Just replace it with: >>>> >>>> db.colname==pythonvar >>>> >>>> — Joe >>> >>> -- 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: Postgres migration errors
Hi Anthony, I am printing this to console - The query is trying to fetch records that have an ETA in next 15 days print db(((db.issues.eta_date > today) & (db.issues.eta_date <= fifteen_days_ahead)) & (db.issues.workspace == user_workspace) & (db.issues.created_by == logged_in_user))._select() Here is the query output (Just removed a few fields only in between as there were many) - If needed I will send the entire query. SELECT "issues"."id", "issues"."ticket_no", "issues"."project_name", "issues"."sub_project", "issues"."team", "issues"."date_today", "issues". "category", "issues"."created_by", "issues"."workspace", "issues"."eta_date" , "issues"."notify" FROM "issues" WHERE "issues"."eta_date" > '2018-07-31') AND ("issues"."eta_date" <= '2018-08-14')) AND ("issues". "workspace" = 'WS1')) AND ("issues"."created_by" = 'rahul')); Let me know if anything else is needed - Thank you Rahul On Monday, July 30, 2018 at 11:23:05 PM UTC+5:30, Anthony wrote: > > Can you print out the raw SQL via ._select() so we can see exactly what is > being sent to the database when the error occurs? > > On Monday, July 30, 2018 at 5:39:35 AM UTC-4, Rahul wrote: >> >> Okay I followed everyones instructions >> I installed psycopg2 and the application is using this by default. >> However it is giving me the same errors I got before. I did not earlier use >> "%s" % but in the example I provided I just gave it a try as somewhere I >> think it referred to a string issue. >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> 17. >> 18. >> 19. >> 20. >> 21. >> 22. >> 23. >> >> Traceback (most recent call last): >> File "D:\web2py\web2py\gluon\restricted.py", line 219, in restricted >> exec(ccode, environment) >> File "D:/web2py/web2py/applications/Target/controllers/default.py" >> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, >> line 15360, in >> File "D:\web2py\web2py\gluon\globals.py", line 409, in >> self._caller = lambda f: f() >> File "D:/web2py/web2py/applications/Target/controllers/default.py" >> <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, >> line 714, in dashboard >> alertRows=s.select() >> File "D:\web2py\web2py\gluon\packages\dal\pydal\objects.py", line 2211, in >> select >> return adapter.select(self.query, fields, attributes) >> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >> 762, in select >> return self._select_aux(sql, fields, attributes, colnames) >> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >> 718, in _select_aux >> rows = self._select_aux_execute(sql) >> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >> 712, in _select_aux_execute >> self.execute(sql) >> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", >> line 67, in wrap >> return f(*args, **kwargs) >> File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line >> 412, in execute >> rv = self.cursor.execute(command, *args[1:], **kwargs) >> InternalError: current transaction is aborted, commands ignored until end of >> transaction block >> >> >> current transaction is aborted, >> commands ignored until end of transaction block >> >> Any suggestions? >> >> Rahul >> >> On Sunday, July 29, 2018 at 10:24:07 PM UTC+5:30, Joe Barnhart wrote: >>> >>> I’d get rid of the idiom: >>> >>> db.colname==“%s”%pythonvar >>> >>> Just replace it with: >>> >>> db.colname==pythonvar >>> >>> — Joe >> >> -- 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: Postgres migration errors
Okay I followed everyones instructions I installed psycopg2 and the application is using this by default. However it is giving me the same errors I got before. I did not earlier use "%s" % but in the example I provided I just gave it a try as somewhere I think it referred to a string issue. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. Traceback (most recent call last): File "D:\web2py\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment) File "D:/web2py/web2py/applications/Target/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, line 15360, in File "D:\web2py\web2py\gluon\globals.py", line 409, in self._caller = lambda f: f() File "D:/web2py/web2py/applications/Target/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/Target/controllers/default.py>, line 714, in dashboard alertRows=s.select() File "D:\web2py\web2py\gluon\packages\dal\pydal\objects.py", line 2211, in select return adapter.select(self.query, fields, attributes) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 762, in select return self._select_aux(sql, fields, attributes, colnames) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 718, in _select_aux rows = self._select_aux_execute(sql) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 712, in _select_aux_execute self.execute(sql) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 67, in wrap return f(*args, **kwargs) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 412, in execute rv = self.cursor.execute(command, *args[1:], **kwargs) InternalError: current transaction is aborted, commands ignored until end of transaction block current transaction is aborted, commands ignored until end of transaction block Any suggestions? Rahul On Sunday, July 29, 2018 at 10:24:07 PM UTC+5:30, Joe Barnhart wrote: > > I’d get rid of the idiom: > > db.colname==“%s”%pythonvar > > Just replace it with: > > db.colname==pythonvar > > — Joe -- 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] Postgres migration errors
Hi Everyone, I recently migrated my entire SQLite database to Postgre 9.x . While almost all my changes are working fine, I am getting errors for a few SQL statements like below for sections in my dashboard. (i) this statement and below statement is throwing the error - However if I put the exact same statement in db.py and print the results it works flawlessly. I am confused why it is behaving this way. Does postgres require a different syntax for the queries we throw in DAL ? for count etc ? teams_only = db((db.teams.workspace == user_workspace)).select(db.teams. team_name) (ii) patches = db((db.patches.workspace == "%s" % user_workspace) & (db.patches.patchweek == "%s" % patchWeek) & (db.patches.patchyear == "%s" % patchYr)).select() Error is common - for both (u'ERROR', u'25P02', u'current transaction is aborted, commands ignored until end of transaction block', u'src\\backend\\tcop\\postgres.c', u'1259', u'exec_parse_message', u'', u'') Traceback 1. 2. Traceback (most recent call last): File "D:\web2py\web2py\gluon\restricted.py", line 219, in restricted exec(ccode, environment) File "D:/web2py/web2py/applications/Target/controllers/default.py", line 15357, in File "D:\web2py\web2py\gluon\globals.py", line 409, in self._caller = lambda f: f() File "D:/web2py/web2py/applications/Target/controllers/default.py", line 808, in dashboard APWK = activepatchesWK() #active patches weekly File "D:/web2py/web2py/applications/Target/controllers/default.py", line 14585, in activepatchesWK patches = db((db.patches.workspace == "%s" % user_workspace) & (db.patches.patchweek == "%s" % patchWeek) & (db.patches.patchyear == "%s" % patchYr)).select() File "D:\web2py\web2py\gluon\packages\dal\pydal\objects.py", line 2211, in select return adapter.select(self.query, fields, attributes) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 762, in select return self._select_aux(sql, fields, attributes, colnames) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 718, in _select_aux rows = self._select_aux_execute(sql) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 712, in _select_aux_execute self.execute(sql) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 67, in wrap return f(*args, **kwargs) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\postgres.py", line 190, in execute return super(PostgrePG8000, self).execute(*args, **kwargs) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 67, in wrap return f(*args, **kwargs) File "D:\web2py\web2py\gluon\packages\dal\pydal\adapters\base.py", line 412, in execute rv = self.cursor.execute(command, *args[1:], **kwargs) File "D:\web2py\web2py\gluon\contrib\pg8000\core.py", line 906, in execute self._c.execute(self, operation, args) File "D:\web2py\web2py\gluon\contrib\pg8000\core.py", line 1940, in execute self.handle_messages(cursor) File "D:\web2py\web2py\gluon\contrib\pg8000\core.py", line 2088, in handle_messages raise self.error ProgrammingError: (u'ERROR', u'25P02', u'current transaction is aborted, commands ignored until end of transaction block', u'src\\backend\\tcop\\postgres.c', u'1259', u'exec_parse_message', u'', u'') I have checked this for but no help - Postgres error 25P02 is for "transaction aborted" is returned with SQL State = "25P02". https://www.postgresql.org/message-id/3D9BF154E1B0B6D07D04B1F0CD4F5C0486%40ntk-mail2k3.nortak.com My Environment - web2py Version 2.15.3-stable+timestamp Windows 10 Python 2.7.13 Can anyone guide me in proper direction with Postgres query handling with DAL Thanks, 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: Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES
This information is awesome. Thank you for sharing this with us. Glad I am coding web2py. Cheers, Rahul On Thursday, July 26, 2018 at 3:09:35 AM UTC+5:30, Anthony wrote: > > On Wednesday, July 25, 2018 at 3:36:58 PM UTC-4, pbreit wrote: >> >> ...or Anthony! >> >> Thanks, that's good info and reassuring. >> >> Safe to assume little/no downside to always double-quoting? >> > > It's the default behavior of web2py now, so hopefully not. > -- 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: Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES
Hi Anthony, pbreit, The following line of code works just fine for *rname*. I was able to save *state*, *date*, *module*, *notify *etc in the database table as field names. Although I will make it a practice to use different field names than those reserved/unreserved for future projects. Field('notify', 'boolean', label='Add Notification?', rname='"notify"', default=True ), Note: without double quotes within single quotes it does not work. *check_reserved* does not seem to have an impact I removed it and still it worked properly and gave me postgres exceptions where required. db = DAL('postgres://postgres:@localhost/base', pool_size=50, lazy_tables=False) # This declaration works with it just fine. I'll be making lazy_tables=True for performance boost later. I am working regression testing and fixing migration bugs in the app. Although so far all seems to be working well. Except collecting user_statistics for each page. I will check the app and get back if I find anything crucial. Thank you very much for all your help . *Sincerely,* *Rahul* On Wednesday, July 25, 2018 at 4:37:39 AM UTC+5:30, Anthony wrote: > > I believe the DAL now always double quotes table and field names when > constructing queries, so I'm not sure you even need to use check_reserved > anymore. What happens if you simply remove it? > > Anthony > > On Tuesday, July 24, 2018 at 4:39:05 PM UTC-4, pbreit wrote: >> >> Apparently if you are going to use "rname" you may need to surround the >> column name with single and double quotes which will send the double-quotes >> to the DB: >> >> Field('state', rname='"state"') >> >> As an aside, it always seemed to me that a DB access library would be >> able to be structured in such a way that reserved words would be a >> non-issue. There are quite a few words on the list that I would like to use >> (ie, state, group). >> > -- 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: Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES
All, To add - Syntax like below worked however I am getting a few application errors. Field(‘notifys’ , ‘boolean’, rname=‘notify’), In above notify is a reserved postgres keyword but we can use it as a field name in postgres db table. The reference field name ‘notifys’ in this case is something I need to fix in application. I will keep you posted. I am hoping I am going the right way. Thanks! Sincerely, 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: Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES
Thank you! for getting back Dave and pointing me to this page - I used it for *state *field name and it did *not *work for me. Field('state', rname='state_country'), Give me below syntax error still - *SyntaxError*: invalid table/column name "state" is a "POSTGRES_NONRESERVED" reserved SQL/NOSQL keyword Am I using it properly ? *Rahul * On Tuesday, July 24, 2018 at 2:15:42 AM UTC+5:30, Dave S wrote: > > > > On Sunday, July 22, 2018 at 10:28:46 PM UTC-7, Rahul wrote: >> >> Hey everyone, >> Any clues on this one? OR should I start updating the >> application and the models with unused field names? Please let me know >> >> >> > Does 'rname' help? You have to poke a bit in the book to find it at field > level, but when you do it says > > "rname provides the field was a "real name", a name for the field known > to the database adapter; when the field is used, it is the rname value > which is sent to the database. The web2py name for the field is then > effectively an alias." > > http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Field-constructor > > > > See also > https://groups.google.com/d/msg/web2py/X52AnJIQj_o/VnxIJcyNAwAJ> > https://groups.google.com/d/msg/web2py/mVsTN7QLQ1M/QxaT3ObZAgAJ> > > /dps > > >> On Friday, July 20, 2018 at 12:40:04 PM UTC+5:30, Rahul wrote: >>> >>> Hello All, >>>I am migrating my project from SQLite to POSTGRESQL - >>> I have a few field names and table names that seem to be a part of >>> reserver/non-serverved POSTGRES keywords - For example, field name = *state >>> >>> (Field('state', .. )*, *Field('notify', 'boolean', label='Add >>> Notification?', ), * >>> >>> Now I get below errors as highlighted below >>> >>> >>> *My question is *- Is there a work around to make these names work some >>> how ? (backticks or something I found on the web but how do I use it under >>> DAL ? ) Also, I could not find anything about *rname* in the web2py >>> documentation.. Any idea if / how it can help in this case ? >>> >>> *Ironically - * >>> >>> Initially I had db= ... check_reserved=['all'] and it never gave me the >>> exception in SQLite but as soon as I switched it started giving me this. >>> which I believe it shoudl have shown me even when I ws in SQLite. Is that >>> an issue ? >>> >>> * invalid table/column name "state" is a >>> "ALL" reserved SQL/NOSQL keyword* >>> >>> & when I added >>> >>> *check_reserved=['postgres', 'postgres_nonreserved'**]* and now it is >>> showing this error (Which is to the point) >>> >>> invalid table/column name "state" is a >>> "POSTGRES_NONRESERVED" reserved SQL/NOSQL keyword >>> >>> >>> Please suggest how I can get rid of this issue >>> >>> 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: Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES
Hey everyone, Any clues on this one? OR should I start updating the application and the models with unused field names? Please let me know Thank you, *Rahul* On Friday, July 20, 2018 at 12:40:04 PM UTC+5:30, Rahul wrote: > > Hello All, >I am migrating my project from SQLite to POSTGRESQL - > I have a few field names and table names that seem to be a part of > reserver/non-serverved POSTGRES keywords - For example, field name = *state > (Field('state', .. )*, *Field('notify', 'boolean', label='Add > Notification?', ), * > > Now I get below errors as highlighted below > > > *My question is *- Is there a work around to make these names work some > how ? (backticks or something I found on the web but how do I use it under > DAL ? ) Also, I could not find anything about *rname* in the web2py > documentation.. Any idea if / how it can help in this case ? > > *Ironically - * > > Initially I had db= ... check_reserved=['all'] and it never gave me the > exception in SQLite but as soon as I switched it started giving me this. > which I believe it shoudl have shown me even when I ws in SQLite. Is that > an issue ? > > * invalid table/column name "state" is a > "ALL" reserved SQL/NOSQL keyword* > > & when I added > > *check_reserved=['postgres', 'postgres_nonreserved'**]* and now it is showing > this error (Which is to the point) > > invalid table/column name "state" is a > "POSTGRES_NONRESERVED" reserved SQL/NOSQL keyword > > > Please suggest how I can get rid of this issue > > 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] Dealing with reserved keywords when you change or upgrade your database from SQLite to POSTGRES
Hello All, I am migrating my project from SQLite to POSTGRESQL - I have a few field names and table names that seem to be a part of reserver/non-serverved POSTGRES keywords - For example, field name = *state (Field('state', .. )*, *Field('notify', 'boolean', label='Add Notification?', ), * Now I get below errors as highlighted below *My question is *- Is there a work around to make these names work some how ? (backticks or something I found on the web but how do I use it under DAL ? ) Also, I could not find anything about *rname* in the web2py documentation.. Any idea if / how it can help in this case ? *Ironically - * Initially I had db= ... check_reserved=['all'] and it never gave me the exception in SQLite but as soon as I switched it started giving me this. which I believe it shoudl have shown me even when I ws in SQLite. Is that an issue ? * invalid table/column name "state" is a "ALL" reserved SQL/NOSQL keyword* & when I added *check_reserved=['postgres', 'postgres_nonreserved'**]* and now it is showing this error (Which is to the point) invalid table/column name "state" is a "POSTGRES_NONRESERVED" reserved SQL/NOSQL keyword Please suggest how I can get rid of this issue 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.
Re: [web2py] Re: passing variables to plugin_layout view - plugin_layouts\layouts\
Yes this works! I've modified the code accordingly. Thanks! Anthony On Fri, Jun 8, 2018 at 11:12 AM, Rahul Dhakate wrote: > Oh I see. I'll check this out and modify the code if required. Thanks! for > the tip. > > Thanks & Regards, > > Rahul > > On Thu, Jun 7, 2018 at 5:53 PM, Anthony wrote: > >> Note, you do not have to declare the variable as global in the model. All >> objects defined in models are added to the web2py global environment, which >> is available to every view. >> >> 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 a topic in the >> Google Groups "web2py-users" group. >> To unsubscribe from this topic, visit https://groups.google.com/d/to >> pic/web2py/aSS6oa09Dbs/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.
Re: [web2py] Re: passing variables to plugin_layout view - plugin_layouts\layouts\
Oh I see. I'll check this out and modify the code if required. Thanks! for the tip. Thanks & Regards, Rahul On Thu, Jun 7, 2018 at 5:53 PM, Anthony wrote: > Note, you do not have to declare the variable as global in the model. All > objects defined in models are added to the web2py global environment, which > is available to every view. > > 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 a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/web2py/aSS6oa09Dbs/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] Re: Google wallet widget wont initialize on the page
Hey Anybody, Any idea how to do this ? I've paid google back in December for this but am yet to get a working prototype for payment. Rahul On Tuesday, December 26, 2017 at 4:17:54 PM UTC+5:30, Rahul wrote: > > Hi Massimo, Everyone, > Merry Christmas! > > ##Following is the code from google_wallet.py > from gluon import XML > > def button(merchant_id="123456783432215", >products=[dict(name="shoes", > quantity=1, > price=23.5, > currency='USD', > description="running shoes black")]): > t = ' value="%(value)s"/>\n' > list_products = '' > for k, product in enumerate(products): > for key in ('name','description','quantity','price','currency'): > list_products += t % dict(k=k + 1, key=key, value=product[key > ]) > button = """ id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" > target="_top">\n%(list_products)s value="utf-8"/>\nhttps://checkout.google.com/buttons/buy.gif?merchant_id=%(merchant_id)sw=117h=48style=whitevariant=textloc=en_US" > > type="image"/>\n""" % dict(merchant_id=merchant_id, > list_products=list_products) > return XML(button) > > > Some how I did not get this error earlier but now it is giving me this > error. Seems like it is not able to find XML module in gluon. > global name 'XML' is not defined > > Rahul > > > On Sunday, December 24, 2017 at 9:57:12 PM UTC+5:30, Massimo Di Pierro > wrote: >> >> That functionality has been implemented so long ago that I would not be >> surprised if it does not work any more. We should probably simply eliminate >> from contrib. >> >> On Wednesday, 20 December 2017 01:02:36 UTC-6, Rahul wrote: >>> >>> Hi All, >>> I am trying to integrate and utilize the basic functionality for >>> "Google Wallet" for my web2py app and following the instructions given in >>> the online book. I've my own merchant ID and I have registered with >>> Google. but the problem is that it does not seem to initialize the widget >>> on the HTML page. It just shows and placeholder and when I click on it, it >>> shows below err - >>> >>> 404. That’s an error. >>> The requested URL /api/checkout/v2/checkoutForm/Merchant/ >>> was not found on this server. That’s all we know. >>> >>> *Code in the view *- (Ofcourse merchant_id I used the one google >>> provided me. ) >>> >>> {{from gluon.contrib.google_wallet import button}} >>> {{=button(merchant_id="123456789012345", >>>products=[dict(name="shoes", >>> quantity=1, >>> price=23.5, >>> currency='USD', >>> description="running shoes black")])}} >>> >>> I am using web2py version 2.15.3 - Any help/pointers for this would be >>> greatly appreciated. Does the code need to be updated or changed ? >>> >>> Regards, 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.
Re: [web2py] Re: passing variables to plugin_layout view - plugin_layouts\layouts\
Hi Anthony, I accomplished this via model - Thanks! for pointing. Below is the sample logic *All written In Model* > global user_right1 > user_right1=False # Default value provided > code written to retrieve actual values and set the user_right1= In layout.html (whatever name of the layout be) I passed this variable > {{if user_right1 ==True:}} > Show the HTML stub > {{pass}} > Done Thanks, *Rahul * On Wed, Jun 6, 2018 at 6:57 PM, Anthony wrote: > Keep in mind that the layout is executed for every page (that extends it), > so only defining that variable in the dashboard function will not work, as > it will remain undefined otherwise. Declaring the variable as global within > the dashboard function has no effect because each HTTP request executes the > models, controller, and view in a fresh environment. Instead, you should > either set a default value for user_right1 in a model file or directly in > the layout. In the layout, you can do something like: > > {{if globals().get('user_right1', False):}} > > The above will check if 'user_right1' is defined in the current global > environment (for the current request), and if not, it returns a default > value of False. > > Anthony > > On Wednesday, June 6, 2018 at 6:05:44 AM UTC-4, Rahul wrote: >> >> Hi Anthony, >> Thanks for getting back - I understood your point. I included it >> in one of my functions and called it where it worked. for example I called >> it in dashboard() function which is used to show the dashboard and is the >> first landing page of my application. However now whenever I want to >> navigate to some other page it gives me the following error - Basically it >> is the same error I got before. It is trying to fetch value of user_right1 >> . >> I have even defined* user_right1* as global and provided a default value >> for example >> >> global user_right1 >> user_right1=False >> >> *Error*: >> 127.0.0.1.2018-06-06.15-16-08.ba03dfb3-628e-42bf-9b34-fe8a6d34c5ec >> * name 'user_right1' is not defined* >> Version >> >> web2py™ >> Version 2.15.3-stable+timestamp.2017.08.07.12.51.45 >> >> Python >> Python 2.7.13: C:\Python27\python.exe (prefix: C:\Python27) >> >> Traceback >> >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> >> Code in my controller is pretty simple it retrieves the value stored in >> the database and checks whether it is *True *or *False *and based on the >> value it provides module access to the users >> *default.py * >> >> global user_right1 >> user_right1 = False >> >> def dashboard(): >> ##Code to retrieve the value >> user_right1=True >> return dict(user_right1=user_right1) >> >> >> >> in my *layout *page - *sbadmin2_layout.html - Remember this is the >> layout page * >> >> {{if patchmanRight==True:}} >> . >> -- >> -- Show few modules else not >> >> {{pass}} >> >> What could be done to fix this issue as it will keep on giving me this >> error for every other navigation in the application unless it is >> dashboard.html ? >> >> Thanks! >> Rahul D. >> >> >> >> >> On Tuesday, June 5, 2018 at 7:21:41 PM UTC+5:30, Anthony wrote: >> On Tuesday, June 5, 2018 at 7:34:38 AM UTC-4, Rahul wrote: >> Hi A >> >>> >>>> ll, >>>> I am visiting this group after a long time. I have a question >>>> perhaps a simple one - I want to check for user rights for my application >>>> and I want to code it in plugin layout (any_layout_installed.html ) file. >>>> I am trying to verify parameters passed to this file. I can pass session >>>> variables and check for the rights however one drawback is that if I change >>>> the value from say True to False, it does not refresh this for the session >>>> variable. I must restart the browser to get rid of this previously >>>> initialized session variable. So I want to know if there is away to do this >>>> with some local variables (pass local variables) and if these could be >>>> called in the view (*plugin_layouts\layouts\*) >>>> >>>> for example in layout view - >>>> {{if user_right1==True:}} >>>> >>>> >>>> {{pass}} >>>> >>>> >>>> >>>> The question is where (in which function in the controller ) do I >>>> specify this value *user_right1* to use it in &g
[web2py] Re: passing variables to plugin_layout view - plugin_layouts\layouts\
Hi Anthony, Thanks for getting back - I understood your point. I included it in one of my functions and called it where it worked. for example I called it in dashboard() function which is used to show the dashboard and is the first landing page of my application. However now whenever I want to navigate to some other page it gives me the following error - Basically it is the same error I got before. It is trying to fetch value of user_right1 . I have even defined* user_right1* as global and provided a default value for example global user_right1 user_right1=False *Error*: 127.0.0.1.2018-06-06.15-16-08.ba03dfb3-628e-42bf-9b34-fe8a6d34c5ec * name 'user_right1' is not defined* Version web2py™ Version 2.15.3-stable+timestamp.2017.08.07.12.51.45 Python Python 2.7.13: C:\Python27\python.exe (prefix: C:\Python27) Traceback 1. 2. 3. 4. 5. 6. Code in my controller is pretty simple it retrieves the value stored in the database and checks whether it is *True *or *False *and based on the value it provides module access to the users *default.py * global user_right1 user_right1 = False def dashboard(): ##Code to retrieve the value user_right1=True return dict(user_right1=user_right1) in my *layout *page - *sbadmin2_layout.html - Remember this is the layout page * {{if patchmanRight==True:}} . -- -- Show few modules else not {{pass}} What could be done to fix this issue as it will keep on giving me this error for every other navigation in the application unless it is dashboard.html ? Thanks! Rahul D. On Tuesday, June 5, 2018 at 7:21:41 PM UTC+5:30, Anthony wrote: On Tuesday, June 5, 2018 at 7:34:38 AM UTC-4, Rahul wrote: Hi A > >> ll, >> I am visiting this group after a long time. I have a question >> perhaps a simple one - I want to check for user rights for my application >> and I want to code it in plugin layout (any_layout_installed.html ) file. >> I am trying to verify parameters passed to this file. I can pass session >> variables and check for the rights however one drawback is that if I change >> the value from say True to False, it does not refresh this for the session >> variable. I must restart the browser to get rid of this previously >> initialized session variable. So I want to know if there is away to do this >> with some local variables (pass local variables) and if these could be >> called in the view (*plugin_layouts\layouts\*) >> >> for example in layout view - >> {{if user_right1==True:}} >> >> >> {{pass}} >> >> >> >> The question is where (in which function in the controller ) do I specify >> this value *user_right1* to use it in >> *plugin_layouts\layouts\* ?? I hope I am clear >> with my question. >> > > The variable user_right1 must either be defined in a model file or > returned in the dictionary by the controller: > > def myfunction(): > ... > return dict(user_right1=True, ...) > > 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] passing variables to plugin_layout view - plugin_layouts\layouts\
Hi All, I am visiting this group after a long time. I have a question perhaps a simple one - I want to check for user rights for my application and I want to code it in plugin layout (any_layout_installed.html ) file. I am trying to verify parameters passed to this file. I can pass session variables and check for the rights however one drawback is that if I change the value from say True to False, it does not refresh this for the session variable. I must restart the browser to get rid of this previously initialized session variable. So I want to know if there is away to do this with some local variables (pass local variables) and if these could be called in the view (*plugin_layouts\layouts\*) for example in layout view - {{if user_right1==True:}} {{pass}} The question is where (in which function in the controller ) do I specify this value *user_right1* to use it in *plugin_layouts\layouts\* ?? I hope I am clear with my question. *Also,* I was waiting for an answer on this one - Google wallet widget wont initialize on the page [https://groups.google.com/forum/#!searchin/web2py/google$20checkout%7Csort:date/web2py/XrvpOFDD-rk/I9r7hFk-AwAJ ] Thanks! Rahul D. -- 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: Parsing and Inserting data from a python dictionary into a database table using DAL
Thank you! very much Anthony. That hint saved me a lot of time - The following code worked fine. allrecords = c.payment.all() # Fetches all the records for myrecord in allrecords['items']: webdbase.database.insert(. Just a few words about the project. I am working with integrating a new payment gateway in web2py app and hope to publish a new slice once it is successfully completed. Thanks! again Rahul. On Friday, January 12, 2018 at 7:38:51 AM UTC+5:30, Anthony wrote: > > On Thursday, January 11, 2018 at 6:39:38 AM UTC-5, Rahul wrote: >> >> Thanks! Anthony for guiding me on this. Always #1 for helping us out. >> Now there is one last thing and it may be trivial but can you point me to >> the right direction. I used below notation. This works fine if I have a >> single record >> db.mytable.insert(field1=record['field1'], field2=record[ >> 'field2_alt_spelling'], ...) >> >> However, if I have multiple records, it fails with a type error given >> below >> TypeError: string indices must be integers >> >> *Data is in this format - * >> {u'count': 6, u'items': [{u'refund_status': None, u'tax': None, >> u'entity': u'payment', u'currency': u'INR', u'id': u'Tq99121U7', >> u'captured': False, u'fee': None, u'international': False, u'email': >> u'he...@gmail.com ', u'status': u'failed', >> u'amount_refunded': 0, u'description': u'Purchase Description', >> u'order_id': None, u'vpa': None, u'bank': None, u'invoice_id': None, >> u'notes': [], u'card_id': u'311645', u'method': u'card', u'wallet': None, >> u'amount': 100, u'contact': u'7001394', u'error_description': u'Payment >> failed', u'error_code': u'BAD_REQUEST_ERROR', u'created_at': 15138345825}, >> {u'refund_status': ..}, >> {u'refund_status': None, 1513940199} , >> {u'refund_status': None, u'created_at': 1513738859}, >> > > Hard to say what the problem is without seeing your code, but your records > are a list embedded in a dictionary, so you need to extract the list and > loop over it: > > for record in data['items']: > db.mytable.insert(field1=record['field1'], ...) > > 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: Parsing and Inserting data from a python dictionary into a database table using DAL
Thanks! Anthony for guiding me on this. Always #1 for helping us out. Now there is one last thing and it may be trivial but can you point me to the right direction. I used below notation. This works fine if I have a single record db.mytable.insert(field1=record['field1'], field2=record[ 'field2_alt_spelling'], ...) However, if I have multiple records, it fails with a type error given below TypeError: string indices must be integers *Data is in this format - * {u'count': 6, u'items': [{u'refund_status': None, u'tax': None, u'entity': u'payment', u'currency': u'INR', u'id': u'Tq99121U7', u'captured': False, u'fee': None, u'international': False, u'email': u'help...@gmail.com', u'status': u'failed', u'amount_refunded': 0, u'description': u'Purchase Description', u'order_id': None, u'vpa': None, u'bank': None, u'invoice_id': None, u'notes': [], u'card_id': u'311645', u'method': u'card', u'wallet': None, u'amount': 100, u'contact': u'7001394', u'error_description': u'Payment failed', u'error_code': u'BAD_REQUEST_ERROR', u'created_at': 15138345825}, {u'refund_status': ..}, {u'refund_status': None, 1513940199} , {u'refund_status': None, u'created_at': 1513738859}, It is probably expecting integers here. How do I pass values in this case ? Thanks, Rahul. On Wednesday, January 10, 2018 at 10:56:06 PM UTC+5:30, Anthony wrote: > > If you can make the field names in the DAL model match exactly, you can > simply do: > > db.mytable.insert(**db.mytable._filter_fields(record_dict)) > > If you can't change the field names in the database itself but are > comfortable changing the names within your DAL models, you can use the > "rname" option when defining the fields that have mismatched names: > > Field('tax', rname='sales_tax') > > The above would allow you to do inserts using the name "tax", even though > the real field name in the database is "sales_tax". > > Otherwise, I suppose you would just do something like: > > db.mytable.insert(field1=record['field1'], field2=record[ > 'field2_alt_spelling'], ...) > > Anthony > > On Wednesday, January 10, 2018 at 7:48:33 AM UTC-5, Rahul wrote: >> >> Hi All, Massimo >> I am receiving a dictionary of records from a webservice like below >> (sample single record with just a few fields here) . Now I want to parse >> all the records and insert the data in my table (Currently SQLite and later >> it would be POSTGRE) . What is the best way to insert data into SQLite or >> other databases using DAL from following code. I am assuming that since we >> would utilize DAL it might work irrespective of underlying DB. my table >> has similar fields but fieldnames and their order is changed a bit. >> {u'status': None, u'tax': 3.6, u'entity': u'payment', u'currency': u'INR' >> , u'id': u'128934802340', } >> >> >> Thanks in advance for all the help, :-) >> >> 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] Parsing and Inserting data from a python dictionary into a database table using DAL
Hi All, Massimo I am receiving a dictionary of records from a webservice like below (sample single record with just a few fields here) . Now I want to parse all the records and insert the data in my table (Currently SQLite and later it would be POSTGRE) . What is the best way to insert data into SQLite or other databases using DAL from following code. I am assuming that since we would utilize DAL it might work irrespective of underlying DB. my table has similar fields but fieldnames and their order is changed a bit. {u'status': None, u'tax': 3.6, u'entity': u'payment', u'currency': u'INR', u 'id': u'128934802340', } Thanks in advance for all the help, :-) 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: Google wallet widget wont initialize on the page
Hi Massimo, Everyone, Merry Christmas! ##Following is the code from google_wallet.py from gluon import XML def button(merchant_id="123456783432215", products=[dict(name="shoes", quantity=1, price=23.5, currency='USD', description="running shoes black")]): t = '\n' list_products = '' for k, product in enumerate(products): for key in ('name','description','quantity','price','currency'): list_products += t % dict(k=k + 1, key=key, value=product[key]) button = """https://checkout.google.com/api/checkout/v2/checkoutForm/Merchant/%(merchant_id)s" id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" target="_top">\n%(list_products)s\nhttps://checkout.google.com/buttons/buy.gif?merchant_id=%(merchant_id)sw=117h=48style=whitevariant=textloc=en_US" type="image"/>\n""" % dict(merchant_id=merchant_id, list_products=list_products) return XML(button) Some how I did not get this error earlier but now it is giving me this error. Seems like it is not able to find XML module in gluon. global name 'XML' is not defined Rahul On Sunday, December 24, 2017 at 9:57:12 PM UTC+5:30, Massimo Di Pierro wrote: > > That functionality has been implemented so long ago that I would not be > surprised if it does not work any more. We should probably simply eliminate > from contrib. > > On Wednesday, 20 December 2017 01:02:36 UTC-6, Rahul wrote: >> >> Hi All, >> I am trying to integrate and utilize the basic functionality for >> "Google Wallet" for my web2py app and following the instructions given in >> the online book. I've my own merchant ID and I have registered with >> Google. but the problem is that it does not seem to initialize the widget >> on the HTML page. It just shows and placeholder and when I click on it, it >> shows below err - >> >> 404. That’s an error. >> The requested URL /api/checkout/v2/checkoutForm/Merchant/ was >> not found on this server. That’s all we know. >> >> *Code in the view *- (Ofcourse merchant_id I used the one google >> provided me. ) >> >> {{from gluon.contrib.google_wallet import button}} >> {{=button(merchant_id="123456789012345", >>products=[dict(name="shoes", >> quantity=1, >> price=23.5, >> currency='USD', >> description="running shoes black")])}} >> >> I am using web2py version 2.15.3 - Any help/pointers for this would be >> greatly appreciated. Does the code need to be updated or changed ? >> >> Regards, 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] Google wallet widget wont initialize on the page
Hi All, I am trying to integrate and utilize the basic functionality for "Google Wallet" for my web2py app and following the instructions given in the online book. I've my own merchant ID and I have registered with Google. but the problem is that it does not seem to initialize the widget on the HTML page. It just shows and placeholder and when I click on it, it shows below err - 404. That’s an error. The requested URL /api/checkout/v2/checkoutForm/Merchant/ was not found on this server. That’s all we know. *Code in the view *- (Ofcourse merchant_id I used the one google provided me. ) {{from gluon.contrib.google_wallet import button}} {{=button(merchant_id="123456789012345", products=[dict(name="shoes", quantity=1, price=23.5, currency='USD', description="running shoes black")])}} I am using web2py version 2.15.3 - Any help/pointers for this would be greatly appreciated. Does the code need to be updated or changed ? Regards, 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.
Re: [web2py] Re: Getting 404 NOT FOUND error when accessing a few pages of my app.
Hello Everyone, So here I am back and happy to report that my application is now working fine. *Cause *- I cannot pin point the cause as there were no tickets generated. I fixed a function missing for an import function (import string) basically. *What was fixed *- 1. Had to use old stable build (2.5 months old) and upgrade the entire code 2. Code profiling and checking was done for all 14k + lines (line by line ... no mercy :( there ) 3. All updates were done manually (excluding db changes) 4. Again I got "Socket timed out before request" rocket error twice for two modules which was fixed by closing the code block in view by using {{pass}}. Perhaps the parser needs a fix for this. We can mark this thread "Done". Thanks, *Sincerely*, Rahul Dhakate. On Friday, August 18, 2017 at 11:10:33 AM UTC+5:30, Rahul wrote: > > Okay after setting up my project on another machine I am still getting > this error. I am sure that there is something that might have got deleted > or changed accidently in my project. I'll check the same and get back with > the problem and solution. This might take some time though :( > > Thanks, > > Rahul. > > On Wednesday, August 16, 2017 at 12:09:56 AM UTC+5:30, Anthony wrote: >> >> On Tuesday, August 15, 2017 at 7:49:09 AM UTC-4, Rahul wrote: >>> >>> Hi Anthony, >>> Thanks for getting back. No changes were made that would break >>> the system so badly. >>> And although today I did copy the single project on the same machine but >>> with a newly setup web2py 2.15.3. >>> I will try using this project on another machine by configuring it from >>> scratch. >>> >>> Does using routes do any magic to web2py or its app by copying/changing >>> any file for routes as 404 is a strange error to get. >>> >> >> No. The 404 indicates web2py isn't finding the app/controller/function >> identified from the URL after rewrite. >> >> -- 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] Re: Getting 404 NOT FOUND error when accessing a few pages of my app.
Okay after setting up my project on another machine I am still getting this error. I am sure that there is something that might have got deleted or changed accidently in my project. I'll check the same and get back with the problem and solution. This might take some time though :( Thanks, Rahul. On Wednesday, August 16, 2017 at 12:09:56 AM UTC+5:30, Anthony wrote: > > On Tuesday, August 15, 2017 at 7:49:09 AM UTC-4, Rahul wrote: >> >> Hi Anthony, >> Thanks for getting back. No changes were made that would break >> the system so badly. >> And although today I did copy the single project on the same machine but >> with a newly setup web2py 2.15.3. >> I will try using this project on another machine by configuring it from >> scratch. >> >> Does using routes do any magic to web2py or its app by copying/changing >> any file for routes as 404 is a strange error to get. >> > > No. The 404 indicates web2py isn't finding the app/controller/function > identified from the URL after rewrite. > > -- 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] Re: Getting 404 NOT FOUND error when accessing a few pages of my app.
Hi Jim, I have overridden a lot of default web2py stuff and used my own instead. Just wanted to have it work my way but I wouldn't mind using web2py decorators in future projects. Yes I am looking for such patterns but so far there isn't anything I found causing this. Thanks, Rahul. On Aug 15, 2017 17:25, "Jim Steil" <ato.st...@gmail.com> wrote: I don't know if it has anything to do with the problem, but am curious why you have your checksession() function and don't use the web2py decorators for ensuring a user is logged in. http://web2py.com/books/default/chapter/29/09/access-control#Decorators Is there a common use pattern in the 20+ failing functions that isn't used in the functions that are still working? -Jim On Tue, Aug 15, 2017 at 6:48 AM, Rahul Dhakate <rahul.dhak...@gmail.com> wrote: > Hi Anthony, > Thanks for getting back. No changes were made that would break > the system so badly. > And although today I did copy the single project on the same machine but > with a newly setup web2py 2.15.3. > I will try using this project on another machine by configuring it from > scratch. > > Does using routes do any magic to web2py or its app by copying/changing > any file for routes as 404 is a strange error to get. Again there was a > plugin called like hot table or something which I had installed online from > plugin links and later removed it suspecting it might be the culprit but to > no avail. > > Thanks, > > Rahul. > > === > > On Aug 15, 2017 17:02, "Anthony" <abasta...@gmail.com> wrote: > > If you've removed the routes files and restarted the server and still have > problems, it's not clear what would be causing some but not all of your > URLs to stop working, assuming you've made no other changes to the system. > You may need to set up everything from scratch. Do you have another machine > you could try? > > Also, if you just want to set up a particular application (and controller > and function) as defaults, it is much simply to use the parameter-based > rewrite system. > > Anthony > > > On Tuesday, August 15, 2017 at 4:50:37 AM UTC-4, Rahul wrote: >> >> Hi Anthony, Jim, >> The application is not compiled. I was trying to use routes >> files attached (applevel and web2py level) which I removed completely and >> still the error persists. They are not even in the application directory. I >> do think that before using the routes the application was working fine. >> >> Here is the code for one function. There are multiple functions failing >> almost 20+ which were all working flawlessly before. No changes done to >> these. >> >> Function in default.py controller >> def cat_grid(): >> # Security Check: Checks for a valid session >> checksession() >> ## New Category Grid >> db.cat.id.readable=False >> ### Query >> query = db((db.cat.workspace == user_workspace)) >> >> fields = (db.cat.categories, db.cat.workspace, ) >> headers = {'cat.catagories' : 'Category Name', >>'cat.workspace' : 'Workspace', >> >>} >> default_sort_order = [~db.cat.categories ] >> >> links = [ >> lambda row: A(SPAN(_class='icon magnifier'),'View',_class='btn >> btn-small btn-default', _title='View Record',_href=URL("default","v >> iew_cat",args=[row.id])), >> lambda row: A(SPAN(_class='icon downarrow'),'Update',_class= >> 'btn btn-small btn-default', _title='Update Record',_href=URL("default", >> "update_cat",args=[row.id])), >> lambda row: A(SPAN(_class='icon downarrow'),'Delete',_class= >> 'btn btn-small btn-danger', _title='Delete Record',_href=URL("default","d >> elete_cat",args=[row.id])), >> ] >> catgrid = SQLFORM.grid( query=query, fields=fields, headers=headers, >> orderby=default_sort_order, user_signature=False, searchable=True, >> sorter_icons=(XML(''), XML('')), >> create=False, deletable=False, editable=False, >> csv=True, maxtextlength=64, paginate=10 ,ui='jquery-ui', links=links, >> details=False) >> >> #form category >> form_cat=SQLFORM(db.cat, submit_button='Save Category') >> if form_cat.accepts(request.vars,session): >> response.flash='New Category Added' >> elif form_cat.errors: >> response.flash='Form has errors' >> else: pass >> >> return dict(catgrid=catgrid, form_cat=form_cat) >> >> >> Chec
Re: [web2py] Re: Getting 404 NOT FOUND error when accessing a few pages of my app.
Hi Anthony, Thanks for getting back. No changes were made that would break the system so badly. And although today I did copy the single project on the same machine but with a newly setup web2py 2.15.3. I will try using this project on another machine by configuring it from scratch. Does using routes do any magic to web2py or its app by copying/changing any file for routes as 404 is a strange error to get. Again there was a plugin called like hot table or something which I had installed online from plugin links and later removed it suspecting it might be the culprit but to no avail. Thanks, Rahul. === On Aug 15, 2017 17:02, "Anthony" <abasta...@gmail.com> wrote: If you've removed the routes files and restarted the server and still have problems, it's not clear what would be causing some but not all of your URLs to stop working, assuming you've made no other changes to the system. You may need to set up everything from scratch. Do you have another machine you could try? Also, if you just want to set up a particular application (and controller and function) as defaults, it is much simply to use the parameter-based rewrite system. Anthony On Tuesday, August 15, 2017 at 4:50:37 AM UTC-4, Rahul wrote: > > Hi Anthony, Jim, > The application is not compiled. I was trying to use routes > files attached (applevel and web2py level) which I removed completely and > still the error persists. They are not even in the application directory. I > do think that before using the routes the application was working fine. > > Here is the code for one function. There are multiple functions failing > almost 20+ which were all working flawlessly before. No changes done to > these. > > Function in default.py controller > def cat_grid(): > # Security Check: Checks for a valid session > checksession() > ## New Category Grid > db.cat.id.readable=False > ### Query > query = db((db.cat.workspace == user_workspace)) > > fields = (db.cat.categories, db.cat.workspace, ) > headers = {'cat.catagories' : 'Category Name', >'cat.workspace' : 'Workspace', >} > default_sort_order = [~db.cat.categories ] > > links = [ > lambda row: A(SPAN(_class='icon magnifier'),'View',_class='btn > btn-small btn-default', _title='View Record',_href=URL("default","v > iew_cat",args=[row.id])), > lambda row: A(SPAN(_class='icon downarrow'),'Update',_class= > 'btn btn-small btn-default', _title='Update Record',_href=URL("default","u > pdate_cat",args=[row.id])), > lambda row: A(SPAN(_class='icon downarrow'),'Delete',_class= > 'btn btn-small btn-danger', _title='Delete Record',_href=URL("default","d > elete_cat",args=[row.id])), > ] > catgrid = SQLFORM.grid( query=query, fields=fields, headers=headers, > orderby=default_sort_order, user_signature=False, searchable=True, > sorter_icons=(XML(''), XML('')), > create=False, deletable=False, editable=False, > csv=True, maxtextlength=64, paginate=10 ,ui='jquery-ui', links=links, > details=False) > > #form category > form_cat=SQLFORM(db.cat, submit_button='Save Category') > if form_cat.accepts(request.vars,session): > response.flash='New Category Added' > elif form_cat.errors: > response.flash='Form has errors' > else: pass > > return dict(catgrid=catgrid, form_cat=form_cat) > > > Checksession only checks for basic session validity and redirects the user > to a certain url. > def checksession(): > > if(logged_in_user==None): > redirect(URL(r=request, f='login')) > #print "Errors! No sesions defined." > else: > pass > > View is simple cat_grid.html in this case and is available > in views\default\ folder > > {{extend 'layout.html'}} > > > > > > > > > Category List > > > > Actions > > > role="menu"> > href="{{=URL('Target','default', 'configure_target')}}">Back > > > > > > > > > > &g
[web2py] Re: Getting 404 NOT FOUND error when accessing a few pages of my app.
Hi Anthony, Jim, The application is not compiled. I was trying to use routes files attached (applevel and web2py level) which I removed completely and still the error persists. They are not even in the application directory. I do think that before using the routes the application was working fine. Here is the code for one function. There are multiple functions failing almost 20+ which were all working flawlessly before. No changes done to these. Function in default.py controller def cat_grid(): # Security Check: Checks for a valid session checksession() ## New Category Grid db.cat.id.readable=False ### Query query = db((db.cat.workspace == user_workspace)) fields = (db.cat.categories, db.cat.workspace, ) headers = {'cat.catagories' : 'Category Name', 'cat.workspace' : 'Workspace', } default_sort_order = [~db.cat.categories ] links = [ lambda row: A(SPAN(_class='icon magnifier'),'View',_class='btn btn-small btn-default', _title='View Record',_href=URL("default","view_cat", args=[row.id])), lambda row: A(SPAN(_class='icon downarrow'),'Update',_class='btn btn-small btn-default', _title='Update Record',_href=URL("default", "update_cat",args=[row.id])), lambda row: A(SPAN(_class='icon downarrow'),'Delete',_class='btn btn-small btn-danger', _title='Delete Record',_href=URL("default", "delete_cat",args=[row.id])), ] catgrid = SQLFORM.grid( query=query, fields=fields, headers=headers, orderby=default_sort_order, user_signature=False, searchable=True, sorter_icons=(XML(''), XML('')), create=False, deletable=False, editable=False, csv =True, maxtextlength=64, paginate=10 ,ui='jquery-ui', links=links, details=False) #form category form_cat=SQLFORM(db.cat, submit_button='Save Category') if form_cat.accepts(request.vars,session): response.flash='New Category Added' elif form_cat.errors: response.flash='Form has errors' else: pass return dict(catgrid=catgrid, form_cat=form_cat) Checksession only checks for basic session validity and redirects the user to a certain url. def checksession(): if(logged_in_user==None): redirect(URL(r=request, f='login')) #print "Errors! No sesions defined." else: pass View is simple cat_grid.html in this case and is available in views\default\ folder {{extend 'layout.html'}} Category List Actions Back Category List New Category {{=catgrid}} {{=form_cat}} {{pass}} {{pass}} Note: I even uninstalled and updated my python version 2.7.13 (latest 2.7.x version). Also now I have just tried with latest web2py version 2.15.3. IE11 cache cleared. Same results on chrome. Let me know what might have gone wrong. Thanks, Rahul On Monday, August 14, 2017 at 8:11:22 PM UTC+5:30, Anthony wrote: > > Has the app been compiled? What happens if you reload routes or restart > the web server? > > On Monday, August 14, 2017 at 8:53:51 AM UTC-4, Rahul wrote: >> >> Hi All, >>I have an app and Off late I am strangely getting below error when >> accessing a page. I have the cat_grid function in by controller(default.py) >> as well have* .html *file in views. >> >>1. Request URL: >>http://127.0.0.1:8000/Target/default/cat_grid >>2. Request Method: >>GET >>3. Status Code: >>404 NOT FOUND >>4. Remote Address: >>127.0.0.1:8000 >>5. Referrer Policy: >>no-referrer-when-downgrade >> >> I see this in the browser (chrome) >> invalid function (default/cat_grid) >>
[web2py] Getting 404 NOT FOUND error when accessing a few pages of my app.
Hi All, I have an app and Off late I am strangely getting below error when accessing a page. I have the cat_grid function in by controller(default.py) as well have* .html *file in views. 1. Request URL: http://127.0.0.1:8000/Target/default/cat_grid 2. Request Method: GET 3. Status Code: 404 NOT FOUND 4. Remote Address: 127.0.0.1:8000 5. Referrer Policy: no-referrer-when-downgrade I see this in the browser (chrome) invalid function (default/cat_grid) It was all working previously. However I am not sure how come I am getting this error for almost 60% of my functions. No ticket is thrown. I am confused as to what got changed. I am using web2py 2.14.6 stable. I did install a few plugins and then removed those too. but this is really annoying as I cannot figure out why it aint working. Please suggest this is killing me and my time badly. Any help and pointers would be highly appreciated. Rahul D. -- 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] Sites Powered by web2py
Hi There, Even I had the same problem - I wanted to list my site up there - http://www.artpic.in/ but somehow I cannot do that. It's already up for almost a year. Next month it would be expiring (unless I renew i.e. ;-) ) . Please fix this area. Thanks! Rahul D. On Tuesday, April 4, 2017 at 12:43:57 AM UTC+5:30, Mathieu Clabaut wrote: > > Yep, > > Same problem here. I was unable to submit one ans stumble upon an > exception. > > On Sun, Apr 2, 2017 at 10:58 PM Alex <mrau...@gmail.com > > wrote: > >> The section for "Sites Powered by web2py" does not look very promising >> and also seems outdated. Most pages don't have a screenshot and some of >> them are not even working anymore. When I try to visit the first site I get >> a link to an internal error ticket. >> >> Submitting a new page does not work. We tried to add our website but it >> does not show up. Maybe you want to add it: https://breedarchive.com >> >> Further I'd encourage you to completely restructure the powered by >> section because the current page probably has the opposite desired effect >> and scares off new visitors. Hundreds of applications, many of them with >> questionable content, is not really helpful. It would be much better to >> only show a very small selection (~5) of high quality web2py sites. Each >> one with a screenshot and a short description. >> >> regards, >> Alex >> >> -- >> 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+un...@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] Re: Order of form.vars not same as they appear in form
Yes form.fields works! Thank you very much On 13 January 2017 at 01:12, Anthony <abasta...@gmail.com> wrote: > form.vars is a dict-like object, so not guaranteed to return keys in any > particular order. If the form is based on a db table, you can iterate > through db.table._fields. The form object also includes the list of field > names in form.fields. > > Anthony > > > On Thursday, January 12, 2017 at 1:37:03 PM UTC-5, Rahul Priyadarsi wrote: >> >> Currently I see that the order in which the fields appear in form is not >> same when i iterate through form.vars >> I am using SQLFORM. >> >> So how do I get the form.vars so that they appear in same order as they >> do on the form? >> > -- > 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/fZygOaWseek/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. > -- *Cheers,* *RAHUL PRIYADARSI* -- 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] Order of form.vars not same as they appear in form
Currently I see that the order in which the fields appear in form is not same when i iterate through form.vars I am using SQLFORM. So how do I get the form.vars so that they appear in same order as they do on the form? -- 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: Invalid SQLFORM submit generates ticket instead of redirecting back to form with errors
Thanks for the reply @Antony. When I posted this question on this Forum, i did not see it appear so I thought something must be wrong with google groups itself. Hence I posted on stackoverflow. On Wednesday, January 11, 2017 at 5:35:18 AM UTC+5:30, Anthony wrote: > > FYI, already answered on SO: http://stackoverflow.com/a/41554743/440323 > > Anthony > > On Tuesday, January 10, 2017 at 6:07:17 PM UTC-5, Rahul Priyadarsi wrote: >> >> Here is my db.py: >> >> db.define_table('antenna_details', >> Field('antenna_name',required=True), >> Field('model_name',required=True), >> Field('project_name',required=True), >> Field('frequency_band',required=True), >> Field('polarization',required=True), >> Field('aperture_size',required=True), >> Field('fixer_availability',required=True), >> Field('weight',required=True), >> Field('material',required=True), >> >> Field('email_id',required=True,unique=True,requires=[IS_NOT_IN_DB]), >> Field('subject',type='text',required=True), >> Field('attached',type='upload', label=""" >> Antenna/feed Geometry >> Electrical specification >> Attach Simulated data in predicted form >> """) >> ) >> >> db.antenna_details.email_id.requires=[IS_EMAIL(),IS_NOT_EMPTY()] >> db.antenna_details.attached.requires=IS_NOT_EMPTY() >> db.antenna_details.subject.rquires=IS_NOT_EMPTY() >> db.antenna_details.material.requires=IS_NOT_EMPTY() >> db.antenna_details.weight.requires=IS_NOT_EMPTY() >> db.antenna_details.fixer_availability.requires=IS_NOT_EMPTY() >> db.antenna_details.aperture_size.requires=IS_NOT_EMPTY() >> db.antenna_details.polarization.requires=IS_NOT_EMPTY() >> db.antenna_details.frequency_band.requires=IS_NOT_EMPTY() >> db.antenna_details.project_name.requires=IS_NOT_EMPTY() >> db.antenna_details.model_name.requires=IS_NOT_EMPTY() >> >> >> And I am using SQLFORM to create a form for it: >> >> def index(): >> """ >> example action using the internationalization operator T and flash >> rendered by views/default/index.html or views/generic.html >> >> if you need a simple wiki simply replace the two lines below with: >> return auth.wiki() >> """ >> # response.flash = T("Hello World") >> # return dict(message=T('Welcome to web2py!')) >> >> form = SQLFORM(db.antenna_details).process() >> >> if form.process().accepted: >> response.flash = 'your data is posted' >> >> return dict(form=form) >> >> My problem is that when I submit a form with duplicate email id(that >> already exists in db), instead of redirecting back to form and showing the >> error, it generates a ticket like this: >> >> column email_id is not unique >> >> While if I submit with empty fields, it simply redirects to the form and >> shows errors besides the respective input tags in red. >> Why is it happening like this for email_id field only? And how do I >> disable this to show error messages in form itself? >> > -- 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] Invalid SQLFORM submit generates ticket instead of redirecting back to form with errors
Here is my db.py: db.define_table('antenna_details', Field('antenna_name',required=True), Field('model_name',required=True), Field('project_name',required=True), Field('frequency_band',required=True), Field('polarization',required=True), Field('aperture_size',required=True), Field('fixer_availability',required=True), Field('weight',required=True), Field('material',required=True), Field('email_id',required=True,unique=True,requires=[IS_NOT_IN_DB]), Field('subject',type='text',required=True), Field('attached',type='upload', label=""" Antenna/feed Geometry Electrical specification Attach Simulated data in predicted form """) ) db.antenna_details.email_id.requires=[IS_EMAIL(),IS_NOT_EMPTY()] db.antenna_details.attached.requires=IS_NOT_EMPTY() db.antenna_details.subject.rquires=IS_NOT_EMPTY() db.antenna_details.material.requires=IS_NOT_EMPTY() db.antenna_details.weight.requires=IS_NOT_EMPTY() db.antenna_details.fixer_availability.requires=IS_NOT_EMPTY() db.antenna_details.aperture_size.requires=IS_NOT_EMPTY() db.antenna_details.polarization.requires=IS_NOT_EMPTY() db.antenna_details.frequency_band.requires=IS_NOT_EMPTY() db.antenna_details.project_name.requires=IS_NOT_EMPTY() db.antenna_details.model_name.requires=IS_NOT_EMPTY() And I am using SQLFORM to create a form for it: def index(): """ example action using the internationalization operator T and flash rendered by views/default/index.html or views/generic.html if you need a simple wiki simply replace the two lines below with: return auth.wiki() """ # response.flash = T("Hello World") # return dict(message=T('Welcome to web2py!')) form = SQLFORM(db.antenna_details).process() if form.process().accepted: response.flash = 'your data is posted' return dict(form=form) My problem is that when I submit a form with duplicate email id(that already exists in db), instead of redirecting back to form and showing the error, it generates a ticket like this: column email_id is not unique While if I submit with empty fields, it simply redirects to the form and shows errors besides the respective input tags in red. Why is it happening like this for email_id field only? And how do I disable this to show error messages in form itself? -- 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] Re: Dynamic path built for a .svg file using uuid and passing the constructed path to view not working
Yes. That was code copied from my previous code for trial and error code stubs. Agreed - Less is more. Rahul. On Wednesday, June 22, 2016 at 2:58:12 PM UTC+5:30, Nico de Groot wrote: > > Hi Rahul, > > You're welcome. Remarks: The triple double quotes are for multiline > strings. Just use one pair of double or single quotes. And you can remove > the parentheses, not needed here. Less is more. > > Nico > > Op woensdag 22 juni 2016 heeft Rahul <rahul@gmail.com > > het volgende geschreven: > >> Hi Nico, >> Thanks! for your support - Here's how I was finally achieved it. >> Hardcoded the partial path as below in the controller >> dynamicLinechartpath = ("""/ApplicationName/static/charts/""" + >> unique_filename )Enter code here... >> >> In the view, you dont need to use the URL parameter - >> DLC is passed to the view which is nothing but dynamicLinechartpath >> variable. >> >> >> >> > "{{=DLC}}" /> >> >> >> This constructed the proper path in the view. >> >> Thanks, Rahul >> >> On Monday, June 20, 2016 at 4:55:51 PM UTC+5:30, Nico de Groot wrote: >>> >>> The {{=...}} is meant to be used inside the view. You are using it also >>> in the controller. Just use the URL() there to get back a path as a string. >>> Send the resulting var to the view as you are already doing. >>> If you inspect the rendered HTML you'll understand the difference. >>> >>> Nico >>> >> -- >> 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/oUafNyAufTI/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] Re: Dynamic path built for a .svg file using uuid and passing the constructed path to view not working
Hi Nico, Thanks! for your support - Here's how I was finally achieved it. Hardcoded the partial path as below in the controller dynamicLinechartpath = ("""/ApplicationName/static/charts/""" + unique_filename )Enter code here... In the view, you dont need to use the URL parameter - DLC is passed to the view which is nothing but dynamicLinechartpath variable. This constructed the proper path in the view. Thanks, Rahul On Monday, June 20, 2016 at 4:55:51 PM UTC+5:30, Nico de Groot wrote: > > The {{=...}} is meant to be used inside the view. You are using it also in > the controller. Just use the URL() there to get back a path as a string. > Send the resulting var to the view as you are already doing. > If you inspect the rendered HTML you'll understand the difference. > > Nico > -- 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: Dynamic path built for a .svg file using uuid and passing the constructed path to view not working
Thanks! Nico, But it does not work. I used urllib to decode the dynamically passed url to 'utf8' however it seems like I would have to pass a few more iterations to normalize the url. Here is what is shown when I inspect the element. is the problem area. Thanks! Rahul On Monday, June 20, 2016 at 12:18:48 PM UTC+5:30, Nico de Groot wrote: > > Please check the rendered html in the browser. Then you can see what's > going on. Maybe you need the host=True in URL() to get a full path. > > Nico de Groot > > -- 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: Dynamic path built for a .svg file using uuid and passing the constructed path to view not working
Hi All - Any updates to this issue ? Rahul. On Friday, June 17, 2016 at 3:55:37 PM UTC+5:30, Rahul wrote: > > Hi All, >I am using uuid to create new temporary files for PYGAL chart. > Although I can see the file being created and available in the file system. > Even I can view the file in the browser, however when I serialize the path > variable to be passed to the view, I get an error - A 404 not found error > is shown inside a frame in my view. How do I serialize the path at runtime > to src= in the view such that it should take the path that I have > constructed using dynamicLinechartpath.. ? Below is the code > > unique_filename = (str(uuid.uuid4()) +'.svg') > ##...other code > ## This creates the file in the file system > linechart.render_to_file(os.path.join(request.folder,'static/charts/' + > unique_filename)) > > ## Constructing the path to pass to the view > dynamicLinechartpath = (""" "{{=URL(r=request, c='static', f='charts/""" > + unique_filename + """')}}" """) > > > > Calling the path in view - > > > > > I have tried > src="{{=dynamicLinechartpath}} > but it does not work. Is this proper approach ? What am I doing wrong? > Here is what 'response.flash' shows me in my view when I try to check what > is being passed. which I think is looking good. > "{{=URL(r=request, c='static', > f='charts/bf094fa3-a711-4118-a3aa-89f647cca4f1.svg')}}" > > Please suggest, > Rahul D. > > -- 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] Dynamic path built for a .svg file using uuid and passing the constructed path to view not working
Hi All, I am using uuid to create new temporary files for PYGAL chart. Although I can see the file being created and available in the file system. Even I can view the file in the browser, however when I serialize the path variable to be passed to the view, I get an error - A 404 not found error is shown inside a frame in my view. How do I serialize the path at runtime to src= in the view such that it should take the path that I have constructed using dynamicLinechartpath.. ? Below is the code unique_filename = (str(uuid.uuid4()) +'.svg') ##...other code ## This creates the file in the file system linechart.render_to_file(os.path.join(request.folder,'static/charts/' + unique_filename)) ## Constructing the path to pass to the view dynamicLinechartpath = (""" "{{=URL(r=request, c='static', f='charts/""" + unique_filename + """')}}" """) Calling the path in view - I have tried src="{{=dynamicLinechartpath}} but it does not work. Is this proper approach ? What am I doing wrong? Here is what 'response.flash' shows me in my view when I try to check what is being passed. which I think is looking good. "{{=URL(r=request, c='static', f='charts/bf094fa3-a711-4118-a3aa-89f647cca4f1.svg')}}" Please suggest, Rahul D. -- 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: stuck up on Deployment on CentOS 6.7
Hi All, I have successfully deployed web2py with modwsgi and Apache on CentOS6.7. When I access my site, by default it shows - http://www.mysite.in/welcome/default/index . Can anyone help on below items - 1. How to change site to show something like by default - http://www.mysite.in/*myapplication*/default/index instead of using the welcome app , here [*myapplication/default/index*] these need to be hidden using *routes.py*. 2. What's the simplest way here for using routes.py. Also *if supported by web2py can this be done using routes.py at application level (if there exists something like that in web2py) or we have to use *global routes.py (that is the one in web2py directory. Please let me know. Thanks! Rahul. On Thursday, May 19, 2016 at 6:33:18 PM UTC+5:30, Rahul wrote: > > Hi All, > I have root access for the VPS server which is on centOS6.7 I have > installed web2py in /home/www/ directory and Apache2 is by default > installed in /usr/local/apache2. Now accessing my website shows me the > Apache welcome screen which says - > You may now add content to the directory /var/www/html/. Note that until > you do so, people visiting your website will see this page and not your > content. To prevent this page from ever being used, follow the instructions > in the file /etc/httpd/conf.d/welcome.conf. > Now my question is how do I proceed with deployment further from here ? I > am a bit stuck . Please suggest > > 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: stuck up on Deployment on CentOS 6.7
Hi LightDot, I've got web2py running over Apache on CentOS6.7. Now when I access the domain, I am being shown the web2py welcome application. I am assuming I only need a few steps to switch my default application. I now face a few challenges to make postgreSQL connection to my application point to my postgresql installation on my VPS. I would try fixing it this week. Thanks! for your support. I would perhaps post a slice after everything works for me on Web2py slices site. And I hope there would be a new site to add in the web2py sites list . Thanks! Rahul D. On Sunday, May 22, 2016 at 5:37:26 AM UTC+5:30, LightDot wrote: > > Basically, you need to have mod_wsgi properly configured and you need to > create an appropriate apache virtual host for your domain. There were > threads here about this before and the above mentioned CentOS 7 script has > this covered in a certain way, so you can look into it for ideas. Generic > mod_wsgi how-to's on the internet should also give you a good starting > point, web2py doesn't need anything that special in this regard. I suggest > working on getting you custom apache and custom python working together > with the use of mod_wsgi first, this is the crucial part. > > There are other ways of running web2py under apache (apart from mod_wsgi) > but this is probably the most well documented approach when it comes to > apache and python in general. And it's really not that bad either. > > Btw, is there any chance you could switch to CentOS 7 and use apache and > python provided by the OS? That would simplify your sysadmin life a lot. > > Regards > > > On Friday, May 20, 2016 at 12:09:24 PM UTC+2, Rahul wrote: >> >> Hey LightDot, >>Thats correct I have manually installed Apache2. However I >> also have python2.7.11(I guess that is the latest one) installed in other >> directory . Both python 2.6.6 and 2.7.11 co-exist separately. I have >> followed instructions to make sure I dont mess up the original >> distribution. Now for #3 - What instructions do I have to follow to achieve >> it. That is just what I can go but dont know my options. I am the root user >> so I can install other packages. Please suggest >> >> Thanks Rahul >> >> On Friday, May 20, 2016 at 3:19:14 PM UTC+5:30, LightDot wrote: >>> >>> Go for 3. >>> >>> Two caveats: >>> - apache installed in /usr/local/apache2 is not a part of CentOS >>> distribution. It must have been installed manually at some point >>> - if you're using python provided by the OS, you'll be stuck on this >>> last version of web2py. Web2py > 2.14.6 isn't python 2.6 compatible anymore. >>> >>> Regards >>> >>> >>> On Friday, May 20, 2016 at 8:29:50 AM UTC+2, Rahul wrote: >>>> >>>> Thanks! Dave. That section deals with centOS7, I will check nginx >>>> section and try to make it work for me. Starting the web2py manually with >>>> nohup command over my public IP works but that would have a port where I >>>> would need to access it. I want a cleaner way to make it work >>>> automatically. >>>> 1. Start web2py automatically as a service ? and >>>> 2. know where to have the file for my project (or sym link) placed so >>>> it either redirects to it or >>>> 3. Have apache2 (site-packages\web2py) file where it can pick up web2py >>>> project and launch it automatically. >>>> >>>> Any idea on above points? >>>> >>>> Rahul >>>> >>>> On Friday, May 20, 2016 at 5:59:30 AM UTC+5:30, Dave S wrote: >>>>> >>>>> >>>>> >>>>> On Thursday, May 19, 2016 at 6:03:18 AM UTC-7, Rahul wrote: >>>>>> >>>>>> Hi All, >>>>>> I have root access for the VPS server which is on centOS6.7 I >>>>>> have installed web2py in /home/www/ directory and Apache2 is by default >>>>>> installed in /usr/local/apache2. Now accessing my website shows me the >>>>>> Apache welcome screen which says - >>>>>> You may now add content to the directory /var/www/html/. Note that >>>>>> until you do so, people visiting your website will see this page and not >>>>>> your content. To prevent this page from ever being used, follow the >>>>>> instructions in the file /etc/httpd/conf.d/welcome.conf. >>>>>> Now my question is how do I proceed with deployment further from here >>>>>> ? I am a bit stuck
[web2py] Re: stuck up on Deployment on CentOS 6.7
Hi LightDot, I've got web2py running over Apache on CentOS6.7. Now when I access the domain, I am being shown the web2py welcome application. I am assuming I only need a few steps to switch my default application. I now face a few challenges to make postgreSQL connection to my application point to my postgresql installation on my VPS. I would try fixing it this week. Thanks! for your support. I would perhaps post a slice after everything works for me on Web2py slices site. And I hope there would be a new site to add in the web2py sites list . Thanks! Rahul D. On Sunday, May 22, 2016 at 5:37:26 AM UTC+5:30, LightDot wrote: > > Basically, you need to have mod_wsgi properly configured and you need to > create an appropriate apache virtual host for your domain. There were > threads here about this before and the above mentioned CentOS 7 script has > this covered in a certain way, so you can look into it for ideas. Generic > mod_wsgi how-to's on the internet should also give you a good starting > point, web2py doesn't need anything that special in this regard. I suggest > working on getting you custom apache and custom python working together > with the use of mod_wsgi first, this is the crucial part. > > There are other ways of running web2py under apache (apart from mod_wsgi) > but this is probably the most well documented approach when it comes to > apache and python in general. And it's really not that bad either. > > Btw, is there any chance you could switch to CentOS 7 and use apache and > python provided by the OS? That would simplify your sysadmin life a lot. > > Regards > > > On Friday, May 20, 2016 at 12:09:24 PM UTC+2, Rahul wrote: >> >> Hey LightDot, >>Thats correct I have manually installed Apache2. However I >> also have python2.7.11(I guess that is the latest one) installed in other >> directory . Both python 2.6.6 and 2.7.11 co-exist separately. I have >> followed instructions to make sure I dont mess up the original >> distribution. Now for #3 - What instructions do I have to follow to achieve >> it. That is just what I can go but dont know my options. I am the root user >> so I can install other packages. Please suggest >> >> Thanks Rahul >> >> On Friday, May 20, 2016 at 3:19:14 PM UTC+5:30, LightDot wrote: >>> >>> Go for 3. >>> >>> Two caveats: >>> - apache installed in /usr/local/apache2 is not a part of CentOS >>> distribution. It must have been installed manually at some point >>> - if you're using python provided by the OS, you'll be stuck on this >>> last version of web2py. Web2py > 2.14.6 isn't python 2.6 compatible anymore. >>> >>> Regards >>> >>> >>> On Friday, May 20, 2016 at 8:29:50 AM UTC+2, Rahul wrote: >>>> >>>> Thanks! Dave. That section deals with centOS7, I will check nginx >>>> section and try to make it work for me. Starting the web2py manually with >>>> nohup command over my public IP works but that would have a port where I >>>> would need to access it. I want a cleaner way to make it work >>>> automatically. >>>> 1. Start web2py automatically as a service ? and >>>> 2. know where to have the file for my project (or sym link) placed so >>>> it either redirects to it or >>>> 3. Have apache2 (site-packages\web2py) file where it can pick up web2py >>>> project and launch it automatically. >>>> >>>> Any idea on above points? >>>> >>>> Rahul >>>> >>>> On Friday, May 20, 2016 at 5:59:30 AM UTC+5:30, Dave S wrote: >>>>> >>>>> >>>>> >>>>> On Thursday, May 19, 2016 at 6:03:18 AM UTC-7, Rahul wrote: >>>>>> >>>>>> Hi All, >>>>>> I have root access for the VPS server which is on centOS6.7 I >>>>>> have installed web2py in /home/www/ directory and Apache2 is by default >>>>>> installed in /usr/local/apache2. Now accessing my website shows me the >>>>>> Apache welcome screen which says - >>>>>> You may now add content to the directory /var/www/html/. Note that >>>>>> until you do so, people visiting your website will see this page and not >>>>>> your content. To prevent this page from ever being used, follow the >>>>>> instructions in the file /etc/httpd/conf.d/welcome.conf. >>>>>> Now my question is how do I proceed with deployment further from here >>>>>> ? I am a bit stuck