Re: [Zope] How do I get the first ten characters of a string?
Chris Withers schrieb:
Lars Heber wrote:
<dtml-let myTest="'some really senseless blah'"> <dtml-var *first 10 characters of myTest*> </dtml-let>
<dtml-var "myTest[:10]">
cheers,
Chris
I tested it out - didn't work. I wanted to do that with a date: <dtml-let datum="ZopeTime()+7"> <dtml-var "datum[:10]"> </dtml-let> "Date is unsliceable"... ??? What I want to get is just the date without the time! Any ideas? Some more questions: - I'd like to give my each instance of my ZClass a title, which is then shown in the folder window, just like documents for example. I tried to simply create a property "title" in my property sheet, but as expected, it of course didn't refer to that property to show it in the overview. - How can I get the source code of manage_main? I'd like to modify it a little within my ZClass. Thanks to you all!!! Lars
On Fri, 23 Feb 2001, Lars Heber wrote:
I wanted to do that with a date:
<dtml-let datum="ZopeTime()+7"> <dtml-var "datum[:10]"> </dtml-let>
"Date is unsliceable"... ??? What I want to get is just the date without the time!
Any ideas?
Convert datum to a string: _.str(datum)[:10] Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
The date is a complex object not a string. Zope provides many ways to format it. Here is one: <dtml-var "ZopeTime()" fmt=%Y/%m/%d> -- Loren
-----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Lars Heber Sent: Friday, February 23, 2001 09:37 To: zope@zope.org Subject: Re: [Zope] How do I get the first ten characters of a string?
Chris Withers schrieb:
Lars Heber wrote:
<dtml-let myTest="'some really senseless blah'"> <dtml-var *first 10 characters of myTest*> </dtml-let>
<dtml-var "myTest[:10]">
cheers,
Chris
I tested it out - didn't work.
I wanted to do that with a date:
<dtml-let datum="ZopeTime()+7"> <dtml-var "datum[:10]"> </dtml-let>
"Date is unsliceable"... ??? What I want to get is just the date without the time!
Any ideas?
Some more questions:
- I'd like to give my each instance of my ZClass a title, which is then shown in the folder window, just like documents for example. I tried to simply create a property "title" in my property sheet, but as
expected, it of course didn't refer to that property to show it in the overview.
- How can I get the source code of manage_main? I'd like to modify it a little within my ZClass.
Thanks to you all!!!
Lars
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Loren Stafford schrieb:
The date is a complex object not a string. Zope provides many ways to format it. Here is one:
<dtml-var "ZopeTime()" fmt=%Y/%m/%d>
I like this fmt thing... I tried a few things. My actual problem now is: I've got a form, which returns a date string in the form dd.mm.YYYY via REQUEST. some piece of code, still in use: <dtml-with "NewsItem.createInObjectManager(REQUEST['id'], REQUEST)"> <dtml-call "propertysheets.Attribute.manage_editProperties(REQUEST)"> Before this last line I have to change my dd.mm.YYYY into Zope's YYYY/mm/dd. i. e. s. th. like <dtml-call "REQUEST.set('datum',?????)"> Of course I could do this by parsing the string and puzzling it newly together, but I think there must be a more elegant to do it, isn't it? I tried to use this fmt thing - didn't of course work because it is for the var tag. I also tried s. th. like <dtml-let datum="Verfallsdatum" fmt="..."> Didn't work either - of course, I know it can't. But I don't know how to do my task. I looked around in the How To's etc. but didn't find anything. Perhaps you could help me a last time for today. Have a nice weekend. Lars
<dtml-var "_.str(datum)[:10]"> ----- Original Message ----- From: "Lars Heber" <Lars.Heber@t-systems.de> To: <zope@zope.org> Sent: Friday, February 23, 2001 5:36 PM Subject: Re: [Zope] How do I get the first ten characters of a string?
Chris Withers schrieb:
Lars Heber wrote:
<dtml-let myTest="'some really senseless blah'"> <dtml-var *first 10 characters of myTest*> </dtml-let>
<dtml-var "myTest[:10]">
cheers,
Chris
I tested it out - didn't work.
I wanted to do that with a date:
<dtml-let datum="ZopeTime()+7"> <dtml-var "datum[:10]"> </dtml-let>
"Date is unsliceable"... ??? What I want to get is just the date without the time!
Any ideas?
Some more questions:
- I'd like to give my each instance of my ZClass a title, which is then shown in the folder window, just like documents for example. I tried to simply create a property "title" in my property sheet, but as
expected, it of course didn't refer to that property to show it in the overview.
- How can I get the source code of manage_main? I'd like to modify it a little within my ZClass.
Thanks to you all!!!
Lars
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Lars Heber -
Loren Stafford -
Oleg Broytmann -
Peter Bengtsson