[Zope] string formatting

Jaroslav Lukesh lukesh at seznam.cz
Fri Aug 13 18:44:01 EDT 2010


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, signum2, which is picked up from a MySQL
database. The content of the variable is
"B006".
The aim is to process this variable so the result will be
"B007" and it will then be saved as part of a new record in the database.
The core process is to increment the integer part of the variable "006" with
1.

I have successfully done this incrementation but I have not been able to
create a new
correct content for the new varable new_xyz.

<dtml-call "REQUEST.set('signumfix2',signum2[1:4])">
<dtml-call "REQUEST.set('signumfix2', _.int(signumfix2)+1)">

How can I from here create the correct content of the new variable? I need
to bring the "B" part
with me and then the incremented integer part formatted with two preceeding
zeroes. Does anyone know?



More information about the Zope mailing list