当前位置: 首页>>代码示例>>Python>>正文


Python msclog.debug_log函数代码示例

本文整理汇总了Python中msclog.debug_log函数的典型用法代码示例。如果您正苦于以下问题:Python debug_log函数的具体用法?Python debug_log怎么用?Python debug_log使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了debug_log函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: myItemsActionButtonClicked_

    def myItemsActionButtonClicked_(self, item_name):
        '''this method is called from JavaScript when the user clicks
        the Install/Remove/Cancel button in the My Items view'''
        document = self.webView.mainFrameDocument()
        item = MunkiItems.optionalItemForName_(item_name)
        status_line = document.getElementById_('%s_status_text' % item_name)
        btn = document.getElementById_('%s_action_button_text' % item_name)
        if not item or not btn or not status_line:
            msclog.debug_log('User clicked MyItems action button for %s' % item_name)
            msclog.debug_log('Unexpected error finding HTML elements')
            return
        prior_status = item['status']
        item.update_status()
        
        self.displayUpdateCount()
        if item['status'] == 'not-installed':
            # we removed item from list of things to install
            # now remove from display
            table_row = document.getElementById_('%s_myitems_table_row' % item_name)
            if table_row:
                node = table_row.parentNode().removeChild_(table_row)
        else:
            btn.setInnerText_(item['myitem_action_text'])
            status_line.setInnerText_(item['status_text'])
            status_line.setClassName_('status %s' % item['status'])

        if item['status'] in ['install-requested', 'removal-requested']:
            self._alertedUserToOutstandingUpdates = False
            if not self._update_in_progress:
                self.updateNow()
        elif prior_status in ['will-be-installed', 'update-will-be-installed',
                              'will-be-removed']:
            # cancelled a pending install or removal; should run an updatecheck
            self.checkForUpdates(suppress_apple_update_check=True)
开发者ID:altyus,项目名称:munki,代码行数:34,代码来源:MSCMainWindowController.py

示例2: checkProcess_

 def checkProcess_(self, timer):
     '''Monitors managedsoftwareupdate process for failure to start
     or unexpected exit, so we're not waiting around forever if
     managedsoftwareupdate isn't running.'''
     PYTHON_SCRIPT_NAME = u'managedsoftwareupdate'
     NEVER_STARTED = -2
     UNEXPECTEDLY_QUIT = -1
     
     if self.session_started:
         if self.got_status_update:
             # we got a status update since we last checked; no need to
             # check the process table
             self.timeout_counter = 6
             self.saw_process = True
             # clear the flag so we have to get another status update
             self.got_status_update = False
         elif munki.pythonScriptRunning(PYTHON_SCRIPT_NAME):
             self.timeout_counter = 6
             self.saw_process = True
         else:
             msclog.debug_log('managedsoftwareupdate not running...')
             self.timeout_counter -= 1
         if self.timeout_counter == 0:
             msclog.debug_log('Timed out waiting for managedsoftwareupdate.')
             if self.saw_process:
                 self.sessionEnded_(UNEXPECTEDLY_QUIT)
             else:
                 self.sessionEnded_(NEVER_STARTED)
开发者ID:LTSAdmin,项目名称:munki,代码行数:28,代码来源:MSCStatusController.py

示例3: confirmUpdatesAndInstall

 def confirmUpdatesAndInstall(self):
     '''Make sure it's OK to proceed with installing if logout or restart is required'''
     if self.alertedToMultipleUsers():
         return
     elif MunkiItems.updatesRequireRestart():
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Restart Required", u"Restart Required title"),
             NSLocalizedString(u"Log out and update", u"Log out and Update button text"),
             NSLocalizedString(u"Cancel", u"Cancel button title/short action text"),
             nil,
             u"%@", NSLocalizedString(
                 (u"A restart is required after updating. Please be patient "
                 "as there may be a short delay at the login window. Log "
                 "out and update now?"), u"Restart Required detail"))
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.window, self,
             self.logoutAlertDidEnd_returnCode_contextInfo_, nil)
     elif MunkiItems.updatesRequireLogout() or munki.installRequiresLogout():
         alert = NSAlert.alertWithMessageText_defaultButton_alternateButton_otherButton_informativeTextWithFormat_(
             NSLocalizedString(u"Logout Required", u"Logout Required title"),
             NSLocalizedString(u"Log out and update", u"Log out and Update button text"),
             NSLocalizedString(u"Cancel", u"Cancel button title/short action text"),
             nil,
             u"%@", NSLocalizedString(
                 (u"A logout is required before updating. Please be patient "
                 "as there may be a short delay at the login window. Log "
                 "out and update now?"), u"Logout Required detail"))
         alert.beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo_(
             self.window, self,
                 self.logoutAlertDidEnd_returnCode_contextInfo_, nil)
     else:
         # we shouldn't have been invoked if neither a restart or logout was required
         msclog.debug_log(
                     'confirmUpdatesAndInstall was called but no restart or logout was needed')
