lundi 20 juin 2016

Ember-simple-auth-token / Flask error: AttributeError: 'function' object has no attribute 'get'

I'm trying to run an Ember project that I had to upgrade it's packages, but now I run into deprecation issues.

My current issue is that when I press 'login' I see the following error Client side:

http://ift.tt/28M7lzE
[HTTP/1.0 500 INTERNAL SERVER ERROR 48ms]

And server side:

127.0.0.1 - - [21/Jun/2016 00:38:52] "POST /api/token-auth/ HTTP/1.1" 500 -
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 2000, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1991, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1559, in handle_exception
    handler = self._find_error_handler(InternalServerError())
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1476, in _find_error_handler
    .get(code))
  File "/usr/lib/python2.7/site-packages/flask/app.py", line 1465, in find_handler
    handler = handler_map.get(cls)
AttributeError: 'function' object has no attribute 'get'

login script app/controllers/login.js:

import Ember from 'ember';


export default Ember.Controller.extend({   
  session: Ember.inject.service(),   
  loginMessage: "",   
  actions: {
    authenticate: function() {
    var credentials = this.getProperties('identification', 'password'),
      authenticator = 'authenticator:jwt';
      this.set("loginMessage", "");
      this.get('session').authenticate(authenticator, credentials);
    }   
  } 
});

The login script is taken from http://ift.tt/22XE0pU and is perhaps not fully updated. I have updated ember from version 1.13.13 to 2.6.0.

Originally it looked like this:

import Ember from 'ember';


export default Ember.Controller.extend({
  loginMessage: "",
  actions: {
    authenticate: function() {
      var credentials = this.getProperties('identification', 'password'),
        authenticator = 'simple-auth-authenticator:jwt';
      this.set("loginMessage", "");
      this.get('session').authenticate(authenticator, credentials);
    }
  }
});

I have no knowledge of Ember really, so to my very limited understanding is that there's a build javascript file that's based off an MCR architecture of little javascript files.

Python2-flask version is 0.11-2

If any other information is needed please say so.




Aucun commentaire:

Enregistrer un commentaire