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 289C19DD8 for ; Thu, 14 Jun 2012 05:03:35 +0000 (UTC) Received: (qmail 14732 invoked by uid 500); 14 Jun 2012 05:03:35 -0000 Delivered-To: apmail-incubator-bloodhound-dev-archive@incubator.apache.org Received: (qmail 14691 invoked by uid 500); 14 Jun 2012 05:03:33 -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 14655 invoked by uid 99); 14 Jun 2012 05:03:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2012 05:03:32 +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 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-wg0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2012 05:03:28 +0000 Received: by wgbdr1 with SMTP id dr1so1252450wgb.0 for ; Wed, 13 Jun 2012 22:03:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=OSZxFUFc0zGK0wGLz7qM8D10yggbyFw6Sdy8XrW9LU4=; b=kwSL0CMQcy3lYKAAPD8d6Swx/zQF/wZoDNuW2vFL8cMxjSpPR0taYKSCLVTH0I3s8I qmMTB32MS7Twtv+4oxIEf48C1WsU4eS06NAKddBhMYY/fSdX+ypIW30R9YTUld/QKNfb e+fnJR38m5a972I5eIV6KMrix324eXNOw4WI8m/ECOLRG3enPtEFJBF9vnZ7Hh+VJnBU lAOEJuMNmGLHEMETEezCBjTZFIGGfwRtcjyaErG9ycmH7KfQ2b+4IWaSWT1GfwV7ijps IN6f5Wgl1ToPtDBQDst2Ss4897sGksJ92byFg700FCq/FzF3+bwm6jwN0tYE+VEtMPxD cd/A== MIME-Version: 1.0 Received: by 10.180.7.133 with SMTP id j5mr907213wia.14.1339650186200; Wed, 13 Jun 2012 22:03:06 -0700 (PDT) Received: by 10.223.101.139 with HTTP; Wed, 13 Jun 2012 22:03:06 -0700 (PDT) Date: Thu, 14 Jun 2012 00:03:06 -0500 Message-ID: Subject: [RFC] [multiproduct] Review #1 From: Olemis Lang To: bloodhound-dev Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi ! :) I've been reviewing the code in multiproduct plugin these days . I have some doubts | comments | ... I thought I'd share them with you . 1- I've noticed that function `multiproduct.common.match_product_path` is= not used anywhere else . What is it for ? a) After a while I found `multiproduct.ticket_web_ui.ProductTicketModule.match_request` method and I confirmed my intuition was correct. As far as I can say *NOW* (<=3D i.e. I can change my mind if there're strong arguments supporting that approach ;) that's something I do not recommend . `IRequestHandler.match_request` should decide quickly (<=3D and that means **really** quick) whether the handler will process the request or not. I even notice the execution of a SQL select statement . IMO that's far too much to belong in `match_request` method. Besides that approach may lead to collisions with paths matched by other plugins . That's the reason why I suggested in t.e.o site , and trac-dev ML to use ''/p/'' prefix similar to Google Code (which is short and simple) to reduce the scope of web request to the context of a particular product / project. Sample ticket URL would be e.g. http://server.com/path/to/bh/p/my_product/ticket/36 and (initially ;) may be matched using a simple regex like ` r'^/p/(?P[^/]+/ticket/(?P\d+)$)' `. 2- IMO import statements in `multiproduct.__init__` should be absolute i.= e. `from multiproduct.model import MultiProductEnvironmentProvider` instead of `from model import MultiProductEnvironmentProvider` 3- I wonder whether it'd be a good idea to a) ... populate `MultiProductEnvironmentProvider.SCHEMA` considering `SomeModel.__meta__` (e.g. `SomeModel` may be `Product` , `ProductResourceMap`, ...) b) ... make `MultiProductEnvironmentProvider` capable of discovering existing classes dynamically i.e. in such a way that it won't be necessary to update that class if new models are introduced . 4- Product table key is ['prefix', 'name'] . Why ? 5- It's cool to have models ! :) Is it a good idea to consider using ORMs like SqlAlchemy [1]_ (... or maybe other ...) ? 6- IMO we should add multi-product version to '''System Information''' table in ''About Trac'' page (i.e. http://server.com/path/to/bh/about = ) 7- I also suggest the following changes in files (relative to ''multiproduct'' folder) : || Current file path || Suggestions || ||-------------------||--------------------------------|| || product_admin.py || admin/product.py , admin.py || || ticket_web_ui.py || web_ui/ticket.py || || web_ui.py || web_ui/__init__.py || || || api.py || ... and the following simple refactorings to move classes and change their names : || From || To || ||---------------------------------------||---------------------------= -------------|| || model.MultiProductEnvironmentProvider || api.MultiProductSystem || || ticket_web_ui.ProductTicketModule || web_ui.ticket.MultiProductTicketModule || 8- IMO `multiproduct.model.MultiProductEnvironmentProvider` should not implement `trac.web.api.ITemplateProvider` as it is not related wi= th request handling at all . It doesn't even make use of any ''Genshi'' template included in the plugin. Usually this is the kind of things defined in `web_ui` modules . 9- I suggest merging current `multiproduct.product_admin.ProductPermissio= ns` class with `multiproduct.model.MultiProductEnvironmentProvider` (... o= r `multiproduct.api.MultiProductSystem` especially if =A77 is ok ;). 10- There's a lot of great stuff in multi product plugin . IMO it deserves some test cases , so we should have a ticket for that scheduled for RC1 ... or some other milestone ... that's something we should decide ;) PS: I could not finished ... so maybe there's a second message on this subject ;) .. [1] Trac SQLAlchemy Bridge (http://trac-hacks.org/wiki/TracSqlAlchemyBridgeIntegration) --=20 Regards, Olemis.