mgaitan / waliki

A wiki engine powered by Django and Git
http://waliki.pythonanywhere.com
BSD 3-Clause "New" or "Revised" License
309 stars 56 forks source link

waliki_box fails with missing slug #40

Closed mgaitan closed 9 years ago

mgaitan commented 9 years ago
Environment:

Request Method: GET
Request URL: http://beta.python.org.ar/lista/

Django Version: 1.7.1
Python Version: 3.3.6
Installed Applications:
('django.contrib.admin',
 'django.contrib.sites',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'community',
 'news',
 'pycompanies',
 'jobs',
 'events',
 'newbie',
 'projects',
 'faq',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'django_extensions',
 'disqus',
 'taggit',
 'taggit_autosuggest',
 'bootstrap3_datetime',
 'planet',
 'pagination',
 'tagging',
 'bootstrap3',
 'django_summernote',
 'sendfile',
 'crispy_forms',
 'email_obfuscator',
 'waliki',
 'waliki.git',
 'waliki.attachments')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.gzip.GZipMiddleware',
 'pagination.middleware.PaginationMiddleware')

Template error:
In template /home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/templates/waliki/box.html, error at line 32
   Reverse for 'waliki_detail' with arguments '('',)' and keyword arguments '{}' not found. 1 pattern(s) tried: ['wiki/(?P<slug>[a-zA-Z0-9-_\\/]+)$']
   22 :             </form>

   23 :             </div><!-- /.modal-content -->

   24 :           </div><!-- /.modal-dialog -->

   25 :         </div><!-- /.modal -->

   26 : {% endif %}

   27 : 

   28 : <div id="content_{{ label }}" class="content-box {% if form %}editable{% endif %}">

   29 :     {% if form %}

   30 :         <button type="button" data-toggle="modal" data-target="#edit_{{ label }}" class="btn btn-default" title="{% trans 'Edit this content' %}"><span class="glyphicon glyphicon-pencil"></span></button>

   31 :     {% endif %}

   32 :      {{ page.body|safe }} 

   33 : </div>

Traceback:
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/www-pyar/pyarweb_beta/pyarweb/pyarweb/views.py" in special_page
  19.     return render(request, 'special_page.html', kwargs)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/shortcuts.py" in render
  48.     return HttpResponse(loader.render_to_string(*args, **kwargs),
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader.py" in render_to_string
  178.         return t.render(context_instance)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  148.             return self._render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader_tags.py" in render
  126.         return compiled_parent._render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in _render
  142.         return self.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/loader_tags.py" in render
  65.                 result = block.nodelist.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  1231.                     return self.nodelist.render(new_context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in render
  844.                 bit = self.render_node(node, context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render_node
  80.             return node.render(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/debug.py" in render
  90.             output = self.filter_expression.resolve(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in resolve
  596.                 obj = self.var.resolve(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in resolve
  734.             value = self._resolve_lookup(context)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/template/base.py" in _resolve_lookup
  770.                         current = getattr(current, bit)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/models.py" in body
  133.         return self.get_cached_content()
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/models.py" in get_cached_content
  152.             cached_content = self._get_part('get_document_body')
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/models.py" in _get_part
  127.             return getattr(self.markup_, part)(self.raw)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/_markups.py" in get_document_body
  91.                              for ref in refs)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/_markups.py" in <genexpr>
  91.                              for ref in refs)
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/src/waliki/waliki/utils.py" in get_url
  32.     return reverse('waliki_detail', args=(get_slug(text),))
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/core/urlresolvers.py" in reverse
  551.     return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
File "/home/www-pyar/pyarweb_beta/pyarweb_venv/lib/python3.3/site-packages/django/core/urlresolvers.py" in _reverse_with_prefix
  468.                              (lookup_view_s, args, kwargs, len(patterns), patterns))

Exception Type: NoReverseMatch at /lista/
Exception Value: Reverse for 'waliki_detail' with arguments '('',)' and keyword arguments '{}' not found. 1 pattern(s) tried: ['wiki/(?P<slug>[a-zA-Z0-9-_\\/]+)$']
mgaitan commented 9 years ago

get_slug() could return an empty slug, then reverse fails trying to construct the url