blog/app/models/posts.py
def update(self):
        """ Calls the parent class update() method, then does some additional
        stuff required by the post object. """

        was_published = getattr(self, 'published', False)

        # manage the attachments/tags/list (of OIDs) before update/save
        for attrib in ['attachments', 'tags', 'paints']:
            if flask.request.json.get(attrib, None) is not None:
                setattr(
                    self,
                    attrib,
                    list(set(
                        [
                            ObjectId(a["$oid"]) for
                            a in flask.request.json[attrib]
                    ]
                    ))
                )

                # log tag and paint usage
                if attrib in ['tags', 'paints']:
                    for a_dict in flask.request.json[attrib]:
                        a_object = models.get_asset(attrib, _id=a_dict['$oid'])
#                        a_object = Tag(_id=tag_dict['$oid'])
                        a_object.set_last_used_on()

                del flask.request.json[attrib]


        super().update(verbose=False)

        if not was_published and self.published:
            self.published_on = datetime.now()
        elif was_published and not getattr(self, 'published', False):
            self.published_on = None

        self.save()
 Calls the parent class update() method, then does some additional
        stuff required by the post object. 
Calls the parent class update() method, then does some additional
stuff required by the post object.
Calls the parent class update () method then does some additional stuff required by the post object .
def update(self):
        was_published = getattr(self, 'published', False)
        for attrib in ['attachments', 'tags', 'paints']:
            if flask.request.json.get(attrib, None) is not None:
                setattr(
                    self,
                    attrib,
                    list(set(
                        [
                            ObjectId(a["$oid"]) for
                            a in flask.request.json[attrib]
                    ]
                    ))
                )
                if attrib in ['tags', 'paints']:
                    for a_dict in flask.request.json[attrib]:
                        a_object = models.get_asset(attrib, _id=a_dict['$oid'])
                        a_object.set_last_used_on()
                del flask.request.json[attrib]
        super().update(verbose=False)
        if not was_published and self.published:
            self.published_on = datetime.now()
        elif was_published and not getattr(self, 'published', False):
            self.published_on = None
        self.save()
def update ( self ) : was_published = getattr ( self , 'published' , False ) for attrib in [ 'attachments' , 'tags' , 'paints' ] : if flask . request . json . get ( attrib , None ) is not None : setattr ( self , attrib , list ( set ( [ ObjectId ( a [ "$oid" ] ) for a in flask . request . json [ attrib ] ] ) ) ) if attrib in [ 'tags' , 'paints' ] : for a_dict in flask . request . json [ attrib ] : a_object = models . get_asset ( attrib , _id = a_dict [ '$oid' ] ) a_object . set_last_used_on ( ) del flask . request . json [ attrib ] super ( ) . update ( verbose = False ) if not was_published and self . published : self . published_on = datetime . now ( ) elif was_published and not getattr ( self , 'published' , False ) : self . published_on = None self . save ( )
Calls the parent class update() method, then does some additional
stuff required by the post object.
Calls the parent class update () method then does some additional stuff required by the post object .
""" Calls the parent class update() method, then does some additional
        stuff required by the post object. """ # manage the attachments/tags/list (of OIDs) before update/save # log tag and paint usage #                        a_object = Tag(_id=tag_dict['$oid'])
self