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

seb bacon seb@jamkit.com
11 Mar 2002 11:25:58 +0000


I believe (not checked) that login_time is a string, and you are
comparing it with a ZopeTime object.  Check the Zope Help API section
for the DateTime API to see what kinds of string representation you can
get.  That's off the top of my head, though, so I could be wrong ;)

seb

On Fri, 2002-03-08 at 22:41, Damon Eckhoff wrote:
> 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
> 
> 
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
> 
> See http://www.zope.org/Products/PTK/Tracker for bug reports and feature requests