This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
devel:blueprints:refactor-mod-python-to-django [2011/03/09 09:10] morten [Suggested refactoring steps] |
devel:blueprints:refactor-mod-python-to-django [2012/10/03 08:29] (current) morten old revision restored |
||
---|---|---|---|
Line 26: | Line 26: | ||
* Deconstruct the URI dispatcher into a Django urlconfig. | * Deconstruct the URI dispatcher into a Django urlconfig. | ||
* Refactor each of the newly created view functions: | * Refactor each of the newly created view functions: | ||
- | * Usage of mod_python's ''FieldStorage'' class to extract GET/POST parameters must be refactored to use the GET, POST or REQUEST attributes of the incoming Django request structure. | + | * Usage of mod_python's ''FieldStorage'' class, or NAV's ''nav.web.URI.URI'' class, to extract GET/POST parameters must be refactored to use the GET, POST or REQUEST attributes of the incoming Django request structure. |
* Create a ''HttpResponse'' object, feeding it the output of the template's ''respond()'' method, and return this response object instead of an ''apache.OK''. | * Create a ''HttpResponse'' object, feeding it the output of the template's ''respond()'' method, and return this response object instead of an ''apache.OK''. | ||
Line 49: | Line 49: | ||
Examine these changesets: | Examine these changesets: | ||
- | * [[http://metanav.uninett.no/hg/series/3.8.x/rev/61a95ac14564|Refactoring the Netmap backend handler]] | + | * [[http://nav.uninett.no/hg/default/rev/61a95ac14564|Refactoring the Netmap backend handler]] |
- | * [[http://metanav.uninett.no/hg/series/3.8.x/rev/1409829b73bc|Refactoring the sortedStats handler]] | + | * [[http://nav.uninett.no/hg/default/rev/1409829b73bc|Refactoring the sortedStats handler]] |
:!: It's probably better to portion out your refactoring in multiple changesets which make your changes easier to follow. That's one of the things DVCS'es are for. | :!: It's probably better to portion out your refactoring in multiple changesets which make your changes easier to follow. That's one of the things DVCS'es are for. | ||