示例#1
0
    def __safe_call__ (self):
        app_id   = CTK.cfg.get_val('tmp!market!install!app!application_id')
        app_name = CTK.cfg.get_val('tmp!market!install!app!application_name')

        info = {'cherokee_version': VERSION,
                'system':           SystemInfo.get_info()}

        xmlrpc = XmlRpcServer (OWS_APPS_INSTALL, user=OWS_Login.login_user, password=OWS_Login.login_password)
        install_info = xmlrpc.get_install_info (app_id, info)

        Install_Log.log ("Waiting for the payment acknowledge…")

        box = CTK.Box()
        if install_info.get('due_payment'):
            set_timeout_js = "setTimeout (reload_druid, %s);" %(PAYMENT_CHECK_TIMEOUT)
            box += CTK.RawHTML ("<h2>%s %s</h2>"%(_('Checking out'), app_name))
            box += CTK.RawHTML ('<h1>%s</h1>' %(_("Waiting for the payment acknowledge…")))
            box += CTK.RawHTML (js="function reload_druid() {%s %s}" %(CTK.DruidContent__JS_to_goto (box.id, URL_INSTALL_PAY_CHECK), set_timeout_js))
            box += CTK.RawHTML (js=set_timeout_js)

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Cancel'))
            box += buttons

        else:
            Install_Log.log ("Payment ACK!")

            # Invalidate 'My Library' cache
            MyLibrary.Invalidate_Cache()

            # Move on
            CTK.cfg['tmp!market!install!download'] = install_info['url']
            box += CTK.DruidContent__JS_to_goto (box.id, URL_INSTALL_DOWNLOAD)

        return box.Render().toStr()
示例#2
0
def update_cache():
    global cached_info
    global cache_expiration

    if not cached_info or cache_expiration < time.time():
        xmlrpc = XmlRpcServer (OWS_APPS_AUTH, OWS_Login.login_user, OWS_Login.login_password)
        cached_info = xmlrpc.get_user_apps()
        cache_expiration = time.time() + EXPIRATION
示例#3
0
def update_cache():
    global cached_info
    global cache_expiration

    if not cached_info or cache_expiration < time.time():
        xmlrpc = XmlRpcServer(OWS_APPS_AUTH, OWS_Login.login_user,
                              OWS_Login.login_password)
        cached_info = xmlrpc.get_user_apps()
        cache_expiration = time.time() + EXPIRATION
示例#4
0
文件: Review.py 项目: chetan/cherokee
def Review_Apply():
    rate = CTK.post.get_val("rate")
    title = CTK.post.get_val("title")
    review = CTK.post.get_val("review")
    app_id = CTK.post.get_val("application_id")

    # OWS auth
    xmlrpc = XmlRpcServer(OWS_APPS_AUTH, OWS_Login.login_user, OWS_Login.login_password)
    try:
        ok = xmlrpc.set_review(app_id, rate, title, review)
    except:
        ok = False

    return {"ret": ("error", "ok")[ok]}
示例#5
0
def Exception_Handler_Apply():
    # Collect information
    info = {}
    info['log']      = Install_Log.get_full_log()
    info['user']     = OWS_Login.login_user
    info['comments'] = CTK.post['comments']
    info['platform'] = SystemInfo.get_info()
    info['tmp!market!install'] = CTK.cfg['tmp!market!install'].serialize()

    # Send it
    xmlrpc = XmlRpcServer (OWS_APPS_INSTALL, user=OWS_Login.login_user, password=OWS_Login.login_password)
    install_info = xmlrpc.report_exception (info)

    return CTK.cfg_reply_ajax_ok()
