Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for illformatted rest #4

Merged
merged 2 commits into from

2 participants

@fizyk

I had illformatted rest documentation. had this lines in my plugin's description:

..code-block::
    [app:main]
    ....
    env = project environment

I was able to upload, but unfortunately I wasn't able to display package's description.
Instead, I get this error (along with long backtrace):

013-03-15 23:33:03,823 INFO  [pyshop.views.base][Dummy-2] dispatch view Show
<string>:35: (WARNING/2) Title underline too short.

[app:main]
....
<string>:35: (SEVERE/4) Unexpected section title.

[app:main]

Here's my fix for this issue.

@mardiros mardiros merged commit 2a61a03 into mardiros:master
@fizyk

hey, I thought a little bit about this, and since cheeseshop is doing the same, we shouldn't try to do anything more here, than display the raw rest in pre tags

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 15, 2013
  1. @fizyk
  2. @fizyk

    display in pre

    fizyk authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 13 deletions.
  1. +9 −5 pyshop/helpers/restxt.py
  2. +6 −8 pyshop/views/simple.py
View
14 pyshop/helpers/restxt.py
@@ -1,10 +1,14 @@
from docutils import core
+from docutils.utils import SystemMessage
from jinja2 import Markup
def parse_rest(rest):
- html = core.publish_string(
- source=rest,
- writer_name='html',
- settings_overrides={'output_encoding': 'unicode'})
- return Markup(html[html.find('<body>')+6:html.find('</body>')].strip())
+ try:
+ html = core.publish_string(
+ source=rest,
+ writer_name='html',
+ settings_overrides={'output_encoding': 'unicode'})
+ return Markup(html[html.find('<body>') + 6:html.find('</body>')].strip())
+ except SystemMessage:
+ return Markup('<pre>' + rest + '</pre>')
View
14 pyshop/views/simple.py
@@ -30,21 +30,21 @@ def render(self):
settings = self.request.registry.settings
username = authenticated_userid(self.request)
if not username:
- raise exc.HTTPForbidden()
+ raise exc.HTTPForbidden()
remote_user = User.by_login(self.session, username)
if not remote_user:
raise exc.HTTPForbidden()
-
params = self.request.params
if (asbool(settings['pyshop.upload.satanize'])
and not re.match(settings['pyshop.upload.satanize.regex'],
- params['version']
- )):
+ params['version']
+ )):
raise exc.HTTPForbidden()
+ print type(params['name'])
pkg = Package.by_name(self.session, params['name'])
if pkg:
auth = [user for user in pkg.owners + pkg.maintainers
@@ -62,7 +62,7 @@ def render(self):
{u'sdist': u'tar.gz',
u'bdist_egg': u'egg',
u'bdist_msi': u'msi',
- u'bdist_dmg': u'zip', # XXX or gztar ?
+ u'bdist_dmg': u'zip', # XXX or gztar ?
u'bdist_rpm': u'rpm',
u'bdist_dumb': u'msi',
u'bdist_wininst': u'exe',
@@ -83,13 +83,12 @@ def render(self):
with open(filepath, 'wb') as output_file:
input_file.seek(0)
while True:
- data = input_file.read(2<<16)
+ data = input_file.read(2 << 16)
if not data:
break
size += len(data)
output_file.write(data)
-
release = Release.by_version(self.session, pkg.name,
params['version'])
if not release:
@@ -197,7 +196,6 @@ def _create_release_file(self, release, data):
def render(self):
-
api = pypi.proxy
settings = self.request.registry.settings
satanize = asbool(settings['pyshop.mirror.satanize'])
Something went wrong with that request. Please try again.