def register_admin_widget(widget_cls, primary=False):
 widget_id = widget_cls.widget_id
 if (not widget_id):
  raise ValueError((u'The widget_id attribute must be set on %r' % widget_cls))
 if ((widget_cls in primary_widgets) or (widget_cls in secondary_widgets)):
  raise KeyError((u'"%s" is already a registered administration widget' % widget_id))
 if primary:
  primary_widgets.append(widget_cls)
 else:
  secondary_widgets.append(widget_cls)

def register_admin_widget ( widget_cls , primary = False ) : widget_id = widget_cls . widget_id if ( not widget_id ) : raise ValueError ( ( u'The widget_id attribute must be set on %r' % widget_cls ) ) if ( ( widget_cls in primary_widgets ) or ( widget_cls in secondary_widgets ) ) : raise KeyError ( ( u'"%s" is already a registered administration widget' % widget_id ) ) if primary : primary_widgets . append ( widget_cls ) else : secondary_widgets . append ( widget_cls )
register an administration widget .