Ticket #67 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

multiple problems with ControllerCommand

Reported by: chuck Owned by: pjenvey
Priority: normal Milestone: 0.9.2
Component: controllers Version:
Severity: minor Keywords:
Cc:

Description

the ControllerCommand? class used for the paster script has a number of problems:

  • The --verbose parameter does not work since it hardwires a verbosity level of 3
  • The --simulate parameter does not work since it is never passed to the file operation objects
  • Controllers that conflict with an existing module are permitted

The last one is not really the fault of the ControllerCommand? class but more of a python issue; there are some tricks to get around it but I'm not familiar with them. Still, when such a controller is created, it breaks all the other controllers, which is not really A Good Thing, so the command should try to prevent this imminent breakage.

I have posted a modified version of this class on Users/Chuck/CodePad. Sorry for not making it a patch, but there's so many changes that a patch probably wouldn't be very clear anyway.

Change History

comment:1 Changed 3 years ago by anonymous

  • owner changed from thejimmyg to anonymous
  • status changed from new to assigned
  • milestone set to 0.9

comment:2 Changed 3 years ago by bbangert

  • owner changed from anonymous to bbangert
  • status changed from assigned to new

comment:3 Changed 3 years ago by pjenvey

  • owner changed from bbangert to pjenvey

comment:4 Changed 3 years ago by pjenvey

Thanks for fixing this stuff up. Patches are always preferable no matter how destructive =]

There's a problem with validate_name though -- the import statement can clash with any existing module

e.g. paster controller os

The import would need to be more specific. But another small issue arises when importing a controller also might raise an exception (say a SyntaxError?, or a MyControllerIsBrokenRightNowException?). We'd really need to except Exception: to catch all the potential ones, which in general isn't a good idea (not really a big deal here). But the alternative, checking for pre-existing via os.path.exists or the like, is probably preferable

Let me know if you wanna fix this stuff, otherwise Ben or I might have a go at it later this week

Also I'll make a note of it here so I don't forget: The extra 'fullname' and 'lname' template_vars this ControllerCommand? sets up don't appear to be in use any longer, so they should be removed

comment:5 Changed 3 years ago by bbangert

  • milestone changed from 0.9 to 1.0

comment:6 Changed 3 years ago by bbangert

  • milestone changed from 1.0 to 0.9.1

comment:7 Changed 3 years ago by pjenvey

  • milestone changed from 0.9.1 to 0.9.2

comment:8 Changed 3 years ago by bbangert

  • status changed from new to closed
  • resolution set to fixed

(In [1250]) Fixed controller command to check controller name and refuse to create

controllers that have name clashes with existing modules that could be imported. Reported (with patch) by Chuck Adams. Fixes #67.

comment:9 Changed 3 years ago by bbangert

(In [1268]) * Fixes bug with prior fix for #67. Wasn't properly testing the full package

name to include the current project which would incorrectly restrict valid controller names (refs #67).

comment:10 Changed 3 years ago by bbangert

(In [1269]) * Switching back to prior controller import check, throwing a more detailed

error with a suggest fix should the user really want a URL with that name in it. (refs #67)

Note: See TracTickets for help on using tickets.


Powered by Pylons - Contact Administrators