From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 74E3E1381F3 for ; Tue, 27 Aug 2013 15:40:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6C605E09BE; Tue, 27 Aug 2013 15:39:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B5BA6E0E4E for ; Tue, 27 Aug 2013 15:39:56 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9737433EC55 for ; Tue, 27 Aug 2013 15:39:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 125C6E468F for ; Tue, 27 Aug 2013 15:39:54 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1377617366.2a921c0056de70e4a05169cc7d599b809ede3dd6.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/status.py X-VCS-Directories: roverlay/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 2a921c0056de70e4a05169cc7d599b809ede3dd6 X-VCS-Branch: master Date: Tue, 27 Aug 2013 15:39:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d23d1f00-a7ea-440f-aa7b-1e79e8521383 X-Archives-Hash: 44374d80b9748dcbc5e26c41fc90b6a3 commit: 2a921c0056de70e4a05169cc7d599b809ede3dd6 Author: André Erdmann mailerd de> AuthorDate: Tue Aug 27 15:29:26 2013 +0000 Commit: André Erdmann mailerd de> CommitDate: Tue Aug 27 15:29:26 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=2a921c00 roverlay/status.py: some comments --- roverlay/status.py | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/roverlay/status.py b/roverlay/status.py index 59c8cb6..595e8fb 100644 --- a/roverlay/status.py +++ b/roverlay/status.py @@ -5,7 +5,6 @@ # either version 2 of the License, or (at your option) any later version. # --- TODO/FIXME --- -# * what happens if the database has UNKNOWNS? # * RRA creation doesn't seem to be correct # @@ -46,6 +45,28 @@ class DBStats ( roverlay.stats.rating.RoverlayNumStatsRating ): # --- end of __init__ (...) --- def make_suggestions ( self, pure_text=False ): + """Creates a list of 2-tuples ( , list
) with + suggestions and stores it as self.suggestions. + + List example: + [ + ( + "normal/expected failure rate", + [ + "write dependency rules", + "configure package ignore rules", + ] + ), + ( + ... + ), + ] + + arguments: + * pure_text -- disable html tags + + Returns: True if any suggestions available, else False. + """ self.suggestions = list ( self.get_suggestions ( pure_text=pure_text ) ) return bool ( self.suggestions ) # --- end of __init__ (...) --- @@ -53,9 +74,8 @@ class DBStats ( roverlay.stats.rating.RoverlayNumStatsRating ): # --- end of DBStats --- - - class ReferenceableDict ( dict ): + def ref ( self ): return weakref.ref ( self ) # --- end of ref (...) --- @@ -178,6 +198,9 @@ class StatusRuntimeEnvironment ( roverlay.runtime.RuntimeEnvironmentBase ): def do_setup_mako ( self ): + + + # set up template_dirs / default_template template_dirs = [] self.default_template = 'status' @@ -211,7 +234,7 @@ class StatusRuntimeEnvironment ( roverlay.runtime.RuntimeEnvironmentBase ): raise Exception ( "no template directories found!" ) - + # get module root (for caching) if 'module_root' in self.options: module_dir = self.options ['module_root'] else: @@ -230,6 +253,7 @@ class StatusRuntimeEnvironment ( roverlay.runtime.RuntimeEnvironmentBase ): # 'python_' + hex ( sys.hexversion>>16 ) + # create lookup object self._mako_lookup = mako.lookup.TemplateLookup ( directories=template_dirs, module_directory=module_dir, output_encoding=self.TEMPLATE_ENCODING, @@ -316,6 +340,20 @@ class StatusRuntimeEnvironment ( roverlay.runtime.RuntimeEnvironmentBase ): file_extensions=[ '', ], add_mode_ext=True ): + """Tries to find a template. + + arguments: + * template_name -- name of the template + * file_extensions -- an iterable containing possible file extensions, + in order + * add_mode_ext -- whether to try script_mode-specific file extension + first (Defaults to True). + + Returns: a Template object + + Raises: + * Passes mako.exceptions.TopLevelLookupException if template not found + """ my_template = None if add_mode_ext: