Beispiel #1
0
    def get_form(self, user, form_key=None):
        """
        return the form class as specified in the tool object
        """
        forms = self.data.get('forms')
        form_class = forms.get(user.profile.user_class if form_key is None else form_key)  # allow us to override the form selected

        return _class_importer(form_class)
Beispiel #2
0
 def issue_signals(self, request, instance, actor, **kwargs):
     for s in self.signals:
         method = _class_importer(s)  # @TODO can optimise this and precache them
         method.send(sender=request, instance=instance, actor=actor, **kwargs)
Beispiel #3
0
    def status_labels(self):
        if type(self.__class__._revision_class) in [str, unicode]:
            self.__class__._revision_class = _class_importer(self.__class__._revision_class)

        return self.data.get('status_labels', self.__class__._revision_class.REVISION_STATUS.get_choices_dict())
Beispiel #4
0
    def api_serializer(self, instance, context={'request': None}):
        if type(self.__class__._serializer) in [str, unicode]:
            # not imported yet
            self.__class__._serializer = _class_importer(self.__class__._serializer)

        return self.__class__._serializer(instance, context=context)
Beispiel #5
0
 def markers(self):
     markers = self.data.get('markers', None)
     return None if markers is None else _class_importer(markers)()