[Zope-DB] DMTL and DateTime or... mxDateTime

David Wilbur wildboar@cybermesa.com
Thu, 08 May 2003 13:08:21 -0600


Eric,

i just went and looked at the "Z Psycopg Database Connection" to give 
you information from what the connection was doing... and it has a 
toggle that says: "Use Zope's internal DateTime module (instead of 
mxDateTime)." which at this time is toggled off...  so that would mean 
that it was using mxDateTime... i wonder...

yep, i changed the toggle to "Use Zope's internal DateTime" and it 
works... is syntax different for mxDateTime?  or does this mean that 
mxDateTime isn't set up correctly?

anyway, here is the definition of the postgres table the one row of 
sample data that i have been working with:

drop table task;
drop sequence task_sid_seq;
create sequence task_sid_seq;

create table task (
    sid integer default nextval('task_sid_seq') primary key,
    name varchar(64),
    start_date date,
    end_date date,
    description varchar(4000),
    constraint integrity check (
        name is not null
        and start_date is not null
        and end_date is not null
        and description is not null
    )
);

insert into task (name,start_date,end_date,description)
values 
('test','1986-01-04','1989-05-17','bla.bla.bla.bla.bla.bla.bla.bla.bla.bla.bla.bla.')
;

<dtml-var standard_html_header>
<h3>Current list of Tasks</h3>

<a href="addTaskForm">Add a Task</a>
<p>
<dtml-in getTask>
   <a href="deleteTaskAction?sid=<dtml-var sid fmt="%d">">[Delete]</a>
   <a href="updateTaskForm?sid=<dtml-var sid fmt="%d">">[Edit]</a>
   <dtml-var name>,  <dtml-var "start_date.year()">
<br>
</dtml-in>
</p>

<dtml-var standard_html_footer>


dave





Eric Kamm wrote:

>David,
>
>Here's a DTML Method using the year method of a DateTime object:
>
>    <dtml-var standard_html_header>
>    <dtml-var "_.DateTime().year()">
>    <dtml-var standard_html_footer>
>
>I can access this as "Anonymous User" with no trouble.  Are you sure
>the variable you are working with is a DateTime object?  Without any
>more details, I can't think of what is wrong except that your role
>does not have the permission which allows access to the year method
>on the object in question.
>
>
>Eric Kamm
>Analytic Innovations, LLC
>www.analyticinnovations.com
>
>
>
>-----Original Message-----
>From: zope-db-admin@zope.org [mailto:zope-db-admin@zope.org]On Behalf Of
>David Wilbur
>Sent: Thursday, May 08, 2003 1:21 PM
>To: eric@analyticinnovations.com
>Cc: zope-db@zope.org
>Subject: Re: [Zope-DB] DMTL and DateTime or... mxDateTime
>
>
>
>hum... i've tried this before and what happens when i do this is i get a 
>login prompt put up infront of me... and even if i do login using a 
>valid account... it is in a loop of login.
>
><dtml-var "start_date.year()">
>
>if i cancel the login i get:
>
>Error Type: Unauthorized
>Error Value: You are not allowed to access year in this context
>
>and i truly have been disconnected too, since to do anything else at 
>this point, i have to relog in.
>
>dave
>
>
>Eric Kamm wrote:
>
>  
>
>>David,
>>
>>Search for "datetime" in the Zope help system and then 
>>read about the methods the DateTime object supports.
>>
>>For example...
>>
>>   <dtml-var "start_date.year()">
>>   <dtml-var "start_date.AMPMMinutes()">
>>
>>The DateTime object has dozens of very useful methods
>>to help you with rendering among other things.
>>
>>
>>Eric Kamm
>>Analytic Innovations, LLC
>>www.analyticinnovations.com
>>
>>
>>
>>-----Original Message-----
>>From: zope-db-admin@zope.org [mailto:zope-db-admin@zope.org]On Behalf Of
>>David Wilbur
>>Sent: Thursday, May 08, 2003 10:59 AM
>>To: zope-db@zope.org
>>Subject: [Zope-DB] DMTL and DateTime or... mxDateTime
>>
>>
>>
>>Hi,
>>
>>i was wondering of if someone could give me an example of manipulating 
>>dates in dmtl... like for example with the folloing snipit:
>>
>><dtml-in getTask>
>><dtml-var task>,  <dtml-var start_date> <br>
>></dtml-in>
>>
>>all that is meaningful is the date, in fact just the year in this case.  
>>but, by default, with postgres and psycopy, i am getting the date and 
>>the time.  i tried, form the DateTime definitions get it to change the 
>>date to just year... but in several of the permutations that i have 
>>tried it actually seem to send  zope off to nana land (ie: non responsive).
>>
>>so... i was hoping that i could be given enough of an example to know 
>>how to get back the year, and also how one would sperate out a date and 
>>time.  so that i could move on...  also, since i have mxDateTime 
>>installed, and there is a lot of indications that it is "better".  if i 
>>use that instead, is the answer effectivly the same or does it have a 
>>different syntax.  
>>
>>thanks,
>>dave
>>
>>
>>
>>
>>_______________________________________________
>>Zope-DB mailing list
>>Zope-DB@zope.org
>>http://mail.zope.org/mailman/listinfo/zope-db
>>
>>
>>
>> 
>>
>>    
>>
>
>
>
>
>_______________________________________________
>Zope-DB mailing list
>Zope-DB@zope.org
>http://mail.zope.org/mailman/listinfo/zope-db
>
>
>
>  
>