Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
erp5 erp5
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 139
    • Merge requests 139
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • erp5erp5
  • Merge requests
  • !1489

Merged
Created Sep 15, 2021 by Vincent Pelletier@vpelletierOwner

WSGIPublisher improvements

  • Overview 12
  • Commits 4
  • Changes 1

Here are assorted WSGIPublisher improvements. The use-cases which triggered the issues fixed here are:

A dry-run script

# parameters: RESPONSE=None, dry=True
print 'foo'
doSomething()
if dry:
  print 'DRY RUN'
  RESPONSE.write(printed)
  raise Exception('Dry run') # So transaction is rolled back
return printed

Without these changes, the output is the concatenation of whatever was printed here, with the standard error page. The response headers come from the error page, so the printed statements are typically rendered as HTML, which is incorrect.

A web API implementation

Such implementation must have full control over any combination of:

  • transaction rollback/commit (IOW: raise an exception or not)
  • response status: such code may raise an exception unknown to the publisher, which would usually end up as a 500 response. But it may have positionned a specific status, which must be preserved by the publisher.
  • response headers: such code may disable the use of standard error pages in order to preserve a set of carefuly chosen headers
  • response body: likewise, with the standard error disabled, such code should be able to achieve total control over the response's body

All these work fine with Medusa (non-WSGI) and were broken when switching to WSGI. These changes resolves these divergences.

Unittests are currently running on this code (as of this writing: testrunner3).

/cc @jm as I believe you oversaw the original work

/cc @georgios.dagkakis as I believe you have noticed the dry-run breakage: a solution is comming !

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: wsgipublisher_fixes
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7