开发者ID:LTSAdmin,项目名称:munki,代码行数:34,代码来源:AlertController.py

示例4: load_page

 def load_page(self, url_fragment):
     '''Tells the WebView to load the appropriate page'''
     msclog.debug_log('load_page request for %s' % url_fragment)
     html_file = os.path.join(self.html_dir, url_fragment)
     request = NSURLRequest.requestWithURL_cachePolicy_timeoutInterval_(
         NSURL.fileURLWithPath_(html_file), NSURLRequestReloadIgnoringLocalCacheData, 10)
     self.webView.mainFrame().loadRequest_(request)
开发者ID:altyus,项目名称:munki,代码行数:7,代码来源:MSCMainWindowController.py

示例5: webView_resource_willSendRequest_redirectResponse_fromDataSource_

 def webView_resource_willSendRequest_redirectResponse_fromDataSource_(
         self, sender, identifier, request, redirectResponse, dataSource):
     '''By reacting to this delegate notification, we can build the page
     the WebView wants to load'''
     msclog.debug_log('webView_resource_willSendRequest_redirectResponse_fromDataSource_')
     url = request.URL()
     msclog.debug_log('Got URL scheme: %s' % url.scheme())
     if url.scheme() == NSURLFileScheme:
         msclog.debug_log(u'Request path is %s' % url.path())
         if self.html_dir in url.path():
             msclog.debug_log(u'request for %s' % url.path())
             filename = unicode(url.lastPathComponent())
             if (filename.endswith(u'.html')
                 and (filename.startswith(u'detail-')
                      or filename.startswith(u'category-')
                      or filename.startswith(u'filter-')
                      or filename.startswith(u'developer-')
                      or filename.startswith(u'updatedetail-')
                      or filename == u'myitems.html'
                      or filename == u'updates.html'
                      or filename == u'categories.html')):
                 try:
                     mschtml.build_page(filename)
                 except BaseException, err:
                     msclog.debug_log(u'Could not build page for %s: %s' % (filename, err))
开发者ID:altyus,项目名称:munki,代码行数:25,代码来源:MSCMainWindowController.py

示例6: build_updatedetail_page

def build_updatedetail_page(identifier):
    '''Build detail page for a non-optional update'''
    items = MunkiItems.getUpdateList()
    page_name = u'updatedetail-%s.html' % identifier
    name, sep, version = identifier.partition('--version-')
    for item in items:
        if item['name'] == name and item.get('version_to_install', '') == version:
            page = MunkiItems.UpdateItem(item)
            escapeAndQuoteCommonFields(page)
            addDetailSidebarLabels(page)
            force_install_after_date = item.get('force_install_after_date')
            if force_install_after_date:
                try:
                    local_date = munki.discardTimeZoneFromDate(
                                                force_install_after_date)
                    date_str = munki.shortRelativeStringFromDate(
                                                local_date)
                    page['dueLabel'] += u' '
                    page['short_due_date'] = date_str
                except munki.BadDateError:
                    # some issue with the stored date
                    msclog.debug_log('Problem with force_install_after_date for %s' % identifier)
                    page['dueLabel'] = u''
                    page['short_due_date'] = u''
            else:
                page['dueLabel'] = u''
                page['short_due_date'] = u''

            footer = get_template('footer_template.html', raw=True)
            generate_page(page_name, 'updatedetail_template.html', page, footer=footer)
            return
    # if we get here we didn't find any item matching identifier
    msclog.debug_log('No update detail found for %s' % identifier)
    build_item_not_found_page(page_name)
开发者ID:50kaliber,项目名称:munki,代码行数:34,代码来源:mschtml.py

示例7: updateListPage

 def updateListPage(self):
     '''Update the optional items list page with current data.
     Modifies the DOM to avoid ugly browser refresh'''
     page_url = self.webView.mainFrameURL()
     filename = NSURL.URLWithString_(page_url).lastPathComponent()
     name = os.path.splitext(filename)[0]
     key, p, value = name.partition('-')
     category = None
     filter = None
     developer = None
     if key == 'category':
         if value != 'all':
             category = value
     elif key == 'filter':
         filter = value
     elif key == 'developer':
         developer = value
     else:
         msclog.debug_log('updateListPage unexpected error: _current_page_filename is %s' %
               filename)
         return
     msclog.debug_log(
           'updating software list page with category: %s, developer; %s, filter: %s' %
           (category, developer, filter))
     items_html = mschtml.build_list_page_items_html(
                         category=category, developer=developer, filter=filter)
     document = self.webView.mainFrameDocument()
     items_div_element = document.getElementById_('optional_installs_items')
     items_div_element.setInnerHTML_(items_html)