示例#6
0
    def __safe_call__ (self):
        app_id   = CTK.cfg.get_val('tmp!market!install!app!application_id')
        app_name = CTK.cfg.get_val('tmp!market!install!app!application_name')

        info = {'cherokee_version': VERSION,
                'system':           SystemInfo.get_info()}

        cont = CTK.Box()
        xmlrpc = XmlRpcServer (OWS_APPS_INSTALL, user=OWS_Login.login_user, password=OWS_Login.login_password)
        install_info = xmlrpc.get_install_info (app_id, info)

        if install_info.get('error'):
            title  = install_info['error']['error_title']
            errors = install_info['error']['error_strings']

            cont += CTK.RawHTML ("<h2>%s</h2>"%(_(title)))
            for error in errors:
                cont += CTK.RawHTML ("<p>%s</p>"%(_(error)))

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Close'))
            cont += buttons

        elif install_info['installable']:
            # Do not change this log line. It is used by the
            # Maintenance.py file to figure out the app name
            Install_Log.log ("Checking: %s, ID: %s = Installable, URL=%s" %(app_name, app_id, install_info['url']))

            CTK.cfg['tmp!market!install!download'] = install_info['url']
            cont += CTK.RawHTML (js = CTK.DruidContent__JS_to_goto (cont.id, URL_INSTALL_DOWNLOAD))

        else:
            Install_Log.log ("Checking: %s, ID: %s = Must check out first" %(app_name, app_id))

            cont += CTK.RawHTML ("<h2>%s %s</h2>"%(_('Checking out'), app_name))
            cont += CTK.RawHTML ("<p>%s</p>"  %(_(NOTE_ALL_READY_TO_BUY_1)))
            cont += CTK.RawHTML ("<p>%s</p>"  %(_(NOTE_ALL_READY_TO_BUY_2)))

            checkout = CTK.Button (_("Check Out"))
            checkout.bind ('click', CTK.DruidContent__JS_to_goto (cont.id, URL_INSTALL_PAY_CHECK) +
                                    CTK.JS.OpenWindow('%s/order/%s' %(OWS_STATIC, app_id)))

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Cancel'))
            buttons += checkout
            cont += buttons

        return cont.Render().toStr()
示例#7
0
def Review_Apply():
    rate   = CTK.post.get_val('rate')
    title  = CTK.post.get_val('title')
    review = CTK.post.get_val('review')
    app_id = CTK.post.get_val('application_id')

    # OWS auth
    xmlrpc = XmlRpcServer(OWS_APPS_AUTH, OWS_Login.login_user, OWS_Login.login_password)
    try:
        ok = xmlrpc.set_review (app_id, rate,
                                CTK.util.to_unicode(title),
                                CTK.util.to_unicode(review))
    except:
        ok = False

    return {'ret': ('error','ok')[ok]}
示例#8
0
def Review_Apply():
    rate = CTK.post.get_val('rate')
    title = CTK.post.get_val('title')
    review = CTK.post.get_val('review')
    app_id = CTK.post.get_val('application_id')

    # OWS auth
    xmlrpc = XmlRpcServer(OWS_APPS_AUTH, OWS_Login.login_user,
                          OWS_Login.login_password)
    try:
        ok = xmlrpc.set_review(app_id, rate, CTK.util.to_unicode(title),
                               CTK.util.to_unicode(review))
    except:
        ok = False

    return {'ret': ('error', 'ok')[ok]}
示例#9
0
def Exception_Handler_Apply():
    # Collect information
    info = {}
    info['log'] = Install_Log.get_full_log()
    info['user'] = OWS_Login.login_user
    info['comments'] = CTK.post['comments']
    info['platform'] = SystemInfo.get_info()
    info['cfg'] = CTK.cfg.serialize()
    info['tmp!market!install'] = CTK.cfg['tmp!market!install'].serialize()

    # Send it
    xmlrpc = XmlRpcServer(OWS_APPS_INSTALL,
                          user=OWS_Login.login_user,
                          password=OWS_Login.login_password)
    install_info = xmlrpc.report_exception(info)

    return CTK.cfg_reply_ajax_ok()
示例#10
0
 def __init__(self):
     CTK.XMLRPCProxy.__init__(
         self,
         name='cherokee-market-block2',
         xmlrpc_func=lambda: XmlRpcServer(OWS_RPC).get_block_market_2(
             CTK.i18n.active_lang, VERSION),
         format_func=lambda x: x,
         debug=DEBUG)
