Ejemplo n.º 1
0
def setCookieDomain(portal, out):
    app = portal.getPhysicalRoot()
    bid_mgr = app._getOb('browser_id_manager', None)
    if bid_mgr is not None:
        setSite(portal)
        # Hardcoded domain here is just a fallback.
        cookie_domain = get_config('cookie_domain', default='.openplans.org')
        bid_mgr.setCookieDomain(cookie_domain)
        print >> out, "Set cookie domain to %s" % cookie_domain
def feature_project(project_id, description):
    """this stores the project_id in a file """
    feature_dir = get_config("featured_project_dir")
    assert os.path.exists(feature_dir)
    assert os.path.isdir(feature_dir)
    filename = os.path.join(feature_dir, project_id)
    fp = open(filename, 'w')
    fp.write(description)
    fp.close()
Ejemplo n.º 3
0
def get_repo_dir(project, basedir=None):
    if basedir is None:
        basedir = get_config("bzr_repos_dir", None)
    if basedir is None:
        vardir = config.getConfiguration().clienthome
        basedir = os.path.join(vardir, "bzr_repos")

    repo = os.path.join(basedir,
                        "projects", project.getId(),
                        "main-site", "trunk")
    return repo
Ejemplo n.º 4
0
    def show_contact_link(self):
        mem = self.loggedinmember
        if not mem:
            return False

        from opencore.utils import get_config
        trusted_admins = [i.strip() for i in
                          get_config("trusted_list_admins", default="").split(",")]
        if mem.getId() in trusted_admins:
            return True
        else:
            return False
Ejemplo n.º 5
0
    def can_subscribe_others(self):
        try:
            if self.get_tool(
                "portal_membership").checkPermission(
                "Modify portal content", self.portal):
                return True
        except:
            pass

        trusted_admins = [i.strip() for i in
                          get_config("trusted_list_admins", default="").split(",")]
        try:
            if self.loggedinmember.getId() in trusted_admins:
                return True
        except:
            pass

        return False
Ejemplo n.º 6
0
def local_fqdn_return_address(portal, out):
    """
    The profile's properties.xml hard-codes `[email protected]`
    as the value for `email_from_address`. So, if that boilerplate address
    is set, we'll change it to the real address, which can be found as a 
    site config setting `email_from_address`. 

    The `email_from_address` setting must look like a valid email address
    for opencore to work properly, so if that setting doesn't exist, we'll
    make a guess at a valid email_from_address hostname by using the local FQDN.
    """
    default = '*****@*****.**'
    if portal.getProperty('email_from_address') != default:
        return
    address = get_config("email_from_address")
    if address is None:
        address = 'greetings@%s' % socket.getfqdn()
    portal.manage_changeProperties(email_from_address=address)
def get_feature_dir():
    feature_dir = get_config("featured_project_dir")
    assert os.path.exists(feature_dir)
    assert os.path.isdir(feature_dir)
    return feature_dir