def _getPage(currentSpace, pageUrl): if pageUrl: page = _getPageWithSpaceAndUrl(currentSpace, pageUrl) else: defaultPage = configuration.scrap['default']['page'] defaultTitle = defaultPage['title'] page = _getPageWithSpaceAndUrl(currentSpace, defaultTitle) if not page: defaultTemplate = getPageTemplate(defaultPage['template']) page = space.Page(ressourceType=ressourceservice.getRessourceType('page'), owner=userservice.getSystemUser(), title=defaultTitle, url=defaultTitle, space=currentSpace, pageTemplate=defaultTemplate) page.put() defaultComponentName = configuration.scrap['default']['component']['name'] defaultComponent = component.Component(ressourceType=ressourceservice.getRessourceType('component'), owner=userservice.getSystemUser(), componentType=componentservice.getComponentType(defaultComponentName), page=page, columnNumber=1, styleClass='') defaultComponent.put() return page
def _getSpace(spaceName): if spaceName: currentSpace = _getSpaceWithName(spaceName) else: default = configuration.scrap['default'] defaultSpace = default['space'] currentSpace = _getSpaceWithName(defaultSpace) if not currentSpace: defaultTheme = getTheme(default['theme']) if defaultTheme: currentSpace = space.Space(ressourceType=ressourceservice.getRessourceType('space'), owner=userservice.getSystemUser(), name=defaultSpace, theme=defaultTheme) currentSpace.put() return currentSpace