<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/wordpress-mu-1.2.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments for Topp Engineering</title>
	<link>http://www.openplans.org/projects/topp-engineering/blog</link>
	<description>Just another  weblog</description>
	<pubDate>Tue, 02 Dec 2008 00:26:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=wordpress-mu-1.2.5</generator>

	<item>
		<title>Comment on Beautiful Application File Layouts by whit</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-50</link>
		<dc:creator>whit</dc:creator>
		<pubDate>Mon, 10 Nov 2008 16:57:57 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-50</guid>
		<description>@ian: in the case of almanac, it stems from the historical reason that this is how openlayers is laid out.

for designers, they could care less whether templates are served directly or not.  and really, developers should not care either as long as it's easy to know how the templates are connected to the behavior that powers them.

@nick: addressing the historical reasons are important because it addresses how things got to be less than desirable and allows inspection of how such a condition may be remedied or avoided.   I am pointing a finger at the almanac... if it's something to be set up as an example of problematic practices (or is difficult for new developers to work in), then you guys need to be fixing that.</description>
		<content:encoded><![CDATA[<p>@ian: in the case of almanac, it stems from the historical reason that this is how openlayers is laid out.</p>
<p>for designers, they could care less whether templates are served directly or not.  and really, developers should not care either as long as it&#8217;s easy to know how the templates are connected to the behavior that powers them.</p>
<p>@nick: addressing the historical reasons are important because it addresses how things got to be less than desirable and allows inspection of how such a condition may be remedied or avoided.   I am pointing a finger at the almanac&#8230; if it&#8217;s something to be set up as an example of problematic practices (or is difficult for new developers to work in), then you guys need to be fixing that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful Application File Layouts by ianb</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-49</link>
		<dc:creator>ianb</dc:creator>
		<pubDate>Fri, 07 Nov 2008 21:16:15 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-49</guid>
		<description>Here's a question: is it necessary to have separate directories for images, Javascript, stylesheets?  Doesn't the extension of a file kind of make it clear?  There is a reason to keep these separate from templates -- at least in a different directory -- because templates aren't served directly.</description>
		<content:encoded><![CDATA[<p>Here&#8217;s a question: is it necessary to have separate directories for images, Javascript, stylesheets?  Doesn&#8217;t the extension of a file kind of make it clear?  There is a reason to keep these separate from templates &#8212; at least in a different directory &#8212; because templates aren&#8217;t served directly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on What Bothers Me About The Component Architecture by ianb</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/10/20/what-bothers-me-about-the-component-architecture/#comment-48</link>
		<dc:creator>ianb</dc:creator>
		<pubDate>Fri, 07 Nov 2008 21:08:05 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/10/20/what-bothers-me-about-the-component-architecture/#comment-48</guid>
		<description>Malthe: In complicated circumstances I'm personally apt to simply write my own dispatcher.  In an ideal world this is both pretty easy, and can be done imperatively (imperative code is almost always easier to think about than declarative, in my experience -- and I say that as someone who is constantly fighting a natural inclination to write declarative code).  Also dispatch can happen at multiple levels.  A typical way to handle Ajax vs. non-Ajax calls would be through a custom decorator or class (in Pylons you'd put it in your Controller subclass, in TurboGears probably in some decorator).  This essentially does a second dispatch -- but it also has the advantage that you can easily put special hacks in that dispatch.  For instance, maybe your dispatch only relates to HTML, so you can ignore it for non-HTML responses.  Maybe you'll look up a special method or add an argument to the signature of the function, but you'll want a fallback for views that really just don't care about the Ajaxness of the request (e.g., something that returns JSON regardless of who asks for it).  Maybe in summary, I'll respond to your claim:

"In any web framework, there’s a request coming in. Some where down the code chain, decision are made based on what this request is all about, perhaps foremost based on its path and query string.

"However, it may also depend on such things as language, method and the type of data the request is looking for in a response. We’re talking about intrinsic qualities of the request, not details like which theme to apply, or other application-specific qualities."

I don't think the framework has to handle all these cases.  Dispatch should not be at the sole discretion of the framework -- it should always be possible to add dispatch to your application.  Abstraction can happen at any layer.  If you have these needs, writing a dozen lines of code to handle that is the simplest and easiest to maintain method (and really none of these use cases call for more than 10-20 lines of code).

Brandon: I suspect for most cases (maybe all non-diabolical cases) that the constant factor in the O(n) vs. O(log n) cases overwhelms n, and that the simpler solution will be faster.  In a dispatching system like Routes the n will almost always be small, because most potential routes will be eliminated due to path matching (which is quite fast), and the functions are only run on a handful of routes.  If you have a system resistant to path matching then it's often quite reasonable to do some other kind of dispatching in code, e.g., route different requests through a single "view" that then does some dictionary lookups and function calls to dispatch to a real view.  Anyone can make a dictionary of functions, you don't need to be a framework wizard to do so.

As to generality: In Routes the matchers are ordered, so if you have a more specific match then you must order that before the less specific match.  If you have the code in hand (which in Pylons you do have) then this is trivial (though admittedly it's easy to get the ordering wrong, it's something I do fairly often).  Otherwise you don't have that code then you do have to figure out some way of indicating priority.  ZCA provides one way of doing that through the specificity implicit in inheritance -- but that doesn't make it *easy*.  Does IPDFDocument subclass IGETRequest?  Probably not, and then you are in just as annoying a place.  Again, when things get complicated, writing your own dispatch using dictionaries and functions is easy: do more of that!</description>
		<content:encoded><![CDATA[<p>Malthe: In complicated circumstances I&#8217;m personally apt to simply write my own dispatcher.  In an ideal world this is both pretty easy, and can be done imperatively (imperative code is almost always easier to think about than declarative, in my experience &#8212; and I say that as someone who is constantly fighting a natural inclination to write declarative code).  Also dispatch can happen at multiple levels.  A typical way to handle Ajax vs. non-Ajax calls would be through a custom decorator or class (in Pylons you&#8217;d put it in your Controller subclass, in TurboGears probably in some decorator).  This essentially does a second dispatch &#8212; but it also has the advantage that you can easily put special hacks in that dispatch.  For instance, maybe your dispatch only relates to HTML, so you can ignore it for non-HTML responses.  Maybe you&#8217;ll look up a special method or add an argument to the signature of the function, but you&#8217;ll want a fallback for views that really just don&#8217;t care about the Ajaxness of the request (e.g., something that returns JSON regardless of who asks for it).  Maybe in summary, I&#8217;ll respond to your claim:</p>
<p>&#8220;In any web framework, there’s a request coming in. Some where down the code chain, decision are made based on what this request is all about, perhaps foremost based on its path and query string.</p>
<p>&#8220;However, it may also depend on such things as language, method and the type of data the request is looking for in a response. We’re talking about intrinsic qualities of the request, not details like which theme to apply, or other application-specific qualities.&#8221;</p>
<p>I don&#8217;t think the framework has to handle all these cases.  Dispatch should not be at the sole discretion of the framework &#8212; it should always be possible to add dispatch to your application.  Abstraction can happen at any layer.  If you have these needs, writing a dozen lines of code to handle that is the simplest and easiest to maintain method (and really none of these use cases call for more than 10-20 lines of code).</p>
<p>Brandon: I suspect for most cases (maybe all non-diabolical cases) that the constant factor in the O(n) vs. O(log n) cases overwhelms n, and that the simpler solution will be faster.  In a dispatching system like Routes the n will almost always be small, because most potential routes will be eliminated due to path matching (which is quite fast), and the functions are only run on a handful of routes.  If you have a system resistant to path matching then it&#8217;s often quite reasonable to do some other kind of dispatching in code, e.g., route different requests through a single &#8220;view&#8221; that then does some dictionary lookups and function calls to dispatch to a real view.  Anyone can make a dictionary of functions, you don&#8217;t need to be a framework wizard to do so.</p>
<p>As to generality: In Routes the matchers are ordered, so if you have a more specific match then you must order that before the less specific match.  If you have the code in hand (which in Pylons you do have) then this is trivial (though admittedly it&#8217;s easy to get the ordering wrong, it&#8217;s something I do fairly often).  Otherwise you don&#8217;t have that code then you do have to figure out some way of indicating priority.  ZCA provides one way of doing that through the specificity implicit in inheritance &#8212; but that doesn&#8217;t make it *easy*.  Does IPDFDocument subclass IGETRequest?  Probably not, and then you are in just as annoying a place.  Again, when things get complicated, writing your own dispatch using dictionaries and functions is easy: do more of that!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful Application File Layouts by nickyg</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-47</link>
		<dc:creator>nickyg</dc:creator>
		<pubDate>Fri, 07 Nov 2008 17:38:47 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-47</guid>
		<description>Thanks Whit.  And, I also want to make it clear that I'm *really* not trying to point fingers at the Almanac; I understand that many factors over time contribute to these things.  Plus, there are plenty of examples of confusing &#38; complicated file layouts; this is just the one I've been looking at most recently.  

Anyway, I'm just hoping to raise some awareness about this to we can try and keep things as easy as possible in the future.</description>
		<content:encoded><![CDATA[<p>Thanks Whit.  And, I also want to make it clear that I&#8217;m *really* not trying to point fingers at the Almanac; I understand that many factors over time contribute to these things.  Plus, there are plenty of examples of confusing &amp; complicated file layouts; this is just the one I&#8217;ve been looking at most recently.  </p>
<p>Anyway, I&#8217;m just hoping to raise some awareness about this to we can try and keep things as easy as possible in the future.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful Application File Layouts by whit</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-45</link>
		<dc:creator>whit</dc:creator>
		<pubDate>Fri, 07 Nov 2008 17:30:58 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-45</guid>
		<description>as the person that was responsible for the genesis of that layout I think it's worth making a couple points.

1. resources used to be in /src/resource (with all the other editable code).   this change when someone decided to work around a broken piece of the build rather than fix it.

2. pylons layout is that of a single application, whereas the almanac is a build dealing with multiple applications.  In almanace "/path/to/application/" == "/src/CommunityAlmanac/opengeo/almanac/"

The resources are served entirely by nginx (rather than by zope or some python app-server).  There was a practical reason for this in the beginning; it allowed our javascript guys to start work in parallel to the server application.  Much of the css + js layout is that of default OpenLayers.

3. you can/should change this to be simpler.  the layout evolved over time (generally under time pressure) and like anything evolving occasionally requires some refactoring.  Doing so require two things: understanding what the old layout was doing, and how to use buildout: writing recipes, making existing ones do what you want.   nginx could point directly to /src/CommunityAlmanac/opengeo/almanac/resources/*, you could flatten the resource directory (provided you reset the javascript compression config) etc.

so yeah, this can be fixed, but there has to be an adequate time and effort and communication dedicated to doing it. and if that time isn't available, new developers should not just be thrown blindly into something as complex as the almanac in mid-development.   with robianski and ethan, I took alot of time explaining the layout and structure, how things could be improved, etc.

so go make it better.</description>
		<content:encoded><![CDATA[<p>as the person that was responsible for the genesis of that layout I think it&#8217;s worth making a couple points.</p>
<p>1. resources used to be in /src/resource (with all the other editable code).   this change when someone decided to work around a broken piece of the build rather than fix it.</p>
<p>2. pylons layout is that of a single application, whereas the almanac is a build dealing with multiple applications.  In almanace &#8220;/path/to/application/&#8221; == &#8220;/src/CommunityAlmanac/opengeo/almanac/&#8221;</p>
<p>The resources are served entirely by nginx (rather than by zope or some python app-server).  There was a practical reason for this in the beginning; it allowed our javascript guys to start work in parallel to the server application.  Much of the css + js layout is that of default OpenLayers.</p>
<p>3. you can/should change this to be simpler.  the layout evolved over time (generally under time pressure) and like anything evolving occasionally requires some refactoring.  Doing so require two things: understanding what the old layout was doing, and how to use buildout: writing recipes, making existing ones do what you want.   nginx could point directly to /src/CommunityAlmanac/opengeo/almanac/resources/*, you could flatten the resource directory (provided you reset the javascript compression config) etc.</p>
<p>so yeah, this can be fixed, but there has to be an adequate time and effort and communication dedicated to doing it. and if that time isn&#8217;t available, new developers should not just be thrown blindly into something as complex as the almanac in mid-development.   with robianski and ethan, I took alot of time explaining the layout and structure, how things could be improved, etc.</p>
<p>so go make it better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful Application File Layouts by Paul Winkler</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-44</link>
		<dc:creator>Paul Winkler</dc:creator>
		<pubDate>Fri, 07 Nov 2008 16:41:08 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-44</guid>
		<description>It's not just designers. The Almanac buildout layout  is pretty baffling to new developers too.</description>
		<content:encoded><![CDATA[<p>It&#8217;s not just designers. The Almanac buildout layout  is pretty baffling to new developers too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful Application File Layouts by chris</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-43</link>
		<dc:creator>chris</dc:creator>
		<pubDate>Fri, 07 Nov 2008 14:58:14 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-43</guid>
		<description>+1 from me on this.

I feel strongly that it's important to keep all view-related content (templates, CSS, and JS) within a single checkout. To the extent that our various platforms allow it, I would also really like to see a sane, consistent structure for our view-related content. I'm partial to the Pylons / Rails approach, but would be happy with any kind of consistency which minimizes the amount of time spent on "where do I need to go to make this change" questions. Having to grep for specific strings to find a desired file is a fairly good indication that an application structure could use improving.</description>
		<content:encoded><![CDATA[<p>+1 from me on this.</p>
<p>I feel strongly that it&#8217;s important to keep all view-related content (templates, CSS, and JS) within a single checkout. To the extent that our various platforms allow it, I would also really like to see a sane, consistent structure for our view-related content. I&#8217;m partial to the Pylons / Rails approach, but would be happy with any kind of consistency which minimizes the amount of time spent on &#8220;where do I need to go to make this change&#8221; questions. Having to grep for specific strings to find a desired file is a fairly good indication that an application structure could use improving.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on What Bothers Me About The Component Architecture by Brandon Craig Rhodes</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/10/20/what-bothers-me-about-the-component-architecture/#comment-42</link>
		<dc:creator>Brandon Craig Rhodes</dc:creator>
		<pubDate>Fri, 07 Nov 2008 12:42:04 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/10/20/what-bothers-me-about-the-component-architecture/#comment-42</guid>
		<description>I think you are missing something important in your example: that the lambda functions you are suggesting are terribly expensive, because the framework cannot "get inside of them" to see what they say.  They are black boxes; if a request comes in from the Web, then *any* of the views in the *entire system* could be ones whose lambdas will evaluate "yes" and want to handle the request.  Therefore, the cost of selecting a view is O(n) over the number of views registered.  If you have loaded libraries that, together with your application, register a few hundred views for various content types, then you've essentially got a runtime-constructed if-else cascade of 120 decisions that tries to find the view that should handle the request.  That's expensive.

The actual mechanism that repoze is using, by contrast lets the framework "see" the decision you are trying to make — that it has to be a certain request type combined with a certain class of content, say.  The framework can take all hundred registrations it might be offered and compose them into a decision tree that descends right down in roughly O(log n) time (or even less, if schemes based on Python dictionaries are in play) to the view that needs to be selected.

So, efficiency is problem #1; but there's an even deeper problem #2 in which your scheme is simply an *impossible* solution: where the developer wants to write a "general view" that handles all Documents, but then wants to override that with a *special view* that specifically handles PDFDocuments differently since, say, he does not render those to HTML.  With your scheme, the distinction is simply impossible to make!  When a PDFDocument gets a GET, then *both* lambdas will fire, and since all the framework will get are two True values, there will be NO WAY that the framework can even POSSIBLY determine that the PDFDocument match "binds more tightly" than the Document match and should override it.

By contrast, the ZCA is built specifically to take registrations on classes and return the "most specific" one.  It might be more complicated than it needs to be, I'm not sure; and I certainly have not learned all of the rules about what is a "more tight" binding when doing things like multi-adaptation.  But it at least is making things possible which your supposedly "completely general" solution completely disallows!  Your solution, in other words, is not general at all, because — in its current implementation — Python does not allow a framework to "look inside" boolean lambdas to compare matching booleans to see which is more specific.</description>
		<content:encoded><![CDATA[<p>I think you are missing something important in your example: that the lambda functions you are suggesting are terribly expensive, because the framework cannot &#8220;get inside of them&#8221; to see what they say.  They are black boxes; if a request comes in from the Web, then *any* of the views in the *entire system* could be ones whose lambdas will evaluate &#8220;yes&#8221; and want to handle the request.  Therefore, the cost of selecting a view is O(n) over the number of views registered.  If you have loaded libraries that, together with your application, register a few hundred views for various content types, then you&#8217;ve essentially got a runtime-constructed if-else cascade of 120 decisions that tries to find the view that should handle the request.  That&#8217;s expensive.</p>
<p>The actual mechanism that repoze is using, by contrast lets the framework &#8220;see&#8221; the decision you are trying to make — that it has to be a certain request type combined with a certain class of content, say.  The framework can take all hundred registrations it might be offered and compose them into a decision tree that descends right down in roughly O(log n) time (or even less, if schemes based on Python dictionaries are in play) to the view that needs to be selected.</p>
<p>So, efficiency is problem #1; but there&#8217;s an even deeper problem #2 in which your scheme is simply an *impossible* solution: where the developer wants to write a &#8220;general view&#8221; that handles all Documents, but then wants to override that with a *special view* that specifically handles PDFDocuments differently since, say, he does not render those to HTML.  With your scheme, the distinction is simply impossible to make!  When a PDFDocument gets a GET, then *both* lambdas will fire, and since all the framework will get are two True values, there will be NO WAY that the framework can even POSSIBLY determine that the PDFDocument match &#8220;binds more tightly&#8221; than the Document match and should override it.</p>
<p>By contrast, the ZCA is built specifically to take registrations on classes and return the &#8220;most specific&#8221; one.  It might be more complicated than it needs to be, I&#8217;m not sure; and I certainly have not learned all of the rules about what is a &#8220;more tight&#8221; binding when doing things like multi-adaptation.  But it at least is making things possible which your supposedly &#8220;completely general&#8221; solution completely disallows!  Your solution, in other words, is not general at all, because — in its current implementation — Python does not allow a framework to &#8220;look inside&#8221; boolean lambdas to compare matching booleans to see which is more specific.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on What Bothers Me About The Component Architecture by Malthe Borch</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/10/20/what-bothers-me-about-the-component-architecture/#comment-41</link>
		<dc:creator>Malthe Borch</dc:creator>
		<pubDate>Fri, 07 Nov 2008 09:44:17 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/10/20/what-bothers-me-about-the-component-architecture/#comment-41</guid>
		<description>I'm one of the perpetrators behind the ``repoze.bfg.httprequest`` package and while I agree with Ian that this particular piece of software might work well as a showcase for how not to use the ZCA, I think some of the commentators misunderstand the objective.

In any web framework, there's a request coming in. Some where down the code chain, decision are made based on what this request is all about, perhaps foremost based on its path and query string.

However, it may also depend on such things as language, method and the type of data the request is looking for in a response. We're talking about intrinsic qualities of the request, not details like which theme to apply, or other application-specific qualities.

Now, in Zope 3, besides writing a long list of if-elif-else statements to multiplex on these, for any given object and request, to find a function that will actually render the response, there is the possibility of using marker interfaces and use the ZCA to multiplex.

This may seem like needless complexity for some, but developers who routinely use the ZCA will find it easy to understand and further, they'll have a complete registry for these components, which may be queried in any way they like. It's fast, too, being mostly written in C. That's not good for the GAE, but that's another matter.

I agree that marker-interfaces are often an anti-pattern and their binary quality is too simple to handle any but the most rudimentary use-cases. But consider this example (in the context of a ``repoze.bfg`` app):

A request comes in; it's an ajax request, which may readily be seen from the value of the HTTP header "http_x_requested_with", which is "xmlhttprequest". To register a view "show" for such requests, one would register a generic view function for this view and multiplex to two other views, "show_full" and "show_ajax".

Alternatively, we just register our ajax-view for an interface which matches the corresponding HTTP header. If we use ``repoze.bfg.httprequest`` to create this interface, it's automatically applied to the request when it comes in. No setup needed. It's even quite readable, as long as the interface as properly named, e.g. IAjaxRequest.

In conclusion, programming with Python is about having fun and not working too much; this means writing good code and being able to reuse that code often. The test of time will prove whether this package was a fluke or not. I'm still using it :-)</description>
		<content:encoded><![CDATA[<p>I&#8217;m one of the perpetrators behind the &#8220;repoze.bfg.httprequest&#8220; package and while I agree with Ian that this particular piece of software might work well as a showcase for how not to use the ZCA, I think some of the commentators misunderstand the objective.</p>
<p>In any web framework, there&#8217;s a request coming in. Some where down the code chain, decision are made based on what this request is all about, perhaps foremost based on its path and query string.</p>
<p>However, it may also depend on such things as language, method and the type of data the request is looking for in a response. We&#8217;re talking about intrinsic qualities of the request, not details like which theme to apply, or other application-specific qualities.</p>
<p>Now, in Zope 3, besides writing a long list of if-elif-else statements to multiplex on these, for any given object and request, to find a function that will actually render the response, there is the possibility of using marker interfaces and use the ZCA to multiplex.</p>
<p>This may seem like needless complexity for some, but developers who routinely use the ZCA will find it easy to understand and further, they&#8217;ll have a complete registry for these components, which may be queried in any way they like. It&#8217;s fast, too, being mostly written in C. That&#8217;s not good for the GAE, but that&#8217;s another matter.</p>
<p>I agree that marker-interfaces are often an anti-pattern and their binary quality is too simple to handle any but the most rudimentary use-cases. But consider this example (in the context of a &#8220;repoze.bfg&#8220; app):</p>
<p>A request comes in; it&#8217;s an ajax request, which may readily be seen from the value of the HTTP header &#8220;http_x_requested_with&#8221;, which is &#8220;xmlhttprequest&#8221;. To register a view &#8220;show&#8221; for such requests, one would register a generic view function for this view and multiplex to two other views, &#8220;show_full&#8221; and &#8220;show_ajax&#8221;.</p>
<p>Alternatively, we just register our ajax-view for an interface which matches the corresponding HTTP header. If we use &#8220;repoze.bfg.httprequest&#8220; to create this interface, it&#8217;s automatically applied to the request when it comes in. No setup needed. It&#8217;s even quite readable, as long as the interface as properly named, e.g. IAjaxRequest.</p>
<p>In conclusion, programming with Python is about having fun and not working too much; this means writing good code and being able to reuse that code often. The test of time will prove whether this package was a fluke or not. I&#8217;m still using it <img src='http://www.openplans.org/projects/topp-engineering/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Beautiful Application File Layouts by philipashlock</title>
		<link>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-40</link>
		<dc:creator>philipashlock</dc:creator>
		<pubDate>Fri, 07 Nov 2008 01:02:48 +0000</pubDate>
		<guid>http://www.openplans.org/projects/topp-engineering/blog/2008/11/06/beautiful-application-file-layouts/#comment-40</guid>
		<description>I couldn't agree more, this turns out to be a surprisingly high degree of overhead for simple edits or just for switching into the project context coming from something like a wordpress theme.</description>
		<content:encoded><![CDATA[<p>I couldn&#8217;t agree more, this turns out to be a surprisingly high degree of overhead for simple edits or just for switching into the project context coming from something like a wordpress theme.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
