Commit eed0e738 authored by Roque's avatar Roque

[ERP5 Master appstore_base] refactor documents app creation

See merge request !1522
parents ce7d2e8e 9a1e5fa6
...@@ -76,6 +76,14 @@ base_length = len(getBaseDirectory(zip_reader.namelist())) ...@@ -76,6 +76,14 @@ base_length = len(getBaseDirectory(zip_reader.namelist()))
tag = "preparing_sr_%s" % software_release_url tag = "preparing_sr_%s" % software_release_url
default_page = "" default_page = ""
web_manifest_url = None 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(): for name in zip_reader.namelist():
if zip_reader.getinfo(name).file_size == 0: if zip_reader.getinfo(name).file_size == 0:
continue continue
...@@ -87,7 +95,7 @@ for name in zip_reader.namelist(): ...@@ -87,7 +95,7 @@ for name in zip_reader.namelist():
else: else:
publication_section = application_publication_section.getRelativeUrl() publication_section = application_publication_section.getRelativeUrl()
document = portal.portal_contributions.newContent( document = portal.document_module.newContent(
file=temp_file, file=temp_file,
filename=url, filename=url,
redirect_to_document=False, redirect_to_document=False,
...@@ -98,19 +106,16 @@ for name in zip_reader.namelist(): ...@@ -98,19 +106,16 @@ for name in zip_reader.namelist():
publication_section_value=publication_section, publication_section_value=publication_section,
follow_up=software_release_url, follow_up=software_release_url,
portal_type="File", 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 # XX Hackish
document.setCategoryList( document.setCategoryList(
document.getCategoryList() + [publication_source_category]) document.getCategoryList() + [publication_source_category])
if url in ("index.html", "index.htm"): if url in ("index.html", "index.htm"):
default_page = document.getRelativeUrl() default_page = document.getRelativeUrl()
web_manifest_url = extractWebManifest(document.getData()) 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) 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