Commit eed0e738 authored by Roque's avatar Roque

[ERP5 Master appstore_base] refactor documents app creation

See merge request nexedi/erp5!1522
parents ce7d2e8e 9a1e5fa6
......@@ -76,6 +76,14 @@ base_length = len(getBaseDirectory(zip_reader.namelist()))
tag = "preparing_sr_%s" % software_release_url
default_page = ""
web_manifest_url = None
doc_tag = "creating_doc_for_%s" % software_release_url
try:
publication_source_category = "contributor/" + software_publication.getSource()
except TypeError:
rejectSoftwarePublication(software_publication)
return
for name in zip_reader.namelist():
if zip_reader.getinfo(name).file_size == 0:
continue
......@@ -87,7 +95,7 @@ for name in zip_reader.namelist():
else:
publication_section = application_publication_section.getRelativeUrl()
document = portal.portal_contributions.newContent(
document = portal.document_module.newContent(
file=temp_file,
filename=url,
redirect_to_document=False,
......@@ -98,19 +106,16 @@ for name in zip_reader.namelist():
publication_section_value=publication_section,
follow_up=software_release_url,
portal_type="File",
activate_kw=dict(tag=doc_tag)
)
try:
publication_source_category = "contributor/" + software_publication.getSource()
except TypeError:
rejectSoftwarePublication(software_publication)
return
# XX Hackish
document.setCategoryList(
document.getCategoryList() + [publication_source_category])
if url in ("index.html", "index.htm"):
default_page = document.getRelativeUrl()
web_manifest_url = extractWebManifest(document.getData())
document.activate(tag=tag).publish()
document.activate(tag=tag, after_tag=doc_tag).publish()
software_release.SoftwareRelease_fixRelatedWebSection(default_page=default_page, web_manifest = web_manifest_url)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment