Renaming controllers

2007-03-13 Thread Christoph Haas

Evening,

yesterday I had to rename a controller because the concept of my 
application has changed a little. So I wondered which files I needed to 
change. What I did:

- rename controllers/old.py to controllers/new.py
- edit controllers/new.py and rename the class name
- go into tests/ and change things there

Then I decided to search for further occurenced and found 
foobar.egg-info/SOURCES.txt which I would have to change. Or is that 
maintained automatically? It seems to adapt the changes when I run python 
setup.py bdist_egg.

So today's question is what I would need to do to change controllers. 
Creating them is easy from the template. But how do I get rid of them? 
Where else is information stored about them?

I once tried to rename my whole project and had so many weird errors that I 
decided to never try that again. :(

 Christoph

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



RE: Renaming controllers

2007-03-13 Thread John_Nowlan

I and others here have been bitten by renaming controllers. 

I think it is a common python practice/pattern to inspect/use a 'base' name.

In short I think the controller module must contain a controller called 
'FooController'

i.e.
foo.py contains 
class FooController(BaseController):

This could be better emphasized/explained in the docs, imho.

See:
http://groups.google.ca/group/pylons-discuss/browse_thread/thread/17882a9f1b05b380/88ce975f0d68abb9?lnk=gstq=rnum=6hl=en#88ce975f0d68abb9

I'm assuming this is what the Django devs meant when they put out a release 
that took out all 'magic' from the codebase.


 -Original Message-
 From: pylons-discuss@googlegroups.com
 [mailto:[EMAIL PROTECTED] Behalf Of Christoph Haas
 Sent: Tuesday, March 13, 2007 12:17 PM
 To: pylons-discuss@googlegroups.com
 Subject: Renaming controllers
 
 
 
 Evening,
 
 yesterday I had to rename a controller because the concept of my 
 application has changed a little. So I wondered which files I 
 needed to 
 change. What I did:
 
 - rename controllers/old.py to controllers/new.py
 - edit controllers/new.py and rename the class name
 - go into tests/ and change things there
 
 Then I decided to search for further occurenced and found 
 foobar.egg-info/SOURCES.txt which I would have to change. Or is that 
 maintained automatically? It seems to adapt the changes when 
 I run python 
 setup.py bdist_egg.
 
 So today's question is what I would need to do to change controllers. 
 Creating them is easy from the template. But how do I get rid 
 of them? 
 Where else is information stored about them?
 
 I once tried to rename my whole project and had so many weird 
 errors that I 
 decided to never try that again. :(
 
  Christoph
 
  
 

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---



Re: Renaming controllers

2007-03-13 Thread Christoph Haas

On Tuesday 13 March 2007 17:51, John_Nowlan wrote:
 I and others here have been bitten by renaming controllers.

 I think it is a common python practice/pattern to inspect/use a 'base'
 name.

 In short I think the controller module must contain a controller called
 'FooController'

So far so good. I read the Pylons Execution Analysis and that makes it 
clear that the controller class that is searched for is FooController.

Blasphemy: if there is only one controller class per module file anyway 
then why does the controller name has to be both in the filename and in 
the class name? The redundancy looks like:

controllers/__init__.py
controllers/foo.py:
class FooController...
controllers/bar.py:
class BarController...

What about:

controllers/__init__.py
controllers/foo.py:
class Controller...
controllers/bar.py:
class Controller...

Or perhaps:

controllers/__init__.py:
class Foo...
class Bar...

I believe that renaming controllers is pretty common in a project. So 
removing redundancy might be nice.

 Christoph

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
pylons-discuss group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~--~~~~--~~--~--~---