Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • erp5 erp5
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Merge requests 142
    • Merge requests 142
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedinexedi
  • erp5erp5
  • Merge requests
  • !2139

WebSite.py: fix find common part logic

  • Review changes

  • Download
  • Patches
  • Plain diff
Merged Xiaowu Zhang requested to merge xiaowu.zhang/erp5:fix/manage_main_view_on_web into master Jul 24, 2025
  • Overview 3
  • Commits 2
  • Pipelines 0
  • Changes 3

while using erp5 with python3 in renderjs interface, i found that the development mode is broken

screen-capture__1_

the reason is manage_main return something like

<!doctype html>
....
	<link rel="stylesheet" type="text/css" href="/erp5/web_site_module/renderjs_runner/bootstrap-4.6.0/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="/erp5/web_site_module/renderjs_runner/fontawesome-free-5.15.2/css/all.css" />
	<link rel="stylesheet" type="text/css" href="/erp5/web_site_module/renderjs_runner/zmi_base.css" />
	<script src="/erp5/web_site_module/renderjs_runner/jquery-3.5.1.min.js"></script>
	<script src="/erp5/web_site_module/renderjs_runner/bootstrap-4.6.0/bootstrap.bundle.min.js"></script>
	<script src="/erp5/web_site_module/renderjs_runner/ace.ajax.org/ace.js"></script>
	<script src="/erp5/web_site_module/renderjs_runner/zmi_base.js"></script>
	<script src="/erp5/web_site_module/renderjs_runner/zmi.localstorage.api.js"></script>

.....

and request to all those files return 404

image

after some search, it's because in python3, we use Zope 5.11.1

in this version, the logic to process those files are changed , instead of those in 4.8.11

in the new version, it call physicalPathToURL, which call then the our custom _physicalPathToVirtualPath

while checking the codes to find the common part

it seems there has a bug when website_path and path has nothing common

in our case above,

website_path = ('', 'erp5', 'web_site_module', 'renderjs_runner')

path = ('++resource++zmi', 'bootstrap-4.6.0', 'bootstrap.bundle.min.js')

there has no common part, common_index is already 0

but those codes are still running

if path_len > common_index + 1:
  path = website_path + path[common_index + 1:]

finally path = ('', 'erp5', 'web_site_module', 'renderjs_runner', 'bootstrap-4.6.0', 'bootstrap.bundle.min.js')

without ++resource++zmi, thus it can't be found and return 404

@jerome what do you think about the fix ?

Edited Sep 01, 2025 by Xiaowu Zhang
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: fix/manage_main_view_on_web
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7