Exemplo n.º 1
0
    def _validateBlog(self, blog, validationReporter):
        zaccount = blog.getAccount()
        if not zaccount:
            # defect 534 work around - should not get here
            logger = getLoggerService()
            logger.error(u"Account information not available for Blog ID %s" % blog.getId() ) #$NON-NLS-1$
            validationReporter.addError(u"Blog Account", u"Account information not available for blog %s" % blog.getName() ) #$NON-NLS-1$ #$NON-NLS-2$
            return

        username = zaccount.getAttribute(u"username")#$NON-NLS-1$
        if not getNoneString(username):
            validationReporter.addError(u"Blog Account", u"Username is missing for blog %s" % blog.getName() ) #$NON-NLS-1$ #$NON-NLS-2$
        cyppass = zaccount.getAttribute(u"password")#$NON-NLS-1$
        if not getNoneString(cyppass):
            validationReporter.addError(u"Blog Account", u"Password is missing for blog %s" % blog.getName() ) #$NON-NLS-1$ #$NON-NLS-2$
        else:
            password = None
            try:
                password = crypt.decryptCipherText(cyppass, PASSWORD_ENCRYPTION_KEY)
            except:
                pass
            if not getNoneString(password):
                validationReporter.addError(u"Blog Account", u"Invalid password set for blog %s. Please set the blog account password." % blog.getName() ) #$NON-NLS-1$ #$NON-NLS-2$

        apiInfo = zaccount.getAPIInfo()
        url = apiInfo.getUrl()
        if not getNoneString(url):
            validationReporter.addError(u"Blog Account", u"Blog API URL is required for blog %s" % blog.getName() ) #$NON-NLS-1$ #$NON-NLS-2$

        siteId = apiInfo.getType()
        if not getNoneString(siteId):
            validationReporter.addError(u"Blog Account", u"Blog API type is required for blog %s" % blog.getName() ) #$NON-NLS-1$ #$NON-NLS-2$
Exemplo n.º 2
0
 def _deserializeProperties(self, parentNode):
     properties = {}
     propertyNodes = parentNode.selectNodes(u"zns:properties/zns:property") #$NON-NLS-1$
     for propertyNode in propertyNodes:
         name = propertyNode.getAttribute(u"name") #$NON-NLS-1$
         value = propertyNode.getText()
         if name == u"password": #$NON-NLS-1$
             value = decryptCipherText(value, PASSWORD_ENCRYPTION_KEY)
         properties[name] = value
     return properties
Exemplo n.º 3
0
def createBlogPublisherFromAccount(zaccount, zpublishingsvc, factoryClassname = None):
    username = zaccount.getAttribute(u"username")#$NON-NLS-1$
    cyppass = zaccount.getAttribute(u"password")#$NON-NLS-1$
    password = crypt.decryptCipherText(cyppass, PASSWORD_ENCRYPTION_KEY)
    apiInfo = zaccount.getAPIInfo()
    url = apiInfo.getUrl()
    siteId = apiInfo.getType()
    publisher = createBlogPublisher(username,password,url,siteId,zpublishingsvc,factoryClassname)
    publisher.setAccount( zaccount )
    return publisher
Exemplo n.º 4
0
def createBlogPublisherFromAccount(zaccount,
                                   zpublishingsvc,
                                   factoryClassname=None):
    username = zaccount.getAttribute(u"username")  #$NON-NLS-1$
    cyppass = zaccount.getAttribute(u"password")  #$NON-NLS-1$
    password = crypt.decryptCipherText(cyppass, PASSWORD_ENCRYPTION_KEY)
    apiInfo = zaccount.getAPIInfo()
    url = apiInfo.getUrl()
    siteId = apiInfo.getType()
    publisher = createBlogPublisher(username, password, url, siteId,
                                    zpublishingsvc, factoryClassname)
    publisher.setAccount(zaccount)
    return publisher
Exemplo n.º 5
0
    def _validateBlog(self, blog, validationReporter):
        zaccount = blog.getAccount()
        if not zaccount:
            # defect 534 work around - should not get here
            logger = getLoggerService()
            logger.error(u"Account information not available for Blog ID %s" %
                         blog.getId())  #$NON-NLS-1$
            validationReporter.addError(
                u"Blog Account",
                u"Account information not available for blog %s" %
                blog.getName())  #$NON-NLS-1$ #$NON-NLS-2$
            return

        username = zaccount.getAttribute(u"username")  #$NON-NLS-1$
        if not getNoneString(username):
            validationReporter.addError(
                u"Blog Account", u"Username is missing for blog %s" %
                blog.getName())  #$NON-NLS-1$ #$NON-NLS-2$
        cyppass = zaccount.getAttribute(u"password")  #$NON-NLS-1$
        if not getNoneString(cyppass):
            validationReporter.addError(
                u"Blog Account", u"Password is missing for blog %s" %
                blog.getName())  #$NON-NLS-1$ #$NON-NLS-2$
        else:
            password = None
            try:
                password = crypt.decryptCipherText(cyppass,
                                                   PASSWORD_ENCRYPTION_KEY)
            except:
                pass
            if not getNoneString(password):
                validationReporter.addError(
                    u"Blog Account",
                    u"Invalid password set for blog %s. Please set the blog account password."
                    % blog.getName())  #$NON-NLS-1$ #$NON-NLS-2$

        apiInfo = zaccount.getAPIInfo()
        url = apiInfo.getUrl()
        if not getNoneString(url):
            validationReporter.addError(
                u"Blog Account", u"Blog API URL is required for blog %s" %
                blog.getName())  #$NON-NLS-1$ #$NON-NLS-2$

        siteId = apiInfo.getType()
        if not getNoneString(siteId):
            validationReporter.addError(
                u"Blog Account", u"Blog API type is required for blog %s" %
                blog.getName())  #$NON-NLS-1$ #$NON-NLS-2$