开发者ID:altyus,项目名称:munki,代码行数:29,代码来源:MSCMainWindowController.py

示例8: kickOffInstallSession

 def kickOffInstallSession(self):
     '''start an update install/removal session'''
     # check for need to logout, restart, firmware warnings
     # warn about blocking applications, etc...
     # then start an update session
     if MunkiItems.updatesRequireRestart() or MunkiItems.updatesRequireLogout():
         # switch to updates view
         self.loadUpdatesPage_(self)
         # warn about need to logout or restart
         self.alert_controller.confirmUpdatesAndInstall()
     else:
         if self.alert_controller.alertedToBlockingAppsRunning():
             self.loadUpdatesPage_(self)
             return
         if self.alert_controller.alertedToRunningOnBatteryAndCancelled():
             self.loadUpdatesPage_(self)
             return
         self.managedsoftwareupdate_task = None
         msclog.log("user", "install_without_logout")
         self._update_in_progress = True
         self.displayUpdateCount()
         self.setStatusViewTitle_(NSLocalizedString(u"Updating...", u"Updating message"))
         result = munki.justUpdate()
         if result:
             msclog.debug_log("Error starting install session: %s" % result)
             self.munkiStatusSessionEnded_(2)
         else:
             self.managedsoftwareupdate_task = "installwithnologout"
             NSApp.delegate().statusController.startMunkiStatusSession()
             self.markPendingItemsAsInstalling()
开发者ID:altyus,项目名称:munki,代码行数:30,代码来源:MSCMainWindowController.py

示例9: updateDOMforOptionalItem

 def updateDOMforOptionalItem(self, item):
     '''Update displayed status of an item'''
     document = self.webView.mainFrameDocument()
     if not document:
         return
     status_line = document.getElementById_('%s_status_text' % item['name'])
     status_text_span = document.getElementById_('%s_status_text_span' % item['name'])
     btn = document.getElementById_('%s_action_button_text' % item['name'])
     if not btn or not status_line:
         msclog.debug_log('ERROR in updateDOMforOptionalItem: could not find items in DOM')
         return
     btn_classes = btn.className().split(' ')
     # filter out status class
     btn_classes = [class_name for class_name in btn_classes
                    if class_name in ['msc-button-inner', 'large', 'small', 'install-updates']]
     btn_classes.append(item['status'])
     btn.setClassName_(' '.join(btn_classes))
     if 'install-updates' in btn_classes:
         btn.setInnerText_(item['myitem_action_text'])
     elif 'large' in btn_classes:
         btn.setInnerText_(item['long_action_text'])
     else:
         btn.setInnerText_(item['short_action_text'])
     if status_text_span:
         status_text_span.setInnerText_(item['status_text'])
     status_line.setClassName_(item['status'])
开发者ID:altyus,项目名称:munki,代码行数:26,代码来源:MSCMainWindowController.py

示例10: forcedLogoutWarning

 def forcedLogoutWarning(self, notification_obj):
     '''Received a logout warning from the logouthelper for an
     upcoming forced install'''
     msclog.debug_log(u"Managed Software Center got forced logout warning")
     # got a notification of an upcoming forced install
     # switch to updates view, then display alert
     self.loadUpdatesPage_(self)
     self.alert_controller.forcedLogoutWarning(notification_obj)
开发者ID:altyus,项目名称:munki,代码行数:8,代码来源:MSCMainWindowController.py

示例11: build_detail_page

