Am 14.08.2010 22:23, schrieb Jaroslav Lukesh:
DTML is your friend, not evil.
JL.
when I was a kid I used to spend my holidays with my grandfather. he was
an old farmer and used to work with horse and carriage.
it was great and I loved the horses..
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jaroslav Lukesh wrote:
It is easy:
dtml-call REQUEST.set('signumfix2',signum2[1:4])
dtml-call REQUEST.set('signumfix2', _.int(signumfix2)+1)
dtml-call REQUEST.set('signumFinal', 'B' + _.str(1000 +
signumfix2)[1:] )
Hopefully such code won't
- Puvodní zpráva -
Od: Andreas Jung li...@zopyx.com
Jaroslav Lukesh wrote:
It is easy:
dtml-call REQUEST.set('signumfix2',signum2[1:4])
dtml-call REQUEST.set('signumfix2', _.int(signumfix2)+1)
dtml-call REQUEST.set('signumFinal', 'B' + _.str(1000 +
signumfix2)[1:] )
Hopefully
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Jaroslav Lukesh wrote:
- Puvodní zpráva - Od: Andreas Jung li...@zopyx.com
Jaroslav Lukesh wrote:
It is easy:
dtml-call REQUEST.set('signumfix2',signum2[1:4])
dtml-call REQUEST.set('signumfix2', _.int(signumfix2)+1)
dtml-call
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Firstly, why DTML?
Secondly, write a browser view or your app logic into a Python Script
and use a ZPT for calling the script and rendering the result. Such code
as seen below makes us shiver.
Andreas
Ebbe Kvist wrote:
Hi all,
I want to process
Something like:
dtml-call REQUEST.set('signumfix2', signum[0:1] +
_.str(_.int(signum[1:4])+1)
wont work because you will turn B006 into B7
If you want to retain the leading zeros you will need to pad them.
As Andreas said, this would be better done using a python script (which you
def inc(s):
id, count = (s[:1], int(s[1:4]))
count += 1
return '%s%03d' % (id, count)
--
Jeffrey D Peterson
Webmaster
Crary Industries, Inc.
From: zope-boun...@zope.org [mailto:zope-boun...@zope.org] On Behalf Of Ebbe
Kvist
Sent: Friday, August 13, 2010 11:17 AM
To: zope@zope.org
To be more flexible it should probably look more like this:
def inc(s):
import string
id, count = (s[:1], s[1:])
count = string.zfill(str(int(count) + 1), len(count))
return '%s%s' % (id, count)
That way even 'B0006' would get incremented properly.
--
Jeffrey D Peterson
It is easy:
dtml-call REQUEST.set('signumfix2',signum2[1:4])
dtml-call REQUEST.set('signumfix2', _.int(signumfix2)+1)
dtml-call REQUEST.set('signumFinal', 'B' + _.str(1000 +
signumfix2)[1:] )
DTML is simple and fine :)
- Puvodní zpráva -
Od: Ebbe Kvist
I want to process a variable,