On Tue, May 30, 2017 at 05:25:06PM +1000, Dan Callaghan wrote:
> Excerpts from Don Zickus's message of 2017-05-25 16:59 -04:00:
> > Hi Dan,
> > 
> > I thought instead of describing what I am doing, I would just show you the
> > patch so you can point at the problem quicker.
> > 
> > As I mentioned before, I decided to just randomly grab a page like
> > CSV_import_export and try to convert it to flask.  I started by mimicing
> > reserve_workflow thinking it had a similar display and POST frontend.
> > 
> > However, I found out, I can get the page to render the title but that is
> > about it.
> > 
> > Even on the reserve_workflow page, I don't get the pretty Distro and other
> > forms (without my changes applied too).
> 
> If you just get a navbar and nothing else appearing on the page -- 
> especially if on a different page that you didn't change -- it means 
> there was a syntax error in the JS, or some other error evaluating it 
> before it could render anything (like a model initialize() throwing 
> etc).
> 
> Open the JS console in your browser and you should see the error.
> 
> Note that in the production config, JS is served minified and it will be 
> impossible to get a good stack trace or any other info from the browser. 
> But if you use run-server.sh it will use the development config, which 
> has:
> 
>     assets.debug = True
> 
> That way it will serve up the uncompressed JS files and it is much 
> easier to debug.

Ahh, yes.  After fumbling around in there, I did find some dumb js syntax
errors.  Fixing a few more has led me to POST part of the python script.  I
can manage from here.  Thanks!!

Cheers,
Don


> 
> > So I can't tell if my patch below is technically wrong (I am sure it is
> > missing lots of pieces) or my devel env is not quite configured correctly
> > (because reserve_workflow doesn't quite work either).
> > 
> > Thoughts? Help?
> 
> > +    render: function () {
> > +        this.$el.html(this.template(this));
> 
> One potential problem here. You probably wanted to call 
> this.template(this.model.attributes). The template is a function which 
> takes an object whose keys are mapped to the local variables in the 
> template. So the convention we use in a lot of views is to just pass an 
> object's attributes through to be used in the template. Passing the view 
> itself will work -- but won't make available the variables you are 
> probably expecting in your template.
> 
> > +      <div class="controls">
> > +        <% _.each(csv_types, function (csv) { %>
> 
> csv_types local variable won't be defined in this template, as per the 
> above. Pretty sure this will be the error your browser will show you if 
> you look in the console.
> 
> Note that errors which happen inside these JST templates show up with 
> fake line numbers (somewhere inside underscore.js I think) so you have 
> to kind of guess that the error happened in a template.
> 
> If you have a recent Firefox each JS error on the console has a little 
> arrow which you can expand to see a full stack trace, which will give 
> you more hints (you would see the View object calling into the template 
> through underscore). Very handy.
> 
> > +upload     = widgets.FileField(name='csv_file', label='Import CSV', \
> > +                               help_text = import_help_text)
> > +download   = RadioButtonList(name='csv_type', label='CSV Type',
> > +                           options=[('system', 'Systems'),
> > +                                    ('system_id', 'Systems (for 
> > modification)'), 
> > +                                    ('labinfo', 'System LabInfo'), 
> > +                                    ('power', 'System Power'),
> > +                                    ('exclude', 'System Excluded 
> > Families'), 
> > +                                    ('install', 'System Install Options'),
> > +                                    ('keyvalue', 'System Key/Values'),
> > +                                    ('system_pool', 'System Pools'),
> > +                                    ('user_group', 'User Groups')], 
> > +                             default='system',
> > +                             help_text = export_help_text)
> > +exportform = HorizontalForm(
> > +    'export',
> > +    action = 'export data',
> > +    submit_text = _(u'Export CSV'),
> > +)
> 
> I guess you just left these in by accident -- these are all TurboGears 
> widgets stuff which you would want to just delete instead.
> 
> -- 
> Dan Callaghan <dcall...@redhat.com>
> Senior Software Engineer, Products & Technologies Operations
> Red Hat



> _______________________________________________
> Beaker-devel mailing list -- beaker-devel@lists.fedorahosted.org
> To unsubscribe send an email to beaker-devel-le...@lists.fedorahosted.org
_______________________________________________
Beaker-devel mailing list -- beaker-devel@lists.fedorahosted.org
To unsubscribe send an email to beaker-devel-le...@lists.fedorahosted.org

Reply via email to