示例#11
0
def Report_Apply():
    app_id   = CTK.post.get_val('app_id')
    report   = CTK.post.get_val('report')
    app_logs = get_logs (app_id)
    sysinfo  = SystemInfo.get_info()
    cfg      = str(CTK.cfg)

    # OWS Open
    xmlrpc = XmlRpcServer(OWS_APPS_CENTER, OWS_Login.login_user, OWS_Login.login_password)
    try:
        ok = xmlrpc.report_application (app_id,                        # int
                                        CTK.util.to_unicode(report),   # string
                                        CTK.util.to_unicode(app_logs), # list
                                        CTK.util.to_unicode(sysinfo),  # dict
                                        CTK.util.to_unicode(cfg))      # string
    except:
        ok = False

    return {'ret': ('error','ok')[ok]}
示例#12
0
def Report_Apply():
    app_id = CTK.post.get_val('app_id')
    report = CTK.post.get_val('report')
    app_logs = get_logs(app_id)
    sysinfo = SystemInfo.get_info()
    cfg = str(CTK.cfg)

    # OWS Open
    xmlrpc = XmlRpcServer(OWS_APPS_CENTER, OWS_Login.login_user,
                          OWS_Login.login_password)
    try:
        ok = xmlrpc.report_application(
            app_id,  # int
            CTK.util.to_unicode(report),  # string
            CTK.util.to_unicode(app_logs),  # list
            CTK.util.to_unicode(sysinfo),  # dict
            CTK.util.to_unicode(cfg))  # string
    except:
        ok = False

    return {'ret': ('error', 'ok')[ok]}
    def __init__(self):
        CTK.Box.__init__(self)

        if Latest_Release.cache_info and \
           Latest_Release.cache_expiration > time.time():
            self += CTK.RawHTML(self.cache_info)
        else:
            self += CTK.XMLRPCProxy(
                'cherokee-latest-release',
                xmlrpc_func=XmlRpcServer(OWS_RPC).get_latest,
                format_func=self.format,
                debug=True)
示例#14
0
    def __init__(self):
        CTK.Box.__init__(self, {'class': 'market-my-library'})
        self += CTK.RawHTML('<h3>%s</h3>' % (_('My Library')))

        if cached_info and cache_expiration > time.time():
            self += CTK.RawHTML(self.format_func(cached_info, from_cache=True))
        else:
            self += CTK.XMLRPCProxy(
                name='cherokee-my-library',
                xmlrpc_func=lambda: XmlRpcServer(
                    OWS_APPS_AUTH, OWS_Login.login_user, OWS_Login.
                    login_password).get_user_apps(),
                format_func=self.format_func,
                debug=OWS_DEBUG)
示例#15
0
    def __init__(self):
        CTK.Container.__init__(self)

        # Skip the XML-RPC if OWS is inactive
        if not int(CTK.cfg.get_val('admin!ows!enabled', OWS_ENABLE)):
            return

        # Instance the XML-RPC Proxy object
        if Index_Block2.cached:
            self += CTK.RawHTML(Index_Block2.cached)
        else:
            self += CTK.XMLRPCProxy(
                name='cherokee-index-block2',
                xmlrpc_func=lambda: XmlRpcServer(OWS_RPC).get_block_index_2(
                    CTK.i18n.active_lang, VERSION),
                format_func=self.format_func,
                debug=DEBUG)
 def __init__(self):
     CTK.XMLRPCProxy.__init__(self,
                              'cherokee-tweets',
                              XmlRpcServer(OWS_RPC).get_tweets,
                              self.format,
                              debug=True)
 def __init__(self):
     CTK.XMLRPCProxy.__init__(self,
                              'cherokee-mailing-list',
                              XmlRpcServer(OWS_RPC).get_mailing_list,
                              self.format,
                              debug=True)