Return-Path: X-Original-To: apmail-incubator-bloodhound-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-bloodhound-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F3549E433 for ; Mon, 17 Dec 2012 18:09:25 +0000 (UTC) Received: (qmail 2194 invoked by uid 500); 17 Dec 2012 18:09:25 -0000 Delivered-To: apmail-incubator-bloodhound-dev-archive@incubator.apache.org Received: (qmail 2135 invoked by uid 500); 17 Dec 2012 18:09:25 -0000 Mailing-List: contact bloodhound-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bloodhound-dev@incubator.apache.org Delivered-To: mailing list bloodhound-dev@incubator.apache.org Received: (qmail 2127 invoked by uid 99); 17 Dec 2012 18:09:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Dec 2012 18:09:25 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of olemis@gmail.com designates 209.85.210.175 as permitted sender) Received: from [209.85.210.175] (HELO mail-ia0-f175.google.com) (209.85.210.175) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Dec 2012 18:09:20 +0000 Received: by mail-ia0-f175.google.com with SMTP id z3so5516435iad.6 for ; Mon, 17 Dec 2012 10:09:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=vaw6wL0vu4bXQhoVNRpfo+l5+HnuYZOkchz4kzJ6iNY=; b=Km1mM5I9BGKAt1xiANxgYs4a7XjC3vTB6tZagjUZXZid5+0fD0n/RbSwOsg4dc4AO6 Qkx3UGjWrwvIMWNXohbtsQ/wtGjWUnYftgyDwwX24aGBQKUqnMq3zwC48D4QBpwQsuiS p87k6eI2kP+ldHRX1lvUl8GaA6L2gsx06PFHAsHAwC9n3wCzIw1rnuh2c81DSZDGodh1 ExhJjriq9n6GYvOLC5DKbkmm1KV8m2TFHu7sJ0R0klcWD6kkGS45QD/WbRWTjoWgY2HU 9e3jXJ91H7vbFnvQ7lNbZ1cn+qWzwO6al4S7QZQAilm6qEHnu3oct+8rKMXhSWKaPofR HTXQ== MIME-Version: 1.0 Received: by 10.50.36.200 with SMTP id s8mr10065096igj.23.1355767739844; Mon, 17 Dec 2012 10:08:59 -0800 (PST) Received: by 10.50.1.44 with HTTP; Mon, 17 Dec 2012 10:08:59 -0800 (PST) In-Reply-To: References: Date: Mon, 17 Dec 2012 13:08:59 -0500 Message-ID: Subject: Re: [Whitelabeling] Quick assessment of (current) whitelabelling implementation . From: Olemis Lang To: bloodhound-dev@incubator.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On 12/17/12, Peter Ko=C5=BEelj wrote: > On 13 December 2012 22:45, Olemis Lang wrote: > >> Subjects to be discussed (IRC summary) >> >> 1. whethet it's better to use c =3D self.env.config ; >> application_short =3D c.get('labels', 'application_short', "Bloodhound") >> ; ... instead of trac.config.options >> > > I have evaluated the config.options and as elegant as that is, there is n= o > way to specify defaults that way. No defaults ? Since the very first time I used Trac I noticed this {{{ #!py class Option(object): """Descriptor for configuration options.""" [...] def __init__(self, section, name, default=3DNone, doc=3D'', doc_domain=3D'tracini'): """Create the configuration option. @param section: the name of the configuration section this option belongs to @param name: the name of the option @param default: the default value for the option @param doc: documentation of the option """ }}} Notice {{{default}}} argument. Isn't it just enough ? Am I missing somethin= g ? > That would mean that we would have to > change trac.ini during upgrade of older installations and is not as robus= t > agains users mistakes when changing the config file manually. > If my comment above is accurate : no need to do nothing of this . This is happening every day , every where in Trac Maybe I didn't understand the initial statement about option defaults . CMI= IW >> 2. on the subject of where to put labels data maybe it should be >> made available in request callbacks (just like req.chrome works at the >> moment ;) >> > > BH uses it's own templates from bloodhound_them together with original Tr= ac > request handlers. Current approach works for this combination without a > need to change Trac codebase. > Believe me , I know ... and this has nothing to do with my suggestion . I never even thought of patching Trac in any way . So , please re-read my suggestion above and review in detail request chrome and callbacks purpose and lifecycle . > But we could move the labels dict from request.chrome to data inside > BloodhoundTheme.post_process_request(): > No . > data['labels'] =3D self._get_whitelabelling() > if that is considered as a more appropriate solution. > data is not always a dictionary ... and you might be overwriting real data provided by a real request handler . > >> 3. there's another observation and it is to instantiate req. chrome >> inside theme's post_process_request post only if >> * bloodhound theme is enabled and active >> * request handler actually needs it ... e.g. chrome should be >> useless most of the time for /rpc requests and alike . >> That's exactly why instantiation is lazy in first place . >> >> > Sounds sensible but isn't "chrome" a Trac thingy? well , indeed ... 90% is a Trac thing ;) > AFAICT it is already > there when request lifecycle methods form BloodhoundTheme are called. yes and no ... it's lazy =3D> instantiated on demand . > Does > moving labels from "chrome" to "data" help here in any way? > Please review the implementation of trac.web.chrome.Chrome.dispatch method and request callbacks . Using data may lead to clashes with other active request handlers --=20 Regards, Olemis. Blog ES: http://simelo-es.blogspot.com/ Blog EN: http://simelo-en.blogspot.com/ Featured article: