Skip to content
This repository was archived by the owner on May 30, 2020. It is now read-only.

destroy documentation using warehouse now #787

Merged
merged 1 commit into from
Mar 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions templates/pkg_edit.pt
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,14 @@ uncheck the button below</p>

<p>If you would like to <b>DESTROY</b> any existing documentation hosted at
<a tal:attributes="href string:http://pythonhosted.org/${data/name}"
tal:content="string:http://pythonhosted.org/${data/name}"></a>
Use this button, There is <b>no undo</b>.
tal:content="string:http://pythonhosted.org/${data/name}"></a>: Please use
<tal:x tal:condition="python:'testpypi' in app.config.url">
<a href="https://test.pypi.org/manage/projects/">the Warehouse test instance</a>
</tal:x>
<tal:x tal:condition="python:'testpypi' not in app.config.url">
<a href="https://pypi.org/manage/projects/">Warehouse</a>
</tal:x>
</p>
<form tal:attributes="action app/url_path" method="POST"
enctype="multipart/form-data">
<input type="hidden" name=":action" value="doc_destroy" />
<input type="hidden" name="name" tal:attributes="value data/name" />
<input type="submit" value="Destroy Documentation" />
</form>

<p></p>

</metal:fill>
Expand Down
45 changes: 0 additions & 45 deletions webui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2456,51 +2456,6 @@ def doc_upload(self):
)
)

#
# Documentation Destruction
#
@must_tls
def doc_destroy(self):
# make sure the user is identified
if not self.authenticated:
raise Unauthorised, \
"You must be identified to edit package information"

# only allow via WebUI
self.csrf_check()

# figure the package name and version
name = version = None
if self.form.has_key('name'):
name = self.form['name']
if not name:
raise FormError, 'No package name given'

# make sure the user has permission to do stuff
if not (self.store.has_role('Owner', name) or
self.store.has_role('Admin', name) or
self.store.has_role('Maintainer', name)):
raise Forbidden, \
"You are not allowed to edit '%s' package information"%name

try:
self.store.lock_docs(name)
except store.LockedException:
raise FormError, "Error: Another doc modification is in progress."

# Assume the file is valid; remove any previous data
if self.docs_fs.exists(name):
for dirname, files in self.docs_fs.walk(name, search="depth"):
for filename in files:
self.docs_fs.remove(os.path.join(dirname, filename))
self.docs_fs.removedir(dirname)

self.store.set_has_docs(name, value=False)
self.store.log_docs(name, version, 'docdestroy')
self.store.changed()
self.write_template('message.pt', title='Documentation Destroyed',
message='Documentation Destroyed for %s.' % (name,),)

#
# Reverse download for Google AppEngine
#
Expand Down