Skip to content

Commit

Permalink
#63 debug notebook changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ephes committed Feb 26, 2023
1 parent b8c6a5e commit bf8418d
Showing 1 changed file with 18 additions and 80 deletions.
98 changes: 18 additions & 80 deletions notebooks/wagtail/api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 6,
"id": "57cc60b5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"wagtail api urls: ([<URLResolver <URLPattern list> (pages:pages) '^pages/'>], 'wagtailapi', 'wagtailapi')\n"
]
}
],
"outputs": [],
"source": [
"from cast.api.wagtail_api import wagtail_api_router"
]
Expand Down Expand Up @@ -41,19 +33,19 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 7,
"id": "001d4078",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"([<URLResolver <URLPattern list> (pages:pages) '^pages/'>],\n",
" 'wagtailapi',\n",
" 'wagtailapi')"
" 'cast:api:wagtail',\n",
" 'cast:api:wagtail')"
]
},
"execution_count": 3,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -64,83 +56,29 @@
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8a329f84",
"metadata": {},
"outputs": [
{
"ename": "NoReverseMatch",
"evalue": "'wagtailapi' is not a registered namespace",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mKeyError\u001B[0m Traceback (most recent call last)",
"File \u001B[0;32m~/.virtualenvs/cast/lib/python3.11/site-packages/django/urls/base.py:71\u001B[0m, in \u001B[0;36mreverse\u001B[0;34m(viewname, urlconf, args, kwargs, current_app)\u001B[0m\n\u001B[1;32m 70\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m---> 71\u001B[0m extra, resolver \u001B[38;5;241m=\u001B[39m \u001B[43mresolver\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mnamespace_dict\u001B[49m\u001B[43m[\u001B[49m\u001B[43mns\u001B[49m\u001B[43m]\u001B[49m\n\u001B[1;32m 72\u001B[0m resolved_path\u001B[38;5;241m.\u001B[39mappend(ns)\n",
"\u001B[0;31mKeyError\u001B[0m: 'wagtailapi'",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001B[0;31mNoReverseMatch\u001B[0m Traceback (most recent call last)",
"Cell \u001B[0;32mIn[4], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[43mreverse\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mwagtailapi:pages\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n",
"File \u001B[0;32m~/.virtualenvs/cast/lib/python3.11/site-packages/django/urls/base.py:82\u001B[0m, in \u001B[0;36mreverse\u001B[0;34m(viewname, urlconf, args, kwargs, current_app)\u001B[0m\n\u001B[1;32m 77\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m NoReverseMatch(\n\u001B[1;32m 78\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[38;5;124m is not a registered namespace inside \u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m 79\u001B[0m \u001B[38;5;241m%\u001B[39m (key, \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m:\u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;241m.\u001B[39mjoin(resolved_path))\n\u001B[1;32m 80\u001B[0m )\n\u001B[1;32m 81\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[0;32m---> 82\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m NoReverseMatch(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m%s\u001B[39;00m\u001B[38;5;124m is not a registered namespace\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;241m%\u001B[39m key)\n\u001B[1;32m 83\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m ns_pattern:\n\u001B[1;32m 84\u001B[0m resolver \u001B[38;5;241m=\u001B[39m get_ns_resolver(\n\u001B[1;32m 85\u001B[0m ns_pattern, resolver, \u001B[38;5;28mtuple\u001B[39m(ns_converters\u001B[38;5;241m.\u001B[39mitems())\n\u001B[1;32m 86\u001B[0m )\n",
"\u001B[0;31mNoReverseMatch\u001B[0m: 'wagtailapi' is not a registered namespace"
]
}
],
"source": [
"reverse(\"wagtailapi:pages\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "e329cef4",
"execution_count": 11,
"id": "446e8c21",
"metadata": {},
"outputs": [
{
"ename": "NoReverseMatch",
"evalue": "Reverse for 'wagtail' not found. 'wagtail' is not a valid view function or pattern name.",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mNoReverseMatch\u001B[0m Traceback (most recent call last)",
"Cell \u001B[0;32mIn[4], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[43mreverse\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mcast:api:wagtail\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n",
"File \u001B[0;32m~/.virtualenvs/cast/lib/python3.11/site-packages/django/urls/base.py:88\u001B[0m, in \u001B[0;36mreverse\u001B[0;34m(viewname, urlconf, args, kwargs, current_app)\u001B[0m\n\u001B[1;32m 83\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m ns_pattern:\n\u001B[1;32m 84\u001B[0m resolver \u001B[38;5;241m=\u001B[39m get_ns_resolver(\n\u001B[1;32m 85\u001B[0m ns_pattern, resolver, \u001B[38;5;28mtuple\u001B[39m(ns_converters\u001B[38;5;241m.\u001B[39mitems())\n\u001B[1;32m 86\u001B[0m )\n\u001B[0;32m---> 88\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mresolver\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_reverse_with_prefix\u001B[49m\u001B[43m(\u001B[49m\u001B[43mview\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mprefix\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\n",
"File \u001B[0;32m~/.virtualenvs/cast/lib/python3.11/site-packages/django/urls/resolvers.py:828\u001B[0m, in \u001B[0;36mURLResolver._reverse_with_prefix\u001B[0;34m(self, lookup_view, _prefix, *args, **kwargs)\u001B[0m\n\u001B[1;32m 823\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m 824\u001B[0m msg \u001B[38;5;241m=\u001B[39m (\n\u001B[1;32m 825\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mReverse for \u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;132;01m%(view)s\u001B[39;00m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m not found. \u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;132;01m%(view)s\u001B[39;00m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m is not \u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m 826\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124ma valid view function or pattern name.\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;241m%\u001B[39m {\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mview\u001B[39m\u001B[38;5;124m\"\u001B[39m: lookup_view_s}\n\u001B[1;32m 827\u001B[0m )\n\u001B[0;32m--> 828\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m NoReverseMatch(msg)\n",
"\u001B[0;31mNoReverseMatch\u001B[0m: Reverse for 'wagtail' not found. 'wagtail' is not a valid view function or pattern name."
]
}
],
"source": [
"reverse(\"cast:api:wagtail\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "85ec9ffd",
"metadata": {},
"outputs": [
{
"ename": "NoReverseMatch",
"evalue": "Reverse for 'pages' not found. 'pages' is not a valid view function or pattern name.",
"output_type": "error",
"traceback": [
"\u001B[0;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[0;31mNoReverseMatch\u001B[0m Traceback (most recent call last)",
"Cell \u001B[0;32mIn[10], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[43mreverse\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[38;5;124;43mcast:api:pages\u001B[39;49m\u001B[38;5;124;43m\"\u001B[39;49m\u001B[43m)\u001B[49m\n",
"File \u001B[0;32m~/.virtualenvs/cast/lib/python3.11/site-packages/django/urls/base.py:88\u001B[0m, in \u001B[0;36mreverse\u001B[0;34m(viewname, urlconf, args, kwargs, current_app)\u001B[0m\n\u001B[1;32m 83\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m ns_pattern:\n\u001B[1;32m 84\u001B[0m resolver \u001B[38;5;241m=\u001B[39m get_ns_resolver(\n\u001B[1;32m 85\u001B[0m ns_pattern, resolver, \u001B[38;5;28mtuple\u001B[39m(ns_converters\u001B[38;5;241m.\u001B[39mitems())\n\u001B[1;32m 86\u001B[0m )\n\u001B[0;32m---> 88\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mresolver\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_reverse_with_prefix\u001B[49m\u001B[43m(\u001B[49m\u001B[43mview\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mprefix\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43margs\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[38;5;241;43m*\u001B[39;49m\u001B[43mkwargs\u001B[49m\u001B[43m)\u001B[49m\n",
"File \u001B[0;32m~/.virtualenvs/cast/lib/python3.11/site-packages/django/urls/resolvers.py:828\u001B[0m, in \u001B[0;36mURLResolver._reverse_with_prefix\u001B[0;34m(self, lookup_view, _prefix, *args, **kwargs)\u001B[0m\n\u001B[1;32m 823\u001B[0m \u001B[38;5;28;01melse\u001B[39;00m:\n\u001B[1;32m 824\u001B[0m msg \u001B[38;5;241m=\u001B[39m (\n\u001B[1;32m 825\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mReverse for \u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;132;01m%(view)s\u001B[39;00m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m not found. \u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;132;01m%(view)s\u001B[39;00m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m is not \u001B[39m\u001B[38;5;124m\"\u001B[39m\n\u001B[1;32m 826\u001B[0m \u001B[38;5;124m\"\u001B[39m\u001B[38;5;124ma valid view function or pattern name.\u001B[39m\u001B[38;5;124m\"\u001B[39m \u001B[38;5;241m%\u001B[39m {\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mview\u001B[39m\u001B[38;5;124m\"\u001B[39m: lookup_view_s}\n\u001B[1;32m 827\u001B[0m )\n\u001B[0;32m--> 828\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m NoReverseMatch(msg)\n",
"\u001B[0;31mNoReverseMatch\u001B[0m: Reverse for 'pages' not found. 'pages' is not a valid view function or pattern name."
]
"data": {
"text/plain": [
"'/cast/api/wagtail/pages/'"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"reverse(\"cast:api:pages\")"
"reverse(\"cast:api:wagtail:pages:listing\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "00b29783",
"id": "192248f9",
"metadata": {},
"outputs": [],
"source": []
Expand Down

0 comments on commit bf8418d

Please sign in to comment.