Skip navigation

DrProject consists of components, or modules. For example, drproject/ticket contains a template and the model and controller code to handle ticket requests. When a request for a resource is received through the web, web/ searches for the right controller by looking at the URL pattern. The question I have is why do it like this? In ASP.NET, you simply tell the webpage what “code-behind” (or “code-beside”) classes will handle the request.

Anyway, to create a new component in DrProject is fairly simple. It consists of the following files/directories:

/templates: This stores the html Kid templates. It’s pretty straight-forward: you can in-line Python code with HTML (which is very ugly and one of the reasons why MVC for web is very good), or you can do all the logic in the model/controller and use these templates as forms for getting input, or a page for displaying stuff.

/ This is where imports go that will be used by other classes in the component.

/ This is where “helper” classes and methods go, which will be used by other classes in the component.

/ The guts of the component. All logic related to backend is here.

/ The brain of the component. Controller to handle user actions with the web page should be here.

Of course, in real world, there is no perfect MVC. Some controllers seem to contain logic for modifying the backend, which I think should be in the model somewhere.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: