Public feed #377066

Mine

public text v1 · immutable
Raw Edit
·published 2007-03-01 12:48 UTC
rendered paste body
class NewsType(SQLObject):
    newsTypeName = StringCol(alternateID=True, length=60)
    newsTypeItems = RelatedJoin('News')

class News(SQLObject):
    newsName = StringCol(alternateID=True, length=80)
    #type = RelatedJoin('NewsType')
    categories = RelatedJoin('NewsType')
    created = DateTimeCol()
    modified = DateTimeCol()
    keywords = StringCol()
    description = StringCol()
    content = StringCol()

    def destroySelf(self):
        for category in self.categories:
            self.removeNewsType(category)
        super(News, self).destroySelf()

    ### Tcheckout the next funtion
    def updateCategories(some_bookmark, new_categories):
        for existing_category in some_bookmark.categories:
            some_bookmark.removeNewsType(existing_category)
        for each_category in new_categories:
            some_bookmark.addNewsType(each_category)