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
  • !825

Merged
Created Jan 18, 2019 by Jérome Perrin@jeromeOwner

administration: fix BT's "Check Python Code" with coding flag

  • Overview 2
  • Commits 1
  • Changes 1

According to pep-0263, python scripts can define encoding magic on first or second line. If we use for example such a script:

  # coding: utf-8
  return "héhé"

then using .read() was wrong, because it return the script with headers, ie:

  ## Script (Python) "test_coding"
  ##bind container=container
  ##bind context=context
  ##bind namespace=
  ##bind script=script
  ##bind subpath=traverse_subpath
  ##parameters=
  ##title=
  ##
  # coding: utf-8
  return "héhé"

so the coding magic is no longer in first line and pylint complains with error like:

Cannot decode using encoding "ascii", unexpected byte at position 11 (invalid-encoded-data)]

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