[albatross-users] Two more issues

Dave Cole djc at object-craft.com.au
Thu Dec 5 11:12:37 EST 2002


>>>>> "Michael" == Michael C Neel <neel at mediapulse.com> writes:

Michael> I've come across two more issues with the toolkit (I know
Michael> I've sent a lot of issues to the list, but that is in no way
Michael> a bad mark on albatross; if it wasn't as awesome as it is I
Michael> wouldn't be using it!)

Keep 'em coming.

Michael> 1.)  Setting multiple cookies.  Currently it looks as if
Michael> calls to ctx.request.write_header with the same header to set
Michael> (in this case "Set-cookie") will overwrite each other, and
Michael> write_header doesn't like tuples/lists.

I have some code in CVS which changes the way that the headers are
handled.  The headers are now accumulated in an ordered dictionary in
the request.  It exposes an interface like this:

   set_header(name, value)
   del_header(name)
   get_header(name)

The HeadersMixin (new execution context mixin) constructor does this:
    self.set_header('Pragma', 'no-cache')
    self.set_header('Content-Type', 'text/html')

All of the overridden and extended write_headers() methods have been
deleted.  The session mixins now add the cookie header by simply doing
    self.set_header('Set-Cookie', value)

I suppose the upshot of all this is that it give us the ability to
accumulate extra cookie values before writing the headers out.

Michael> 2.)  Al-if (and maybe other tags, I haven't tested) do not
Michael> "see" session varaibles.  For example if I have state as a
Michael> session var, it will be displayed correctly on an al-input
Michael> name="state" tage, but al-if expr="state == 'TN'" will error
Michael> with no var names state.

Hmm...  Does this mean that you are doing something like this:
    ctx.add_session_vars('blah')

Without doing this:
    ctx.locals.blah = 42

If that is the case, Andrew and I have decided that it might make
sense to make the add_session_vars() method create a ctx.locals value
and set it to None if it does not currently exist in ctx.locals

Michael> I don't know when you plan on a 1.02, but just as a
Michael> convience, here's mike's short list...

Michael> 1) the above (if they are not my errors of cource)

They look like good additions to me.

Michael> 2) the al-input with a zero value (there was a patch on the
Michael> list for this)

That patch is in CVS.  It will be in the next release.

Michael> 3) passing the status back as a result of a run (mod_python
Michael> issue really)

There is code in CVS which does this too.  The Request constructors now
do this:
   self.__status = 200

This establishes the default status which will be returned for the
request.  You can change it by calling the set_status() Request method
at any stage.  The Application run() method has been modified to
return the status in the Request object.

Michael> 4) ctx.req_equals using both image and image.x (a convienence
Michael> really)

That is a good feature to add.  It reduces the surprise and confusion
for image input fields.

Michael> 5) ctx.req_equals returning true only if the field exists is
Michael> not blank, right now it will return true for empty fields on
Michael> the second submission of the same page.

We are going to investigate this...

- Dave

-- 
http://www.object-craft.com.au




More information about the Albatross-users mailing list