Daily Archives: May 30th, 2008

I’ve created a very basic screen mock up today. I’ve had a lot of feedback, which I’m going to integrate into the next version of the screen mockup. You can see it here: https://www.drproject.org/DrProject/wiki/DrProjectChatInterface

The next step is to design the database schema for storing messages, and start adding a new component to DrProject. I haven’t pegged the idea of using event log as a natural way of segmenting chat logs, but I think this is the easiest approach to take. The other would be some sort of NLP system, and it seems like a project within itself. However, I’m open to any other ideas.

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/main.py 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.

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

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

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

/web_ui.py: 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.