On Wed, Dec 3, 2008 at 8:34 PM, David Cramer <[EMAIL PROTECTED]> wrote:
>
> So far I've refactored a bunch of the methods to store less in the
> session, and generate more on demand (otherwise you could change the
> method and then session data represents inaccurate information). I've
> completedly redesigned the pages storage so it's just storing valid
> and verified in the session. I'm a little curious as to what valid is
> (vs verified), but I'll leave it for now.

I think you mean validated and visited.  The difference is that if
someone submits data for a page/form, then it's been visited.  If
they've submitted valid data, then it's both valid and visited.  My
examples in the docs didn't really draw attention to this point, but
here's the usage:

    <ul>
    {% for page_key,page in pages.items %}
        <li class="{% if page.valid %}valid{% endif %}
                   {% if page.current_page %}current{% endif %}">
        {% if page.visited %}
            <a href="{{ URL_base }}{{ page_key }}">{{ page.title }}</a>
        {% else %}
            {{ page.title }}
        {% end if %}
        </li>
    {% endfor %}
    </ul>

In my example, visited pages get a link, otherwise no link.  Valid
pages and the current page have a particular stylesheet rule applied.
Just an example of the kind of thing you might want to do with page
data in a wizard.


> I've fixed an issue with URL
> base, it seemed to only allow URLs which didn't end with a / (mine
> do).
>
> (r'^verify-number/(:?(?P<page_key>\w*)/)?$', 'verification.index'),

Yeah, allowing both trailing / versions and non-trailing / is better.
It wasn't a show-stopper for me, but that's a nice change.  Think
there's a get_URL_base hook that could be overridden for odd URLs.  Of
course, less work repetitive code is better.


> I've changed the done() method to pass form_classes just as it would
> originally. I've also changed _validate_all_forms to support this
> change in the new _handle_post_request (renamed from POST) method. GET
> is renamed to _handle_get_request. get_URL_base is renamed to
> get_url_base.

I didn't really see much of a point to pass the forms to done, since
there is already a method to retrieve forms.  I was using this:

form_data = self._get_all_cleaned_data(request.session)

But I suppose everyone will be doing that early on in done(), so it
makes sense to make it a parameter.


> When the done() method is called, the session is also cleared unless
> done(). Maybe this should only happen if say a ValidationError isn't
> raised? Maybe a setting that makes this not happen? In all of my
> situations it makes sense to erase it when it's complete, and not have
> to call methods manual. Let's decide which is more common.

I think clear it automatically.  I thought about this, but just didn't
implement it.


-Dave

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to