Skip to content

Instantly share code, notes, and snippets.

@mazz
Created January 22, 2017 01:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazz/4b2c9320814f9b7fb69dfaa8063a7e7a to your computer and use it in GitHub Desktop.
Save mazz/4b2c9320814f9b7fb69dfaa8063a7e7a to your computer and use it in GitHub Desktop.
NameError: name 'path' is not defined
from websauna.system.http import Request
from websauna.system.core.route import simple_route
from cornice.service import Service
# Configure view named home at path / using a template xact/home.html
@simple_route("/", route_name="home", renderer='xact/home.html')
def home(request: Request):
"""Render site homepage."""
return {"project": "xact"}
trivial = Service(name='resttrivial',
path=path('trivial'),
renderer='json',
accept='application/json')
@trivial.get(require_csrf=False)
def get_trivial(request):
return dict(status='success')
@mazz
Copy link
Author

mazz commented Jan 22, 2017

  File "/Users/maz/webapp/websauna_xact/xact/xact/views.py", line 12, in <module>
    path=path('trivial'),
NameError: name 'path' is not defined

@ooduor
Copy link

ooduor commented Jan 22, 2017

Change path=path('trivial') to path='trivial'

The path function is missing in this case. It was probably a custom function in the cornice example and was not shared with the gist.

@asqararslonov
Copy link

good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment