ubccr / coldfront

HPC Resource Allocation System
https://coldfront.readthedocs.io
GNU General Public License v3.0
96 stars 76 forks source link

AllocationAttribute clean method exception handling #588

Open claire-peters opened 7 months ago

claire-peters commented 7 months ago

The current use of literal_eval in coldfront.core.allocation.models.AllocationAttribute.clean causes the entry of a value with nonnumeric characters (e.g., "1000TB", "150%") for an AllocationAttribute with a numeric AllocationAttributeType to produce an EOF error. The code changes in this PR consist of the addition of smoother exception handling for such cases and unit tests for the AllocationAttribute model.

I also deleted a few imports in the Allocation model module that weren't in use, and my code editor automatically removed trailing whitespace where present. Can remove those changes if they present problems.