jstacoder / flask-cms

a minimal CMS built on the pythonic MTV (model / template / view) pattern, implemented using the flask webframework
136 stars 37 forks source link

/admin/add/block #8

Closed tanyewei closed 9 years ago

tanyewei commented 9 years ago

File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask_debugtoolbar/init.py", line 125, in dispatch_request return view_func(req.view_args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cProfile.py", line 149, in runcall return func(_args, _kw) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/utils.py", line 107, in wrapper return view(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/views.py", line 149, in dispatch_request return meth(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/views.py", line 258, in get return self.render() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask_xxl/baseviews.py", line 36, in render return render_template(self._template,self._context) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template context, ctx.app) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/templating.py", line 110, in _render rv = template.render(context) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render return self.environment.handle_exception(exc_info, True) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/templates/add.html", line 3, in top-level template code {% from 'buttons2.html' import get_button as Button %} File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 1029, in module self._module = rv = self.make_module() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 1013, in make_module return TemplateModule(self, self.new_context(vars, shared, locals)) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 1070, in init self._body_stream = list(template.root_render_func(context)) File "/Users/tanyewei/dev/flask-cms/flask_cms/templates/buttons2.html", line 47, in top-level template code {%- if args['type'] == 'link' -%} File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 378, in getitem return obj[argument]

jstacoder commented 9 years ago

this doesn't look like the whole trace-back, ill need at least the whole trace-back to know what exception was called to help with this.

tanyewei commented 9 years ago

That file: buttons2.html doesn't exist

jstacoder commented 9 years ago

the file that is referenced here:

 {% from 'buttons2.html' import get_button as Button %}

is located at /flask-cms/flask_cms/page/templates/buttons2.html i belive it should be in the repo you have cloned. Im not sure at the moment why its trying to grab it from the main templates folder, but i think for now copying it over should do the trick. Ill commit it in a minute.

tanyewei commented 9 years ago

AttributeError AttributeError: 'NoneType' object has no attribute 'text'

Traceback (most recent call last) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask_debugtoolbar/init.py", line 125, in dispatch_request return view_func(req.view_args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cProfile.py", line 149, in runcall return func(_args, _kw) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/utils.py", line 107, in wrapper return view(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/views.py", line 149, in dispatch_request return meth(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/views.py", line 592, in get return self.render() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask_xxl/baseviews.py", line 36, in render return render_template(self._template,self._context) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/templating.py", line 128, in render_template context, ctx.app) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/templating.py", line 110, in _render rv = template.render(context) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render return self.environment.handle_exception(exc_info, True) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/templates/add.html", line 3, in top-level template code {% from 'buttons2.html' import get_button as Button %} File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/templates/admin.html", line 52, in top-level template code {% block body %}{% endblock body %} File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/templates/add.html", line 60, in block "body" {{ get_button('save_btn') }} File "/Users/tanyewei/dev/flask-cms/flask_cms/page/context_processors.py", line 86, in get_button text=button.text, AttributeError: 'NoneType' object has no attribute 'text' The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame dump(obj) dumps all that's known about the object Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.

tanyewei commented 9 years ago

AttributeError AttributeError: 'AddBlogForm' object has no attribute 'category'

Traceback (most recent call last) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1836, in call return self.wsgi_app(environ, start_response) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask_debugtoolbar/init.py", line 125, in dispatch_request return view_func(_req.view_args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/cProfile.py", line 149, in runcall return func(_args, _kw) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/utils.py", line 107, in wrapper return view(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/views.py", line 84, in view return self.dispatch_request(_args, _kwargs) File "/Users/tanyewei/dev/flask-cms/env/lib/python2.7/site-packages/flask/views.py", line 149, in dispatch_request return meth(_args, **kwargs) File "/Users/tanyewei/dev/flask-cms/flask_cms/admin/views.py", line 604, in post category = self._form.category.data AttributeError: 'AddBlogForm' object has no attribute 'category' The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

dump() shows all variables in the frame dump(obj) dumps all that's known about the object Brought to you by DON'T PANIC, your friendly Werkzeug powered traceback interpreter.

tanyewei commented 9 years ago

why comment the code: #category = QuerySelectField('category',query_factory=lambda: Category.query.all())