source: WAeUP_SRP/trunk/Widgets.py @ 1120

Last change on this file since 1120 was 1082, checked in by Henrik Bettermann, 18 years ago

logging messages changed

  • Property svn:keywords set to Id
File size: 23.3 KB
RevLine 
[47]1#-*- mode: python; mode: fold -*-
[990]2# $Id: Widgets.py 1082 2006-12-18 21:25:01Z henrik $
[295]3from cgi import escape
[502]4from types import *
[22]5from Globals import InitializeClass
[199]6##from Products.CPSSchemas.Widget import CPSWidgetType
[295]7from Products.CMFCore.utils import getToolByName
[537]8from Products.CPSSchemas.BasicWidgets import CPSWidget, CPSStringWidget, CPSEmailWidget,CPSImageWidget
[295]9from Products.CPSSchemas.BasicWidgets import renderHtmlTag,CPSSelectWidget, CPSStringWidget
[22]10from Products.CPSSchemas.ExtendedWidgets import CPSDateTimeWidget
[199]11from Products.CPSSchemas.Widget import widgetRegistry
12##from Products.CPSSchemas.WidgetTypesTool import WidgetTypeRegistry
[22]13from DateTime.DateTime import DateTime
14from AccessControl import getSecurityManager
[502]15from Products.WAeUP_SRP.Students import getStudentByRegNo
[22]16from re import compile
[952]17import logging
[22]18
[952]19#from zLOG import LOG, DEBUG
[22]20
[295]21class CPSSelectWidgetForRecord(CPSSelectWidget): ###(
22    """Select widget. with record names"""
23    meta_type = 'Select Widget for Records'
24
25    field_types = ('CPS String Field',)
26    field_inits = ({'is_searchabletext': 1,},)
27
28    _properties = CPSSelectWidget._properties + (
29        {'id': 'record_id', 'type': 'string', 'mode': 'w',
30         'label': 'Record Id', 'is_required' : 1},
31        )
32
33    def render(self, mode, datastructure, **kw):
34        """Render in mode from datastructure."""
35        value = datastructure[self.getWidgetId()]
36        vocabulary = self._getVocabulary(datastructure)
37        portal = getToolByName(self, 'portal_url').getPortalObject()
38        cpsmcat = portal.translation_service
39        if mode == 'view':
40            if self.translated:
41                return escape(cpsmcat(vocabulary.getMsgid(value, value)).encode('ISO-8859-15', 'ignore'))
42            else:
43                return escape(vocabulary.get(value, value))
44        elif mode == 'edit':
45            html_widget_id = self.getHtmlWidgetId()
[444]46            res = renderHtmlTag('select',
47                                name='%s.%s:records' % (self.record_id,html_widget_id),
[295]48                                id=html_widget_id)
49            in_selection = 0
50            for k, v in vocabulary.items():
51                if self.translated:
52                    kw = {'value': k,
53                          'contents': cpsmcat(vocabulary.getMsgid(k, k)).encode('ISO-8859-15', 'ignore')
54                          }
55                else:
56                    kw = {'value': k, 'contents': v}
57                if value == k:
58                    kw['selected'] = 'selected'
59                    in_selection = 1
60                res += renderHtmlTag('option', **kw)
61            if value and not in_selection:
62                kw = {'value': value, 'contents': 'invalid: '+ str(value),
63                      'selected': 'selected'}
64                res += renderHtmlTag('option', **kw)
65            res += '</select>'
66            return res
67        raise RuntimeError('unknown mode %s' % mode)
68
69InitializeClass(CPSSelectWidgetForRecord)
70
71widgetRegistry.register(CPSSelectWidgetForRecord)
72
73###)
74
[373]75class CPSStringWidgetForRecord(CPSStringWidget): ###(
[295]76    """String widget."""
77    meta_type = 'String Widget For Record'
78
79    field_types = ('CPS String Field',)
80    field_inits = ({'is_searchabletext': 1,},)
81    _properties = CPSStringWidget._properties + (
82        {'id': 'record_id', 'type': 'string', 'mode': 'w',
83         'label': 'Record Id', 'is_required' : 1},
84        )
85
86    def render(self, mode, datastructure, **kw):
87        """Render in mode from datastructure."""
88        value = datastructure[self.getWidgetId()]
89        if mode == 'view':
90            return escape(value)
91        elif mode == 'edit':
92            # XXX TODO should use an other name than kw !
93            # XXX change this everywhere
94            html_widget_id = self.getHtmlWidgetId()
95            kw = {'type': 'text',
96                  'id'  : html_widget_id,
[444]97                  'name': '%s.%s:records' % (self.record_id,html_widget_id),
[295]98                  'value': escape(value),
99                  'size': self.display_width,
100                  }
101            if self.size_max:
102                kw['maxlength'] = self.size_max
103            return renderHtmlTag('input', **kw)
104        raise RuntimeError('unknown mode %s' % mode)
105
106InitializeClass(CPSStringWidgetForRecord)
107
108widgetRegistry.register(CPSStringWidgetForRecord)
109
[373]110###)
111
112class CertificateCourseIdWidget(CPSStringWidget): ###(
113    """ CertificateCourseId Widget"""
114    meta_type = "CertificateCourseId Widget"
[444]115
[373]116    def validate(self, datastructure, **kw):
117        """Validate datastructure and update datamodel."""
[444]118
[373]119        valid = CPSStringWidget.validate(self, datastructure, **kw)
120        if not valid:
121            return 0
122        else:
123            widget_id = self.getWidgetId()
124            value = datastructure[widget_id].upper()
125            err = 0
126            c_ids = [c.id for c in self.portal_catalog({'meta_type': "Course"})]
[381]127            if hasattr(self.aq_parent,value):
[444]128                err = 'Course %s already exists' % (value)
[381]129            elif value not in c_ids:
[444]130                err = 'Course %s does not exist' % (value)
[373]131            if err:
132                datastructure.setError(widget_id, err)
133            else:
134                datamodel = datastructure.getDataModel()
135                datamodel[self.fields[0]] = value
[444]136
[373]137            return not err
138
139InitializeClass(CertificateCourseIdWidget)
140
141widgetRegistry.register(CertificateCourseIdWidget)
[551]142###)
[373]143
144
[551]145class CourseIdWidget(CPSStringWidget): ###(
146    """ CourseId Widget"""
147    meta_type = "CourseId Widget"
148
149    def validate(self, datastructure, **kw):
150        """Validate datastructure and update datamodel."""
151
152        valid = CPSStringWidget.validate(self, datastructure, **kw)
153        if not valid:
154            return 0
155        else:
156            widget_id = self.getWidgetId()
157            value = datastructure[widget_id].upper()
158            err = 0
159            res = self.portal_catalog(meta_type= "Course",id = value)
160            if len(res) > 0:
161                err = 'Course %s already exists' % (value)
162            if err:
163                datastructure.setError(widget_id, err)
164            else:
165                datamodel = datastructure.getDataModel()
166                datamodel[self.fields[0]] = value
167
168            return not err
169
170InitializeClass(CourseIdWidget)
171
172widgetRegistry.register(CourseIdWidget)
173
174
[373]175###)
176
[714]177class WAeUPReservedRoomsWidget(CPSStringWidget): ###(
178    """ WAeUPReservedRooms Widget"""
179    meta_type = "WAeUPReservedRooms Widget"
180
181    def validate(self, datastructure, **kw):
182        """Validate datastructure and update datamodel."""
183        import re
184        valid = CPSStringWidget.validate(self, datastructure, **kw)
185        if not valid:
186            return 0
187        else:
188            widget_id = self.getWidgetId()
189            value = datastructure[widget_id]
190            err = 0
191            try:
[926]192                reserved = [(r.split('/')[0],int(r.split('/')[1])) for r in re.split(',|\.| ',value)
[714]193                                     if r]
[1038]194            except (ValueError,IndexError),msg:
[714]195                err = str(msg)
196            if err:
197                datastructure.setError(widget_id, err)
198            else:
199                datamodel = datastructure.getDataModel()
200                datamodel[self.fields[0]] = value
201            return not err
202
203InitializeClass(WAeUPReservedRoomsWidget)
204
205widgetRegistry.register(WAeUPReservedRoomsWidget)
206
207
208###)
209
[388]210class WAeUPIdWidget(CPSStringWidget): ###(
211    """ WAeUPId Widget"""
212    meta_type = "WAeUPId Widget"
[444]213
[388]214    def validate(self, datastructure, **kw):
215        """Validate datastructure and update datamodel."""
[444]216
[388]217        valid = CPSStringWidget.validate(self, datastructure, **kw)
[422]218        id_pat_str = r"\S"
219        inv_id_pat = compile(r"^%s$" % id_pat_str)
[388]220        if not valid:
221            return 0
222        else:
[586]223            portal_type_query = {'query':['Faculty',
224                                          'Department',
225                                          'Course',
226                                          'Certificate',
227                                          'CertificateCourse',]}
[388]228            widget_id = self.getWidgetId()
229            value = datastructure[widget_id].upper()
230            err = 0
[440]231            if len(value.split()) > 1:
[783]232                err = 'Invalid Id, Id contains space(s).'
[586]233            elif self.portal_catalog(portal_type=portal_type_query,id=value):
[783]234                err = 'An object with the Id %s already exists in the Academic Section.' % (value)
[388]235            if err:
236                datastructure.setError(widget_id, err)
237            else:
238                datamodel = datastructure.getDataModel()
239                datamodel[self.fields[0]] = value
[444]240
[388]241            return not err
242
243InitializeClass(WAeUPIdWidget)
244
245widgetRegistry.register(WAeUPIdWidget)
246
247
248###)
249
[1025]250class StudyCourseWidget(CPSStringWidget): ###(
251    """ StudyCourse Widget"""
252    meta_type = "StudyCourse Widget"
253
254    def validate(self, datastructure, **kw):
255        """Validate datastructure and update datamodel."""
256        #from Products.zdb import set_trace
257        #set_trace()
258        valid = CPSStringWidget.validate(self, datastructure, **kw)
259        id_pat_str = r"\S"
260        inv_id_pat = compile(r"^%s$" % id_pat_str)
261        if not valid:
262            return 0
263        else:
264            widget_id = self.getWidgetId()
265            value = datastructure[widget_id].upper()
266            err = 0
267            if len(value.split()) > 1:
268                err = 'Invalid Id, Id contains space(s).'
269            elif not self.portal_catalog(portal_type='Certificate',id=value):
270                err = 'No such certificate'
271            if err:
272                datastructure.setError(widget_id, err)
273            else:
274                datamodel = datastructure.getDataModel()
275                datamodel[self.fields[0]] = value
276            return not err
277
278InitializeClass(StudyCourseWidget)
279
280widgetRegistry.register(StudyCourseWidget)
281###)
282
[710]283##class StudentIdWidget(CPSStringWidget): ###(
284##    """ StudentId Widget"""
285##    meta_type = "StudentId Widget"
286##    digits = 8
287##    digits_str = "N"*digits
288##    letters = 2
289##    letters_str = "L"*letters
290##
291##    def validate(self, datastructure, **kw):
292##        """Validate datastructure and update datamodel."""
293##
294##        valid = CPSStringWidget.validate(self, datastructure, **kw)
295##        if not valid:
296##            return 0
297##        else:
298##            widget_id = self.getWidgetId()
299##            value = datastructure[widget_id]
300##            err = 0
301##            if not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()):
302##                err = 'Invalid Registration Number in the format: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str)
303##            if err:
304##                datastructure.setError(widget_id, err)
305##            else:
306##                datamodel = datastructure.getDataModel()
307##                datamodel[self.fields[0]] = value
308##
309##            return not err
310##
311##InitializeClass(StudentIdWidget)
312##widgetRegistry.register(StudentIdWidget)
313##
314#####)
[444]315
[463]316class JambRegNoWidget(CPSStringWidget): ###(
317    """ JambRegNo Widget"""
318    meta_type = "JambRegNo Widget"
319    digits = 8
320    digits_str = "N"*digits
321    letters = 2
322    letters_str = "L"*letters
323    def validate(self, datastructure, **kw):
324        """Validate datastructure and update datamodel."""
325
326        valid = CPSStringWidget.validate(self, datastructure, **kw)
[816]327        #import pdb;pdb.set_trace()
[966]328        pumeresults = self.portal_pumeresults
[463]329        if not valid:
330            return 0
331        else:
332            widget_id = self.getWidgetId()
[912]333            value = datastructure[widget_id].upper()
[463]334            err = 0
335            if not (len(value) == self.digits + self.letters and value[:self.digits].isdigit() and value[self.digits:].isalpha()):
[783]336                err = 'Invalid number, the expected format is: %s%s with N = Number, L = Letter' % (self.digits_str,self.letters_str)
[463]337            else:
[966]338                #s = getStudentByRegNo(self,value)
339                pume = pumeresults(jamb_reg_no = value)
[969]340                if len(pume) < 1:
[977]341                    err = 'No Student with JAMB RegNo %s.' % (value)
[780]342                else:
[966]343                    datastructure['pume'] = pume[0]
[463]344            if err:
345                datastructure.setError(widget_id, err)
346            else:
347                datamodel = datastructure.getDataModel()
348                datamodel[self.fields[0]] = value
349            return not err
350
351InitializeClass(JambRegNoWidget)
352
353widgetRegistry.register(JambRegNoWidget)
[47]354###)
355
[794]356class WAeUPResultsWidget(CPSStringWidget): ###(
357    """ WAeUPResults Widget"""
358    meta_type = "WAeUp Results Widget"
359
360    def prepare(self, datastructure, **kw): ###(
361        """Prepare datastructure from datamodel."""
362        datamodel = datastructure.getDataModel()
363        v = datamodel[self.fields[0]]
364        #import pdb;pdb.set_trace()
365        widget_id = self.getWidgetId()
[807]366        datastructure[widget_id] = v
[794]367        datastructure[widget_id+'_s'] = ''
368        datastructure[widget_id+'_g'] = ''
369    ###)
370
371    def validate(self, datastructure, **kw): ###(
372        """Validate datastructure and update datamodel."""
[807]373        #import pdb;pdb.set_trace()
[794]374        widget_id = self.getWidgetId()
375        v = datastructure[widget_id]
376        err = 0
377        s = datastructure[widget_id+'_s'].strip()
378        g = datastructure[widget_id+'_g'].strip()
[807]379        while 1:
380            if not s and g:
381                err = "no subject grad for subject %s " % s
382                break
383            i = 0
384            done = False
385            for sv,gv in v:
386                if sv == s:
387                    done = True
388                    if not g:
389                        v.pop(i)
390                        break
391                    v[i] = (s,g)
392                    break
393                i += 1
394            if done:
395                break
396            if s and g:
397                v.append((s,g))
398            break
[794]399        if err:
400            datastructure.setError(widget_id, err)
401        else:
402            datamodel = datastructure.getDataModel()
403            datamodel[self.fields[0]] = v
404            datastructure[widget_id+'_s'] = s
405            datastructure[widget_id+'_g'] = g
406        return not err
407    ###)
408
409    def render(self, mode, datastructure, **kw): ###(
410        """Render in mode from datastructure."""
411        render_method = 'widget_waeup_result_render'
412        meth = getattr(self, render_method, None)
413        if meth is None:
414            raise RuntimeError("Unknown Render Method %s for widget type %s"
415                               % (render_method, self.getId()))
416        #import pdb;pdb.set_trace()
417        datamodel = datastructure.getDataModel()
418        widget_id = self.getWidgetId()
419        v = datamodel[self.fields[0]]
[807]420        datastructure[widget_id] = v
[794]421        datastructure[widget_id+'_s'] = ''
422        datastructure[widget_id+'_g'] = ''
423        return meth(mode=mode,
424                    datastructure=datastructure,
425                    )
426    ###)
427
428
429InitializeClass(WAeUPResultsWidget)
430widgetRegistry.register(WAeUPResultsWidget)
431###)
432
[488]433class ScratchCardPin: ###(
434    """the ScratchCardPin"""
435    def __init__(self,prefix,batch_no,number):
[990]436        if not batch_no and not number:
437            s = prefix
[996]438            if len(s) > 3:
[990]439                prefix,batch_no,number = s[:3],s[3:-10],s[-10:]
440            else:
[996]441                prefix,batch_no,number = s,'',''
[488]442        self.p = prefix
443        self.b = batch_no
444        self.n = number
445
446    def __str__(self):
447        return "%s-%s-%s" % (self.p,self.b,self.n)
448###)
449
[47]450class ScratchcardPinWidget(CPSStringWidget): ###(
[22]451    """ ScratchcardPin Widget"""
[199]452    meta_type = "Scratchcard Pin Widget"
[488]453    _properties = CPSWidget._properties + (
454        {'id': 'prefix', 'type': 'string', 'mode': 'w',
455         'label': 'Prefix'},
456         {'id': 'reference', 'type': 'string', 'mode': 'w',
457         'label': 'Reference Field'},
458
459        )
460    prefix = ''
461    reference = ''
[502]462    def prepare(self, datastructure, **kw): ###(
[488]463        """Prepare datastructure from datamodel."""
464        datamodel = datastructure.getDataModel()
465        v = datamodel[self.fields[0]]
466        widget_id = self.getWidgetId()
[742]467        #import pdb;pdb.set_trace()
[747]468        if v and type(v) is StringType:
[990]469            try:
470                p,b,n = v.split('-')
471                v = ScratchCardPin(p,b,n)
472            except ValueError:
473                v = ScratchCardPin(v,'','')
[488]474        if v:
[742]475            p = '%s' % v.p
[488]476            b = '%s' % v.b
477            n = '%s' % v.n
478        else:
[742]479            p = self.prefix
480            if p.startswith('@'):
481                p = getattr(self,self.prefix[1:])()
[488]482            b = n = ''
[742]483            v = ScratchCardPin(p,b,n)
[488]484        datastructure[widget_id] = v
[742]485        datastructure[widget_id+'_p'] = p
[488]486        datastructure[widget_id+'_b'] = b
487        datastructure[widget_id+'_n'] = n
[758]488
[502]489###)
490
[22]491    def validate(self, datastructure, **kw):
492        """Validate datastructure and update datamodel."""
[1082]493        s_logger = logging.getLogger('Pin.Validate')
[488]494        widget_id = self.getWidgetId()
495        v = datastructure[widget_id]
[996]496        #import pdb;pdb.set_trace()
[488]497        err = 0
[742]498        prefix= self.prefix
499        if prefix.startswith('@'):
500            prefix= getattr(self,self.prefix[1:])()
[488]501        b = datastructure[widget_id+'_b'].strip()
502        n = datastructure[widget_id+'_n'].strip()
[502]503        pins = self.portal_pins
[742]504        pin = "%(prefix)s%(b)s%(n)s" % vars()
[816]505        do = 1
[1025]506        s_id = str(self.portal_membership.getAuthenticatedMember())
[635]507        if self.reference == "":
[1030]508            ref = s_id
[635]509        else:
510            ref = datastructure[self.reference]
[843]511            if datastructure.errors:
[816]512                do = 0
[977]513                datastructure.setError(widget_id, 'Errors in other data, PIN neither checked nor used.')
[1030]514                s_logger.info('"%s", "%s","entered wrong data together with pin", "%s"' % (s_id,ref,pin))
[816]515        while do:
516            ok = pins.searchAndSetRecord(pin,ref,prefix)
[1030]517            if ok < -2 or ok > 2:
518                err = 'Unknown error, please report!'
519                s_logger.info('"%s","%s", "caused unknown error with pin", "%s"' % (s_id,ref,pin))
520                break
521            elif ok == -2:
[819]522                err = 'Service already activated but with a different PIN.'
[1030]523                s_logger.info('"%s","%s", "repeatedly activated service but with different pin", "%s"' % (s_id,ref,pin))
[710]524                break
525            elif ok == -1:
[783]526                err = 'Invalid PIN'
[1030]527                s_logger.info('"%s","%s", "entered invalid pin", "%s"' % (s_id,ref,pin))
[502]528                break
529            if ok == 0:
[796]530                err = 'PIN already used.'
[1030]531                s_logger.info('"%s","%s", "entered used pin", "%s"' % (s_id,ref,pin))
[502]532                break
533            if ok >= 1:
[710]534                #import pdb;pdb.set_trace()
[635]535                if self.isStudent():
[992]536                    if self.reference == "jamb_reg_no":
[997]537                        err = "You are already logged in."
[1030]538                        s_logger.info('"%s","%s", "checked admission though logged in", "%s"' % (s_id,ref,pin))
[992]539                        break
[1082]540                    if ok == 1:
[1032]541                        s_logger.info('"%s","%s", "successfully used pin", "%s"' % (s_id,ref,pin))
542                    else:
543                        s_logger.info('"%s","%s", "repeatedly used pin", "%s"' % (s_id,ref,pin))
[637]544                    break
[635]545                else:
546                    student = getStudentByRegNo(self,ref)
[1030]547                    s_logger.info('"%s","%s","successfully used pin","%s"' % (s_id,ref,pin))
[502]548                if student is None:
[796]549                    err = "Student not found."
[1032]550                    s_logger.info('"%s","not found in admission list"' % (ref))
[502]551                    break
[648]552                s_id = student.getId()
[502]553                if ok == 2:
[990]554                    if self.reference == "jamb_reg_no":
555                        if hasattr(self.portal_directories.students,s_id):
556                            err = "Please login with your Student Id %s and 10-digit PIN." % s_id
[1032]557                            s_logger.info('"%s","%s", "repeatedly checked admission with pin", "%s"' % (s_id,ref,pin))
[990]558                            break
559                        else:
[1032]560                            s_logger.info('"%s","%s","(non-member) repeatedly checked admission with pin", "%s"' % (s_id,ref,pin))
[990]561                    else:
[1030]562                        err = "Unknown error" % s_id
[1032]563                        s_logger.info('"%s","%s", "repeatedly activated service with pin", "%s"' % (s_id,ref,pin))
[986]564                        break
565                try:
566                    student.getContent().makeStudentMember(s_id,password=pin[4:])
[1030]567                    s_logger.info('"%s","%s", "has been created using pin", "%s"' % (s_id,ref,pin))
[986]568                except:
[989]569                    err = "Please login with your Student Id %s and 10-digit PIN." % s_id
[1032]570                    s_logger.info('"%s","%s", "could not be made a member with pin", "%s"' % (s_id,ref,pin))
[986]571                    break
[502]572            break
[488]573        if err:
574            datastructure.setError(widget_id, err)
575        else:
576            datamodel = datastructure.getDataModel()
[742]577            datamodel[self.fields[0]] = ScratchCardPin(prefix,b,n)
578            datastructure[widget_id] = ScratchCardPin(prefix,b,n)
579            datastructure[widget_id+'_p'] = prefix
[488]580            datastructure[widget_id+'_b'] = b
581            datastructure[widget_id+'_n'] = n
[502]582            datastructure['s_id'] = s_id
[488]583        return not err
[444]584
[502]585    def render(self, mode, datastructure, **kw): ###(
[488]586        """Render in mode from datastructure."""
587        render_method = 'widget_scratch_card_pin_render'
588        meth = getattr(self, render_method, None)
589        if meth is None:
590            raise RuntimeError("Unknown Render Method %s for widget type %s"
591                               % (render_method, self.getId()))
592
593        # XXX AT: datastructure has to be set again here, in case we're in edit
594        # or create mode, because a default value has to be provided.
595        #import pdb;pdb.set_trace()
596        datamodel = datastructure.getDataModel()
597        v = datamodel[self.fields[0]]
[502]598        if v and type(v) is StringType:
[990]599            try:
600                p,b,n = v.split('-')
601                v = ScratchCardPin(p,b,n)
602            except ValueError:
[996]603                v = ScratchCardPin(self.prefix,'1',v)
604                pass
[488]605        if v:
[742]606            prefix= '%s' % v.p
[488]607            b = '%s' % v.b
608            n = '%s' % v.n
[22]609        else:
[742]610            prefix= self.prefix
611            if prefix.startswith('@'):
612                prefix= getattr(self,self.prefix[1:])()
[488]613            b = n = ''
[742]614            v = ScratchCardPin(prefix,b,n)
615        widget_id = self.getWidgetId()
616        datastructure[widget_id] = v
617        datastructure[widget_id+'_p'] = prefix
618        datastructure[widget_id+'_b'] = b
619        datastructure[widget_id+'_n'] = n
[758]620        return meth(mode=mode,
621                    datastructure=datastructure,
[488]622                    )
[523]623    ###)
[488]624
625
[22]626InitializeClass(ScratchcardPinWidget)
[199]627widgetRegistry.register(ScratchcardPinWidget)
[22]628
[47]629
630###)
631
[537]632class WAeUPImageWidget(CPSImageWidget):
633    """Photo widget."""
634    meta_type = 'WAeUP Image Widget'
635
636    def render(self, mode, datastructure, **kw):
637        render_method = 'widget_waeup_image_render'
638        meth = getattr(self, render_method, None)
639        if meth is None:
640            raise RuntimeError("Unknown Render Method %s for widget type %s"
641                               % (render_method, self.getId()))
642        img_info = self.getImageInfo(datastructure)
643        return meth(mode=mode, datastructure=datastructure, **img_info)
644
645
646
647InitializeClass(WAeUPImageWidget)
648
649widgetRegistry.register(WAeUPImageWidget)
650
651
[22]652###########
653
Note: See TracBrowser for help on using the repository browser.