[Zope-CMF] CMF Skin / string or date comparison problem

Damon Eckhoff eckhoffd@missouri.edu
Fri, 8 Mar 2002 16:41:16 -0600


Hey All:

I'm currently building a CMF(1.2) (Zope 2.5.0) skin from the ground up... 
line by line... no cutting and pasting... mostly because I'm trying to 
figure this thing out and I really don't want any surprises in my 
production system.

I've been making tremendous progress, but now I've run into a problem...

...in the zpt_generic skin folder there is a page template named 'logged_in'
.  I've modeled my own logged_in template off of the zpt_generic one.

I've set the portal properties up so that validate_email is true.

Now when a user registers, receives the confirmation e-mail, and then logs 
in with the randomly generated password... the system should present a 
change of password form.  Mine doesn't.  I've changed mine to redirect... 
but in the following code... the """member.login_time == 
here.ZopeTime('2000/01/01')""" never evaluates to true.

I've done some testing... and I believe the problem is in the actual 
comparison.  I'm very new to python so I'm not 100% sure that I'm comparing 
the dates / string correctly.  I just copied what was in the original 
zpt_generic/logged_in template.

This seems like a misunderstanding of how to actually compare the two 
objects... but as a newbie, I'm at a loss.

I really appreciate any help...

Damon.


CODE: (similar to zpt_generic/logged_in)

<!-- Was the login successful? -->
<div tal:condition="python: not(here.portal_membership.isAnonymousUser())"
         tal:define="member python: 
here.portal_membership.getAuthenticatedMember()">

     <!-- Login was successful -->

     <!-- Is this first login? AND Is validate email enabled? -->
     <div tal:condition="python: ( member.login_time == here.ZopeTime('2000/
01/01') ) and
                                 here.portal_properties.validate_email">

         <!-- ****** NEVER GETS HERE ****** -->

         <!-- redirect to change password form -->
         <div tal:define="change_password_target python: 
here.change_assigned_password.absolute_url()">
		          <div tal:define="dredirect python: 
request.RESPONSE.redirect( redirect_target )"></div>
         </div>

     </div>

     <!-- Is this the first login? AND Is e-mail validation turned off? -->
     <div tal:condition="python: not(member.login_time == 
here.ZopeTime('2000/01/01') and here.validate_email)">

        <!-- ****** ALWAYS GETS HERE ****** -->

        <!-- Yes... no need to change password.  Need to update last login 
time -->
	    <div tal:define="d_reg python: 
here.portal_registration.setProperties(last_login_time=member.login_time);
              ereg python: here.portal_registration.setProperties(login_time=
here.ZopeTime())">
	    </div>
</div>

:END CODE