[Zope] string formatting

Andreas Jung lists at zopyx.com
Fri Aug 13 12:20:38 EDT 2010


-----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 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?
> 
> Best regards,
> 
> Ebbe Kvist
> Stockholm
> 
> _______________________________________________________________
> Hitta kärleken med hjälp av vårt matchningstest - Klicka här!
> <http://spray.matchaffinity.se/?mtcmk=614114>
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> https://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  https://mail.zope.org/mailman/listinfo/zope-announce
>  https://mail.zope.org/mailman/listinfo/zope-dev )


- -- 
ZOPYX Limited           | zopyx group
Charlottenstr. 37/1     | The full-service network for Zope & Plone
D-72070 Tübingen        | Produce & Publish
www.zopyx.com           | www.produce-and-publish.com
- ------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkxlcNYACgkQCJIWIbr9KYzwqwCfeFrBsPilwyn1AcKhpE0e6hL8
M1gAn1AWaZf00EVOnAQYIGNfiy5vZLKw
=NAMv
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lists.vcf
Type: text/x-vcard
Size: 316 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20100813/781079ab/attachment.vcf 


More information about the Zope mailing list