コード例 #1
0
    def getPage(self, id):
        """Return a Page object

        @type id: string, or Page object
        @param id: page id, or Page object
        @rtype: Page"""
        return Page.create(self.pm_getSpaceManager().getPage(self._unbox(id)), self._modelDataManager)
コード例 #2
0
    def getPage(self, id):
        """Return a Page object

        @type id: string, or Page object
        @param id: page id, or Page object
        @rtype: Page"""
        return Page.create(self.pm_getSpaceManager().getPage(self._unbox(id)),
                           self._modelDataManager)
コード例 #3
0
    def editPage(self, page):
        """Update content of page

        @type page: Page object
        @param page: Page object having the updated content
        @rtype: Page
        @return: updated Page"""
        return Page.create(self.pm_getSpaceManager().editPage(page.toDict()), self._modelDataManager)
コード例 #4
0
    def findPage(self, space, title):
        """Return a Page object

        @type space: string, or Space object
        @param space: space key, or Space object
        @param title: the title of the page
        @rtype: Page"""
        return Page.create(self.pm_getSpaceManager().findPage(self._unbox(space), title), self._modelDataManager)
コード例 #5
0
    def listPages(self, space):
        """Return a list of available pages in this space

        @type space: string, or Space Object
        @param space: space key, or Space object
        @rtype: Page list
        @return: list of Pages contained in space"""
        return tuple(Page.create(page, self._modelDataManager) for page in self.pm_getSpaceManager().listPages(self._unbox(space)))
コード例 #6
0
    def editPage(self, page):
        """Update content of page

        @type page: Page object
        @param page: Page object having the updated content
        @rtype: Page
        @return: updated Page"""
        return Page.create(self.pm_getSpaceManager().editPage(page.toDict()),
                           self._modelDataManager)
コード例 #7
0
    def findPage(self, space, title):
        """Return a Page object

        @type space: string, or Space object
        @param space: space key, or Space object
        @param title: the title of the page
        @rtype: Page"""
        return Page.create(
            self.pm_getSpaceManager().findPage(self._unbox(space), title),
            self._modelDataManager)
コード例 #8
0
    def listPages(self, space):
        """Return a list of available pages in this space

        @type space: string, or Space Object
        @param space: space key, or Space object
        @rtype: Page list
        @return: list of Pages contained in space"""
        return tuple(
            Page.create(page, self._modelDataManager) for page in
            self.pm_getSpaceManager().listPages(self._unbox(space)))
コード例 #9
0
    def createPageFromFile(self, localFilePath, space, title = None, parentId = None, addFileAsAttachment = False):
        """Create a page and add the localFilePath path content as the page content

        @param localPath: the path of the file on local machine containing the wiki text to be used as new page content
        @type space: string , or Space object
        @param space: space key, or Space object
        @param title: page title(if default value, the file name will be used as a title)
        @param parentId: the page id of the parent page (if default value, the page has no parent)
        @param addFileAsAttachment: if True, the file specified is added as attachment to the page(if default value, no attachment is created)
        @rtype: Page
        @return: newly created Page"""
        return Page.create(self.pm_getSpaceManager().createPageFromFile(localFilePath, self._unbox(space), title, parentId, addFileAsAttachment), self._modelDataManager)
コード例 #10
0
    def addPage(self, space, title, parent = None, content = ''):
        """Create a Page

        @type space: string, or Space object
        @param space: space key, or Space object
        @param title: page title
        @type parent: string, or Page object
        @param parent: the page id of the parent page, or Page object of the parent page(if not passed the page has no parent)
        @param content: page content written as wiki text
        @rtype: Page
        @return: newly created Page"""
        return Page.create(self.pm_getSpaceManager().addPage(self._unbox(space), title, self._unbox(parent), content), self._modelDataManager)
コード例 #11
0
    def addPage(self, space, title, parent=None, content=''):
        """Create a Page

        @type space: string, or Space object
        @param space: space key, or Space object
        @param title: page title
        @type parent: string, or Page object
        @param parent: the page id of the parent page, or Page object of the parent page(if not passed the page has no parent)
        @param content: page content written as wiki text
        @rtype: Page
        @return: newly created Page"""
        return Page.create(
            self.pm_getSpaceManager().addPage(self._unbox(space), title,
                                              self._unbox(parent), content),
            self._modelDataManager)
