On Thursday 25 June 2009, Yuri wrote: > Yuri ha scritto: > > campi = ['title', 'Rapporto_giornaliero', > > 'Operatori_cooperativa', 'Problemi_organizzativi', > > 'Problemi_biblioteca', 'Problemi_allo_stabile', 'Note', > > 'Utenti_presenti', 'Utenti_apertura_straordinaria', > > 'Utenti_presenti_1920', 'Utenti_totale', 'Numero_prestiti', > > 'Numero_restituzioni', 'Numero_rinnovi_straordinaria', > > 'Numero_prenotazioni'] > > > > for c in campi: > > row.append(self.getField(c).get(self)) > > > > perchè non funziona? :) > > > > Mi torna l'errore: > > > > * Module Products.Archetypes.Field, line 1989, in get > > > > TypeError: eval() arg 1 must be a string or code object > > > > se al posto di c metto la stringa con il nome del campo, funziona... > > L'errore avviene sui computedField, evidentemente perchè .get() non è il > loro accessor :)
Il codice del get di ComputedField è:
def get(self, instance, **kwargs):
"""Return the computed value."""
return eval(self.expression, {'context': instance, 'here' : instance})
dall'errore lanciato sembra semplicemente che 'expression' non sia codice
valido ("string or code object").
--
Riccardo Lemmi Email: [email protected]
Reflab S.r.l. - Plone Design, Development and Consulting
Phone: +39 349 4620820 http://www.reflab.it
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plone-IT mailing list [email protected] http://lists.plone.org/mailman/listinfo/plone-it http://www.nabble.com/Plone---Italy-f21728.html
