Hallo,
kann mir bitte jemand erklären warum folgender Abschnitt nicht funktioniert?
Code
security.declareProtected(View, 'Image2Base64')
def Image2Base64(self):
if self.getImage():
encImg = self.image_thumb.data.encode('base-64')
# indent the data block:
indentVar = '\n '.join(encImg.strip().split('\n'))
return indentedVar
return None
Folgender Traceback kommt:
Code
Traceback (innermost last):
Module ZPublisher.Publish, line 127, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 47, in call_object
Module Products.Five.browser.metaconfigure, line 477, in __call__
Module Products.Five.browser.pagetemplatefile, line 126, in __call__
Module Products.Five.browser.pagetemplatefile, line 60, in __call__
Module zope.pagetemplate.pagetemplate, line 115, in pt_render
.
.
.
Module Products.PageTemplates.Expressions, line 227, in evaluateText
Module zope.tales.tales, line 696, in evaluate
- URL: c:\server\instances\fhkrems\src\fhkrems.facultystaff\fhkrems\facultystaff\browser\personview.pt
- Line 77, Column 8
- Expression: <PythonExpr (context.Image2Base64())>
- Names:
{'args': (),
'container': <Person at /Plone/atsd/graf-michael>,
'context': <Person at /Plone/atsd/graf-michael>,
'default': <object object at 0x00A51748>,
'here': <Person at /Plone/atsd/graf-michael>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x05C1E630>,
'request': <HTTPRequest, URL=http://localhost:8080/Plone/atsd/graf-michael/person_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x046CBC50>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <Products.Five.metaclass.SimpleViewClass from c:\server\instances\fhkrems\src\fhkrems.facultystaff\fhkrems\facultystaff\browser\personview.pt object at 0x051A38D0>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x051EBA90>}
Module zope.tales.pythonexpr, line 59, in __call__
- __traceback_info__: (context.Image2Base64())
Module <string>, line 1, in <module>
Module fhkrems.facultystaff.content.person, line 444, in Image2Base64
AttributeError: image_thumb
Alles anzeigen
Wenn ich image_thumb direkt im Browser aufrufe, wird mir das Bild angezeigt..
Vielleicht hat jemand von Euch eine Hilfestellung, bitte.
Danke & lg
michi