Exemplo n.º 6
0
 def _initProxyConfiguration(self):
     # Get proxy settings from user prefs.        
     userProfile = self.applicationModel.getUserProfile()
     prefs = userProfile.getPreferences()
     enabled = prefs.getUserPreferenceBool(IZAppUserPrefsKeys.PROXY_ENABLE, False)
     host = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_HOST, u"") #$NON-NLS-1$
     port = prefs.getUserPreferenceInt(IZAppUserPrefsKeys.PROXY_PORT, u"") #$NON-NLS-1$
     username = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_USERNAME, u"") #$NON-NLS-1$
     password = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_PASSWORD, u"") #$NON-NLS-1$
     if password:
         password = crypt.decryptCipherText(password, PASSWORD_ENCRYPTION_KEY)
     proxy = ZHttpProxyConfiguration()
     proxy.setEnable(enabled)
     proxy.setHost(host)
     if port > 0:
         proxy.setPort(port)
     proxy.setProxyAuthorization(username, password)
Exemplo n.º 7
0
 def _initProxyConfiguration(self):
     # Get proxy settings from user prefs.
     userProfile = self.applicationModel.getUserProfile()
     prefs = userProfile.getPreferences()
     enabled = prefs.getUserPreferenceBool(IZAppUserPrefsKeys.PROXY_ENABLE,
                                           False)
     host = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_HOST,
                                    u"")  #$NON-NLS-1$
     port = prefs.getUserPreferenceInt(IZAppUserPrefsKeys.PROXY_PORT,
                                       u"")  #$NON-NLS-1$
     username = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_USERNAME,
                                        u"")  #$NON-NLS-1$
     password = prefs.getUserPreference(IZAppUserPrefsKeys.PROXY_PASSWORD,
                                        u"")  #$NON-NLS-1$
     if password:
         password = crypt.decryptCipherText(password,
                                            PASSWORD_ENCRYPTION_KEY)
     proxy = ZHttpProxyConfiguration()
     proxy.setEnable(enabled)
     proxy.setHost(host)
     if port > 0:
         proxy.setPort(port)
     proxy.setProxyAuthorization(username, password)
Exemplo n.º 8
0
    def populateWidgets(self):
        enable = self.session.getUserPreferenceBool(IZAppUserPrefsKeys.PROXY_ENABLE, False) #$NON-NLS-1$
        self.enableCB.SetValue(enable)
        self.controlsPanel.Enable(enable)
        
        host = self.session.getUserPreference(IZAppUserPrefsKeys.PROXY_HOST, u"") #$NON-NLS-1$
        port = self.session.getUserPreferenceInt(IZAppUserPrefsKeys.PROXY_PORT, 0) #$NON-NLS-1$
        if not host:
            # get data from os registry
            proxy = getOSUtil().getProxyConfig()
            if proxy and proxy.isConfigured():
                host = proxy.getHost()            
                port = proxy.getPortInt()
        self.hostTxt.SetValue(host)        
        if port > 0:
            self.portTxt.SetValue( unicode(port) )
        username = self.session.getUserPreference(IZAppUserPrefsKeys.PROXY_USERNAME, u"") #$NON-NLS-1$
        self.usernameTxt.SetValue(username)

        cyppass = self.session.getUserPreference(IZAppUserPrefsKeys.PROXY_PASSWORD, u"") #$NON-NLS-1$
        cyppass = getNoneString(cyppass)
        if cyppass:
            password = crypt.decryptCipherText(cyppass, PASSWORD_ENCRYPTION_KEY)
            self.passwordTxt.SetValue(password)
Exemplo n.º 9
0
 def getPassword(self):
     encpass = self.getAttribute(u"password") #$NON-NLS-1$
     if encpass:
         return crypt.decryptCipherText(encpass, PASSWORD_ENCRYPTION_KEY)
     else:
         return None
Exemplo n.º 10
0
 def getPassword(self):
     encpass = self.getAttribute(u"password")  #$NON-NLS-1$
     if encpass:
         return crypt.decryptCipherText(encpass, PASSWORD_ENCRYPTION_KEY)
     else:
         return None