コード例 #12
0
    def createPageFromFile(self,
                           localFilePath,
                           space,
                           title=None,
                           parentId=None,
                           addFileAsAttachment=False):
        """Create a page and add the localFilePath path content as the page content

        @param localPath: the path of the file on local machine containing the wiki text to be used as new page content
        @type space: string , or Space object
        @param space: space key, or Space object
        @param title: page title(if default value, the file name will be used as a title)
        @param parentId: the page id of the parent page (if default value, the page has no parent)
        @param addFileAsAttachment: if True, the file specified is added as attachment to the page(if default value, no attachment is created)
        @rtype: Page
        @return: newly created Page"""
        return Page.create(
            self.pm_getSpaceManager().createPageFromFile(
                localFilePath, self._unbox(space), title, parentId,
                addFileAsAttachment), self._modelDataManager)
コード例 #13
0
ファイル: manager.py プロジェクト: UniqueLJH/yinongShop
def syncdb():
    from lib.util import find_subclasses
    from model import db, User, Distribution, Category, Page
    
    models = find_subclasses(db.Model)
    for model in models:
        if model.table_exists():
            model.drop_table()
        model.create_table()
        logging.info('created table:%s' % model._meta.db_table)
    
    Distribution.create(name = '免费配送', price = 0)
    Distribution.create(name = '上门自提', price = 0)
    Category.create(name = '积分商品', slug = 'credit', order = 1)
    Category.create(name = '搭配购买', slug = 'acc', order = 2)
    Category.create(name = '慕斯蛋糕', slug = 'mousse', order = 3)
    Category.create(name = '巧克力蛋糕', slug = 'chocolate', order = 4)
    Category.create(name = '乳酪蛋糕', slug = 'cheese', order = 5)
    Category.create(name = '乳脂奶油蛋糕', slug = 'creambutter', order = 6)
    Category.create(name = '冰淇淋蛋糕', slug = 'icecream', order = 7)
    Page.create(name = '吉米的厨房', slug = 'aboutus', content = '')
    Page.create(name = '包装展示', slug = 'bzzs', content = '')
    Page.create(name = '订购说明', slug = 'dgsm', content = '')
    Page.create(name = '如何收货', slug = 'rhsh', content = '')
    Page.create(name = '付款方式', slug = 'fkfs', content = '')
    Page.create(name = '配送范围', slug = 'psfw', content = '')
    User.create(mobile = 'root', password = User.create_password('111111'), group = 9)
    
    logging.info('superuser - username:root password:111111')
コード例 #14
0
def syncdb():
    from lib.util import find_subclasses
    from model import db, User, Distribution, Category, Page

    models = find_subclasses(db.Model)
    for model in models:
        if model.table_exists():
            model.drop_table()
        model.create_table()
        logging.info('created table:%s' % model._meta.db_table)

    User.create(mobile='root',
                password=User.create_password('111111'),
                group=9)
    Distribution.create(name='免费配送', price=0)
    Distribution.create(name='上门自提', price=0)
    Category.create(name='积分商品', slug='credit', order=1)
    Category.create(name='搭配购买', slug='acc', order=2)
    Category.create(name='鸡', slug='ji', order=3)
    Category.create(name='鸭', slug='ya', order=4)
    Category.create(name='鹅', slug='e', order=5)
    Category.delete().where(Category.id == 1).execute()
    Category.delete().where(Category.id == 2).execute()
    #Category.create(name = '乳脂奶油蛋糕', slug = 'creambutter', order = 6)
    #Category.create(name = '冰淇淋蛋糕', slug = 'icecream', order = 7)
    Page.create(name='菜市优品', slug='aboutus', content='')
    Page.create(name='包装展示', slug='bzzs', content='')
    Page.create(name='订购说明', slug='dgsm', content='')
    Page.create(name='如何收货', slug='rhsh', content='')
    Page.create(name='付款方式', slug='fkfs', content='')
    Page.create(name='配送范围', slug='psfw', content='')

    logging.info('superuser - username:root password:111111')