def build_detail_page(item_name):
    '''Build page showing detail for a single optional item'''
    msclog.debug_log('build_detail_page for %s' % item_name)
    items = MunkiItems.getOptionalInstallItems()
    page_name = u'detail-%s.html' % item_name
    for item in items:
        if item['name'] == item_name:
            page = MunkiItems.OptionalItem(item)
            addDetailSidebarLabels(page)
            # make "More in CategoryFoo" list
            page['hide_more_in_category'] = u'hidden'
            more_in_category_html = u''
            more_in_category = []
            if item.get('category'):
                category = item['category']
                page['category_link'] = u'category-%s.html' % quote(category)
                more_in_category = [a for a in items
                                    if a.get('category') == category
                                    and a != item
                                    and a.get('status') != 'installed']
                if more_in_category:
                    page['hide_more_in_category'] = u''
                    page['moreInCategoryLabel'] = page['moreInCategoryLabel'] % page['category']
                    shuffle(more_in_category)
                    more_template = get_template('detail_more_items_template.html')
                    for more_item in more_in_category[:4]:
                        more_item['second_line'] = more_item.get('developer', '')
                        more_in_category_html += more_template.safe_substitute(more_item)
            page['more_in_category'] = more_in_category_html
            # make "More by DeveloperFoo" list
            page['hide_more_by_developer'] = u'hidden'
            more_by_developer_html = u''
            more_by_developer = []
            if item.get('developer'):
                developer = item['developer']
                page['developer_link'] = u'developer-%s.html' % quote(developer)
                more_by_developer = [a for a in items
                                     if a.get('developer') == developer
                                     and a != item
                                     and a not in more_in_category
                                     and a.get('status') != 'installed']
                if more_by_developer:
                    page['hide_more_by_developer'] = u''
                    page['moreByDeveloperLabel'] = (
                        page['moreByDeveloperLabel'] % developer)
                    shuffle(more_by_developer)
                    more_template = get_template(
                                        'detail_more_items_template.html')
                    for more_item in more_by_developer[:4]:
                        more_item['second_line'] = more_item.get('category', '')
                        more_by_developer_html += more_template.safe_substitute(more_item)
            page['more_by_developer'] = more_by_developer_html
            footer = get_template('footer_template.html', raw=True)
            generate_page(page_name, 'detail_template.html', page, footer=footer)
            return
    msclog.debug_log('No detail found for %s' % item_name)
    build_item_not_found_page(page_name)
开发者ID:LTSAdmin,项目名称:munki,代码行数:57,代码来源:mschtml.py

示例12: write_page

def write_page(page_name, html):
    '''write html to page_name in our local html directory'''
    html_file = os.path.join(msclib.html_dir(), page_name)
    try:
        f = open(html_file, 'w')
        f.write(html.encode('utf-8'))
        f.close()
    except (OSError, IOError), err:
        msclog.debug_log('write_page error: %s', str(err))
        raise
开发者ID:50kaliber,项目名称:munki,代码行数:10,代码来源:mschtml.py

示例13: openMunkiURL

 def openMunkiURL(self, url):
     '''Display page associated with munki:// url'''
     parsed_url = urlparse(url)
     if parsed_url.scheme != 'munki':
         msclog.debug_log("URL %s has unsupported scheme" % url)
         return
     filename = mschtml.unquote(parsed_url.netloc)
     # add .html if no extension
     if not os.path.splitext(filename)[1]:
         filename += u'.html'
     if filename.endswith(u'.html'):
         mschtml.build_page(filename)
         self.mainWindowController.load_page(filename)
     else:
         msclog.debug_log("%s doesn't have a valid extension. Prevented from opening" % url)
开发者ID:clburlison,项目名称:munki,代码行数:15,代码来源:MSCAppDelegate.py

示例14: openURL_withReplyEvent_

 def openURL_withReplyEvent_(self, event, replyEvent):
     '''Handle openURL messages'''
     keyDirectObject = struct.unpack(">i", "----")[0]
     url = event.paramDescriptorForKeyword_(keyDirectObject).stringValue().decode('utf8')
     msclog.log("MSU", "Called by external URL: %s", url)
     parsed_url = urlparse(url)
     if parsed_url.scheme != 'munki':
         msclog.debug_log("URL %s has unsupported scheme" % url)
         return
     filename = mschtml.unquote(parsed_url.netloc)
     # add .html if no extension
     if not os.path.splitext(filename)[1]:
         filename += u'.html'
     if filename.endswith(u'.html'):
         mschtml.build_page(filename)
         self.mainWindowController.load_page(filename)
     else:
         msclog.debug_log("%s doesn't have a valid extension. Prevented from opening" % url)
开发者ID:LTSAdmin,项目名称:munki,代码行数:18,代码来源:MSCAppDelegate.py

示例15: get_custom_resources

def get_custom_resources():
    '''copies custom resources into our html dir'''
    if not _html_dir:
        return
    managed_install_dir = munki.pref('ManagedInstallDir')
    source_path = os.path.join(managed_install_dir, 'client_resources/custom.zip')
    if os.path.exists(source_path):
        dest_path = os.path.join(_html_dir, 'custom')
        if os.path.exists(dest_path):
            try:
                shutil.rmtree(dest_path, ignore_errors=True)
            except (OSError, IOError), err:
                msclog.debug_log('Error clearing %s: %s' % (dest_path, err))
        if not os.path.exists(dest_path):
            try:
                os.mkdir(dest_path)
            except (OSError, IOError), err:
                msclog.debug_log('Error creating %s: %s' % (dest_path, err))
开发者ID:SteveKueng,项目名称:munki,代码行数:18,代码来源:msclib.py


注:本文中的msclog.debug_log函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。