[web2py] Re: Adding a new table to web2py with a reference field to an established table and getting error
Hi Anthony, Many thanks for this. A complete noobie error - sorry to waste your time but I really appreciate your help. It was the error message that threw me! Best wishes, Heather On Thursday, 17 March 2016 15:55:17 UTC, Anthony wrote: > > You are missing a comma: > > Field('ReportInstanceIndicatorInstance', 'reference > ReportInstanceIndicatorInstance') > > Python concatenates adjacent string literals delimited by whitespace, so > without the comma, Python interprets: > > 'ReportInstanceIndicatorInstance' 'reference > ReportInstanceIndicatorInstance' > > as: > > 'ReportInstanceIndicatorInstancereference ReportInstanceIndicatorInstance' > > So, it appears you are trying to include a space in the field name rather > than specify the field as a reference field. > > Anthony > > On Thursday, March 17, 2016 at 10:58:43 AM UTC-4, Heather Dawe wrote: >> >> The two tables I am defining are as follows >> >> db.define_table('Series', >>Field('name'), >>Field('SeriesBy', 'reference DataItem'), >>format='%(name)s') >> >> db.define_table('SeriesReportInstanceIndicatorInstance', >>Field('Series', 'reference Series'), >>Field('ReportInstanceIndicatorInstance' 'reference >> ReportInstanceIndicatorInstance'), >>Field('this_series_name')) >> >> The Series table gets defined fine. The error I get is the following >> >> Field: invalid field name: >> ReportInstanceIndicatorInstancereference ReportInstanceIndicatorInstance, >> use rname for "funny" names >> >> when I attempt to reference the already established >> ReportInstanceIndicatorInstance table below >> >> db.define_table('ReportInstanceIndicatorInstance', >>Field('ReportInstance', 'reference ReportInstance'), >>Field('IndicatorInstance', 'reference IndicatorInstance'), >>Field('GroupBy', 'reference DataItem'), >>Field('GroupBy2', 'reference DataItem'), >>Field('title'), >>Field('x_axis_label'), >>Field('y_axis_label'), >>Field('report_data_id'), >>format= '%(title)s') >> >> >> >> On Thursday, 17 March 2016 14:30:36 UTC, Anthony wrote: >>> >>> According to the error, your field name is "field1reference table1", so >>> you probably have an error in the field definition. Please show your model >>> code. >>> >>> Anthony >>> >>> On Thursday, March 17, 2016 at 8:28:00 AM UTC-4, Heather Dawe wrote: >>>> >>>> Hi there, >>>> >>>> I have had this error in a couple of scenarios now. I have an >>>> established and working web2py app and I wish to add a couple of tables to >>>> the model. A number of fields in these new tables reference fields in >>>> established tables. I get this error when trying to create the new tables >>>> >>>> Field: invalid field name: >>>> field1reference table1, use rname for "funny" names >>>> >>>> where 'field1' is the name of a field in the new table I am trying to >>>> create that references table1 (the id field in table1). Given that all I >>>> am >>>> trying to do is add a new table to my model which has a field that >>>> references an existing table I don't see why this is a problem? I have >>>> looked into it and searched for the error etc. I have tried to fix it by >>>> changing to migrate='false' and fake_migrate='true' etc. but this has not >>>> solved it. Can anyone please advise why I am getting this error and how to >>>> sort it out? >>>> >>>> Many thanks, >>>> Heather >>>> >>> -- 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: Adding a new table to web2py with a reference field to an established table and getting error
The two tables I am defining are as follows db.define_table('Series', Field('name'), Field('SeriesBy', 'reference DataItem'), format='%(name)s') db.define_table('SeriesReportInstanceIndicatorInstance', Field('Series', 'reference Series'), Field('ReportInstanceIndicatorInstance' 'reference ReportInstanceIndicatorInstance'), Field('this_series_name')) The Series table gets defined fine. The error I get is the following Field: invalid field name: ReportInstanceIndicatorInstancereference ReportInstanceIndicatorInstance, use rname for "funny" names when I attempt to reference the already established ReportInstanceIndicatorInstance table below db.define_table('ReportInstanceIndicatorInstance', Field('ReportInstance', 'reference ReportInstance'), Field('IndicatorInstance', 'reference IndicatorInstance'), Field('GroupBy', 'reference DataItem'), Field('GroupBy2', 'reference DataItem'), Field('title'), Field('x_axis_label'), Field('y_axis_label'), Field('report_data_id'), format= '%(title)s') On Thursday, 17 March 2016 14:30:36 UTC, Anthony wrote: > > According to the error, your field name is "field1reference table1", so > you probably have an error in the field definition. Please show your model > code. > > Anthony > > On Thursday, March 17, 2016 at 8:28:00 AM UTC-4, Heather Dawe wrote: >> >> Hi there, >> >> I have had this error in a couple of scenarios now. I have an established >> and working web2py app and I wish to add a couple of tables to the model. A >> number of fields in these new tables reference fields in established >> tables. I get this error when trying to create the new tables >> >> Field: invalid field name: >> field1reference table1, use rname for "funny" names >> >> where 'field1' is the name of a field in the new table I am trying to >> create that references table1 (the id field in table1). Given that all I am >> trying to do is add a new table to my model which has a field that >> references an existing table I don't see why this is a problem? I have >> looked into it and searched for the error etc. I have tried to fix it by >> changing to migrate='false' and fake_migrate='true' etc. but this has not >> solved it. Can anyone please advise why I am getting this error and how to >> sort it out? >> >> Many thanks, >> Heather >> > -- 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] Adding a new table to web2py with a reference field to an established table and getting error
Hi there, I have had this error in a couple of scenarios now. I have an established and working web2py app and I wish to add a couple of tables to the model. A number of fields in these new tables reference fields in established tables. I get this error when trying to create the new tables Field: invalid field name: field1reference table1, use rname for "funny" names where 'field1' is the name of a field in the new table I am trying to create that references table1 (the id field in table1). Given that all I am trying to do is add a new table to my model which has a field that references an existing table I don't see why this is a problem? I have looked into it and searched for the error etc. I have tried to fix it by changing to migrate='false' and fake_migrate='true' etc. but this has not solved it. Can anyone please advise why I am getting this error and how to sort it out? Many thanks, Heather -- 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] Runtime error: unsupported format character
Hi there, I am new to web2py. It is brilliant - thank you so much for its development. I am using the latest stable version of web2py and am encountering this error when attempting to add a record to a particular table in my model unsupported format character 't' (0x74) at index 1 I have googled ' unsupported format character' and have found a few similar issues on this forum but no real advised resolution apart from upgrade to the latest version of web2py (which I am running). Thank you in advance, Heather -- 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: unsupported format character 'n' (0x6e) at index 1
Hello there, I am new to web2py - it is a brilliant framework thank you. I am running the latest version, defining my models and encountering this error when attempting to add a record to a table that defines a many-to-many relationship - when I attempt to add a record to table ModelInstanceDataItemValue (listed in the model code below). I have searched for solutions and can't find any. This may well be a beginner's problem but I can't see why it is throwing up the error. With thanks and best wishes, Heather db = DAL("postgres://heather:secret@localhost:5432/indyfabdb",migrate=True) db.define_table('ItemType', Field('type'), Field('description'), format='%(type)s') db.ItemType.type.requires = IS_NOT_IN_DB(db, db.ItemType.type) db.ItemType.type.requires = IS_NOT_EMPTY() db.define_table('DataItem', Field('name'), Field('type', 'reference ItemType'), format='%(name)s') db.DataItem.name.requires = IS_NOT_IN_DB(db, db.DataItem.name) db.DataItem.name.requires = IS_NOT_EMPTY() db.define_table('DataSet', Field('name'), Field('location'), format='%(name)s') db.DataSet.name.requires = IS_NOT_EMPTY() db.DataSet.name.requires = IS_NOT_IN_DB(db, db.DataSet.name) db.DataSet.location.requires = IS_NOT_EMPTY() db.define_table('DataSetItem', Field('DataSetName', 'reference DataSet'), Field('DataItemName', 'reference DataItem'), Field('position')) db.DataSetItem.position.requires = IS_NOT_EMPTY() db.define_table('DataSetValidValue', Field('name'), Field('DataSet', 'reference DataSet'), Field('query', 'text'), format='%(name)s') db.DataSetValidValue.name.requires = IS_NOT_EMPTY() db.DataSetValidValue.query.requires = IS_NOT_EMPTY() db.define_table('ModelType', Field('type'), Field('description'), format='%(type)s') db.define_table('ModelInstance', Field('name'), Field('ModelType', 'reference ModelType'), format='%name)s') db.ModelInstance.name.requires = IS_NOT_EMPTY() db.define_table('ModelInstanceDataItemValue', Field('ModelInstance', 'reference ModelInstance'), Field('DataItem', 'reference DataItem'), Field('value')) db.ModelInstanceDataItemValue.value.requires = IS_NOT_EMPTY() -- 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: Runtime error: unsupported format character
Thanks for your reply Dave. Sorry I missed it - I have posted a similar question above where I have listed my model code in the body of the question. On Thursday, 3 September 2015 02:04:28 UTC+1, Dave S wrote: > > > > On Tuesday, September 1, 2015 at 8:48:27 PM UTC-7, Heather Dawe wrote: >> >> Hi there, >> >> I am new to web2py. It is brilliant - thank you so much for its >> development. >> >> I am using the latest stable version of web2py and am encountering this >> error when attempting to add a record to a particular table in my model >> >> unsupported format character 't' (0x74) at >> index 1 >> >> I have googled ' unsupported format >> character' >> > >> and have found a few similar issues on this forum but no real advised >> resolution apart from upgrade to the latest version of web2py (which I am >> running). >> >> Thank you in advance, >> Heather >> > > > Can you post your table definitions? > > Can you show us anything about the input that causes the error? > > /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. For more options, visit https://groups.google.com/d/optout.
[web2py] Re: Error: unsupported format character 'n' (0x6e) at index 1
Yes thanks Dave - a complete beginner's error! I really appreciate you pointing it out as I have been tearing my hair out today trying to work out the problem. thanks again, Heather On Monday, 7 September 2015 21:55:17 UTC+1, Heather Dawe wrote: > > Hello there, > > I am new to web2py - it is a brilliant framework thank you. I am running > the latest version, defining my models and encountering this error when > attempting to add a record to a table that defines a many-to-many > relationship - when I attempt to add a record to table > ModelInstanceDataItemValue (listed in the model code below). I have > searched for solutions and can't find any. This may well be a beginner's > problem but I can't see why it is throwing up the error. > > With thanks and best wishes, > Heather > > db = DAL("postgres://heather:secret@localhost:5432/indyfabdb",migrate=True) > > db.define_table('ItemType', >Field('type'), >Field('description'), >format='%(type)s') > > db.ItemType.type.requires = IS_NOT_IN_DB(db, db.ItemType.type) > db.ItemType.type.requires = IS_NOT_EMPTY() > > db.define_table('DataItem', >Field('name'), >Field('type', 'reference ItemType'), >format='%(name)s') > > db.DataItem.name.requires = IS_NOT_IN_DB(db, db.DataItem.name) > db.DataItem.name.requires = IS_NOT_EMPTY() > > db.define_table('DataSet', >Field('name'), >Field('location'), >format='%(name)s') > > db.DataSet.name.requires = IS_NOT_EMPTY() > db.DataSet.name.requires = IS_NOT_IN_DB(db, db.DataSet.name) > db.DataSet.location.requires = IS_NOT_EMPTY() > > db.define_table('DataSetItem', >Field('DataSetName', 'reference DataSet'), >Field('DataItemName', 'reference DataItem'), >Field('position')) > > db.DataSetItem.position.requires = IS_NOT_EMPTY() > > db.define_table('DataSetValidValue', >Field('name'), >Field('DataSet', 'reference DataSet'), >Field('query', 'text'), >format='%(name)s') > > db.DataSetValidValue.name.requires = IS_NOT_EMPTY() > db.DataSetValidValue.query.requires = IS_NOT_EMPTY() > > db.define_table('ModelType', >Field('type'), >Field('description'), >format='%(type)s') > > db.define_table('ModelInstance', >Field('name'), >Field('ModelType', 'reference ModelType'), >format='%name)s') > > db.ModelInstance.name.requires = IS_NOT_EMPTY() > > db.define_table('ModelInstanceDataItemValue', >Field('ModelInstance', 'reference ModelInstance'), >Field('DataItem', 'reference DataItem'), >Field('value')) > > db.ModelInstanceDataItemValue.value.requires = IS_NOT_EMPTY() > -- 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] GET http://127.0.0.1:8000/favicon.ico 400 (BAD REQUEST) - using angular.js and nvd3
Hello I am getting a bad request when attempting to use angular.js with nvd3 for data visualisation. My web2py controller passes a json to its view. This view code is shown below. It extends the layout.html which is the standard layout.html apart from I have added the javascript libraries angular.js, d3.min.js, nv.d3.js, angular-nvd.js and the css file nv.d3.min.css, all of which are required to use angular and nvd3 to generate data visualisations. I have tested the nvd3 and angular parts outside of web2py and the data visualisation works fine. {{ extend 'layout.html' }} var funnel_app = angular.module("funnel_app", ['nvd3']); funnel_app.config(function($interpolateProvider) { $interpolateProvider.startSymbol(''); $interpolateProvider.endSymbol('?>'); }); funnel_app.controller('mainCtrl', function($scope) { $scope.data = {{=XML(response.json(report_data))}}; $scope.options = { chart: { type: 'multiChart', height: 450, margin : { top: 30, right: 60, bottom: 50, left: 70 }, color: d3.scale.category10().range(), //useInteractiveGuideline: true, transitionDuration: 500, xAxis: { tickFormat: function(d){ return d3.format(',f')(d); } }, yAxis1: { tickFormat: function(d){ return d3.format(',.1f')(d); } }, yAxis2: { tickFormat: function(d){ return d3.format(',.1f')(d); } } } } }); The json looks like it is passing from the controller to the view fine - I have looked at the source generated by web2py and nothing looks strange. But I am getting this favicon.ico bad request error. I am not getting this error from any other view within the same web2py app and they all extend layout.html where favicon.ico is listed. It seems to be pointing at favicon at root rather than .../static/images/favicon.ico and I can't see why. Having spent a long time trying to work out what the issue is I thought I would post a question here - has anyone else had similar issue? Many thanks in advance! -- 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] GET http://127.0.0.1:8000/favicon.ico 400 (BAD REQUEST) - using angular.js and nvd3
Hi Michele, Many thanks for your reply. I am sorry if I did not make it clear in my first post that I have looked at layout.html in detail regarding this issue. While all of the other views in my app also extend layout.html, the only page (and therefore view) I am having this problem is the one above. To be clear I am not having the favicon issue with any other page even though they all use the same layout.html code!! This leads me to conclude (falsely or otherwise) that it is likely to be caused by this particular view and perhaps the use of angular.js and/or nvd3.js as this particular view is the only place I am currently using these additional javascript libraries. Either that or an issue related to passing the JSON from the web2py controller to the view (but having looked at the source html for this view generated by web2py it looks fine). Many thanks again, Heather On Mon, Oct 5, 2015 at 10:15 AM, Michele Comitini < michele.comit...@gmail.com> wrote: > The favicon.ico is generated by the browser by looking at a link tag in > html, it does not depend on your code posted here. > In the browser look in the full source of the html generated by web2py to > find where favicon.ico is called. Hint: look in views/layout.html > > see: https://en.wikipedia.org/wiki/Favicon > > HTH > > 2015-10-05 10:19 GMT+02:00 Heather Dawe : > >> Hello I am getting a bad request when attempting to use angular.js with >> nvd3 for data visualisation. >> >> My web2py controller passes a json to its view. This view code is shown >> below. It extends the layout.html which is the standard layout.html apart >> from I have added the javascript libraries angular.js, d3.min.js, nv.d3.js, >> angular-nvd.js and the css file nv.d3.min.css, all of which are required to >> use angular and nvd3 to generate data visualisations. I have tested the >> nvd3 and angular parts outside of web2py and the data visualisation works >> fine. >> >> {{ extend 'layout.html' }} >> >> >>var funnel_app = angular.module("funnel_app", ['nvd3']); >> >>funnel_app.config(function($interpolateProvider) { >> $interpolateProvider.startSymbol('<?'); >> $interpolateProvider.endSymbol('?>'); >>}); >> >> funnel_app.controller('mainCtrl', function($scope) { >> >> $scope.data = {{=XML(response.json(report_data))}}; >> >> $scope.options = { >>chart: { >>type: 'multiChart', >>height: 450, >>margin : { >>top: 30, >>right: 60, >>bottom: 50, >>left: 70 >>}, >>color: d3.scale.category10().range(), >>//useInteractiveGuideline: true, >>transitionDuration: 500, >>xAxis: { >> tickFormat: function(d){ >> return d3.format(',f')(d); >> } >>}, >>yAxis1: { >>tickFormat: function(d){ >> return d3.format(',.1f')(d); >>} >>}, >>yAxis2: { >>tickFormat: function(d){ >> return d3.format(',.1f')(d); >>} >>} >> } >> >>} >> }); >> >> >> >> >> >> >> >> >> The json looks like it is passing from the controller to the view fine - >> I have looked at the source generated by web2py and nothing looks strange. >> But I am getting this favicon.ico bad request error. I am not getting this >> error from any other view within the same web2py app and they all extend >> layout.html where favicon.ico is listed. It seems to be pointing at favicon >> at root rather than .../static/images/favicon.ico and I can't see why. >> Having spent a long time trying to work out what the issue is I thought I >> would post a question here - has anyone else had similar issue? >> >> Many thanks in advance! >> >> -- >> 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) >>
[web2py] WARNING:Rocket.Errors.Port8000:Listener started when not ready.
Earlier today I had to force a restart of my mac. After restart I attempted to start web2py from a terminal session as I have done many times before sudo python web2py.py -a 'password' -i 1.0.0.1 -p 8000 I got the following error ERROR:Rocket.Errors.Port8000:Socket 1.0.0.1:8000 in use by other process and it won't share. WARNING:Rocket.Errors.Port8000:Listener started when not ready. When from terminal I attempt to see what is using port 8000 I see it is not in use and when I try to start web2py using a different port (also not in use) I get the same error. I need to launch web2py from the terminal as root otherwise it points to an incorrect version of pymongo (following the advice in this thread https://groups.google.com/forum/#!topic/web2py/SPVDQPYBxKI) so I can't launch from the front-end. Despite this, when I do try to start web2p from the front-end is hangs with no error message. I have searched for a solution to this but there is nothing specific to this issue. I think the forced restart of my mac caused web2py to see port 8000 as being in use even though it isn't - I can start other local servers using it. Thank you, Heather -- 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: WARNING:Rocket.Errors.Port8000:Listener started when not ready.
Hi Leonel, Many thanks for pointing that out it worked a treat. Just to further my newbie questions - using ip 127.0.0.1 always worked when I previously started the server and, now I have used your advice to use ip 1.0.0.1 to get the server going again, when I stop and start it 127.0.0.1 now works again. To get it going in the first place (using ip 127.0.0.1) I followed the web2py book and advice from this forum. Anyhow my (naive) question is why? Many thanks again, Heather On Mon, Oct 5, 2015 at 3:01 PM, Leonel Câmara wrote: > You're using the wrong IP address > > sudo python web2py.py -a 'password' -i 1.0.0.1 -p 8000 > > It should be > > sudo python web2py.py -a 'password' -i 127.0.0.1 -p 8000 > > > I think we should call the ability to catch this kind of mistakes quickly > "programmer's eye" or something. Seriously the amount of hours I've lost to > this kind of stuff in my youth before I developed it is innumerable. > > -- > 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/GHg7uv8Squg/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.