instead of valid_command() call command_path() for errors#87
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates pg_log.py and pg_file.py to change how command path resolution is handled in two distinct ways:
- In
pg_log.py, a newcommand_path()method is added that resolves a command's full path non-destructively (without caching or error logging), and is used in error messages withinpgsystem()to display the full resolved path. - In
pg_file.py, all calls toself.valid_command(self.OBJCTCMD/self.BACKCMD, logact)are replaced with direct attribute access (self.OBJCTCMD/self.BACKCMD), since command validation is no longer the responsibility of the callers. A typo in a comment ("carrage" → "carriage") is also fixed.
Changes:
pg_log.py: Addedcommand_path()method and used it (instead ofvalid_command()) for error message formatting inpgsystem(), plus a comment typo fix.pg_file.py: Removed allvalid_command()call wrappers aroundOBJCTCMD/BACKCMD, using the raw attribute values directly.pyproject.toml: Version bumped from2.0.18to2.0.19.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/rda_python_common/pg_log.py |
Adds command_path() method; applies it in pgsystem() error messages; fixes "carriage" comment typo |
src/rda_python_common/pg_file.py |
Replaces self.valid_command(…) with direct attribute access for OBJCTCMD and BACKCMD |
pyproject.toml |
Version bump to 2.0.19 |
There are two critical bugs introduced in pg_log.py:
-
Line 673 —
command_path(cmdstr)is called as a bare function, but it is an instance method. This will raiseNameErrorat runtime every timepgsystem()encounters an error. It must beself.command_path(cmdstr). -
Line 877 —
reutnis aSyntaxError(should bereturn). This will prevent the entirepg_logmodule from loading, breaking all functionality in the package.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
No description provided.