[albatross-users] Request for hints on building a complex application

Fabian Fagerholm fabbe at paniq.net
Wed Jun 18 06:00:26 EST 2003


Hi,

I'm building a large-ish application with Albatross, and I've ran into
several issues. The manual has provided excellent response to some
questions, but I suspect this undertaking is too complex to be answered
in the manual. More experience with the toolkit is needed to explain
this stuff.

In short, the application is a kind of order tracking system on
steroids. The back-end SQL database stores information about Products,
Users and Customers. Orders are entered by the sales people and connect
Products in some quantity with a Customer and some other information. In
addition, Jobs performed at an hourly charge are recorded. Periodically,
someone will generate entries in an Invoice table which consists of
Orders and Jobs. The Invoice table entries are used to bill the Customer
appropriately.

I'm currently prototyping the application and I'm implementing a subset
of the specification to see what problems I run into. I use
ModularSessionApp and SessionAppContext. I also use mod_python.

So far, I've implemented a User class that loads information from the
SQL database, and updates the SQL table with changes in the destructor.
There's also a rollback method to cancel any changes and a commit method
to save things on demand. The attributes of a User are implemented using
__getattr__ and __setattr__, so they behave like variables, but I can
input-check them if needed.

I've implemented a login mechanism that seems to work with the User
objects. Now I'm trying to construct a user management page. The page
consists of an HTML table with each user's information on separate rows.
I can generate the table nicely with an <al-for> tag and a list of User
objects passed through the execution context to the template. But I
can't seem to make the table "active". I'd like to make some table cells
<al-input>'s so that an administrator can simply edit the information
directly and press Submit to activate all changes at once.

Currently, the code snippets that do this look as follows:

mgusers.py:
def page_display(ctx):
    from Done import User
    ctx.locals.userlist = User.getAll() # returns a list of User obj's
    ctx.run_template('mgusers.html')

mgusers.html:
... table begins, <al-form> etc...
<al-for iter="u" expr="userlist">
 <tr>
  <td><al-value expr="u.value().uid"></td>
  <td><al-input type="text" ... ? ...></td>
  <td><al-input type="checkbox" ... ? ...></td>
 </tr>
</al-for>
... submit button, table ends, form ends ...

Those are only fragments but should give you an idea of what I'm trying
to do. User objects have attributes uid, username, realname, password
and enabled. The last four should be editable on this page. How do I
accomplish this? (Feel free to ask for more details if needed.)

What general advice do you have on implementing the Model classes?
There's a possibility that another (gui) front-end will be added later,
and I'd like to use the same Model classes for that.

-- 
Fabian Fagerholm <fabbe at paniq.net>
paniq.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://www.object-craft.com.au/pipermail/albatross-users/attachments/20030617/9e859ddd/attachment.pgp>


More information about the Albatross-users mailing list