Example #1
0
    def update_fields(self, fields, node, auth):
        updated = False
        if fields.get('id'):
            updated = updated or (fields['id'] != self.figshare_id)
            self.figshare_id = fields['id']
        if fields.get('title'):
            updated = updated or (fields['title'] != self.figshare_title)
            self.figshare_title = fields['title']
        if fields.get('type'):
            updated = updated or (fields['type'] != self.figshare_type)
            self.figshare_type = fields['type']

        self.save()
        if updated:
            node.add_log(
                action='figshare_content_linked',
                params={
                    'project': node.parent_id,
                    'node': node._id,
                    'figshare': {
                        'type': self.figshare_type,
                        'id': self.figshare_id,
                        'title': self.figshare_title,
                    },
                },
                auth=auth,
            )
Example #2
0
    def update_fields(self, fields, node, auth):
        updated = False
        if fields.get('id'):
            updated = updated or (fields['id'] != self.figshare_id)
            self.figshare_id = fields['id']
        if fields.get('name'):
            updated = updated or (fields['name'] != self.figshare_title)
            self.figshare_title = fields['name']
        if fields.get('type'):
            updated = updated or (fields['type'] != self.figshare_type)
            self.figshare_type = fields['type']

        self.save()
        if updated:
            node.add_log(
                action='figshare_content_linked',
                params={
                    'project': node.parent_id,
                    'node': node._id,
                    'figshare': {
                        'type': self.figshare_type,
                        'id': self.figshare_id,
                        'title': self.figshare_title,
                    },
                },
                auth=auth,
            )