I resolve my problem modifying file
C:\Zope\2.11.1\Zope\lib\python\DocumentTemplate\DT_InSV.py
Method __getitem__
Changing
if l < 0:
alt_prefix = self.alt_prefix
if not (alt_prefix and key.startswith(alt_prefix)):
raise KeyError, key
suffix = key[len(alt_prefix):].replace('_', '-')
if '-' in suffix:
try: return self[suffix]
except KeyError: pass
prefix = 'sequence'
key = 'sequence-' + suffix
else:
suffix=key[l+1:]
prefix=key[:l]
TO
if l < 0:
alt_prefix = self.alt_prefix
if not (alt_prefix and key.startswith(alt_prefix)):
raise KeyError, key
suffix = key[len(alt_prefix):].replace('_', '-', 1) <---- changed to just one time replace
#too my variable have a '_' and is bad replace
#if '-' in suffix: <-- what do it? the original suffix always have '-'
# try: return self[suffix]
# except KeyError: pass
prefix = 'sequence'
key = 'sequence-' + suffix
try:return self[key] <-- the difference with the return above is what suffix
except KeyError: pass #have 'var-region_nombre and here is 'sequence-var-region_region'
else:
suffix=key[l+1:]
prefix=key[:l]
All work fine until now
The application is already designed with dtml. This is a little change.
Before I rename it the fields in zsql to avoid conflicts.2008/11/8 Andreas Jung <lists@zopyx.com>
Any particular reason for using DTML instead of ZPT? DTML is dead.
-aj
On 06.11.2008 20:53 Uhr, Miguel Beltran R. wrote:
------------------------------------------------------------------------Hi list
After read http://plope.com/Books/2_7Edition/AppendixA.stx#2-19 I tried
use two dtml-in for get information from zsql diferents, but say "This
resource may be trying to reference a nonexistent object or variable
*'x_var_region'*."
what is missing?
The first dtml-in (prefix="q") only return one record.
The second dtml-in return 12 records.
[code]
<dtml-in expr="zsql_taller(
zregi=bregi, ztall=btall)"
prefix="q">
<p>
<form class="formulario" action="estado.html" id="main_form"
name="main_form">
<input type="hidden" name="accion" value="insertar" />
<ul>
<li><label for="bregi" class="titulo">REGION</label>
<select id="bregi" name="bregi">
<dtml-in dime_region prefix="x">
<option value="<dtml-var x_var_region>" <--- Here try access tha variable
<dtml-if expr="x_var_region==q_var_region">selected</dtml-if>
>
</option>
</dtml-in>
</select>
</li>
</ul>
</form>
<p>
</dtml-in>
--
________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida
_______________________________________________
Zope maillist - Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )
--
ZOPYX Ltd. & Co. KG - Charlottenstr. 37/1 - 72070 Tübingen - Germany
Web: www.zopyx.com - Email: info@zopyx.com - Phone +49 - 7071 - 793376
Registergericht: Amtsgericht Stuttgart, Handelsregister A 381535
Geschäftsführer/Gesellschafter: ZOPYX Limited, Birmingham, UK
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting
--________________________________________
Lo bueno de vivir un dia mas
es saber que nos queda un dia menos de vida