[PATCH PoC] hacks: the concept of python files that will be loaded and can monkeypatch Kallithea internals

Mads Kiilerich mads at kiilerich.com
Tue Apr 21 10:38:22 EDT 2015


On 04/21/2015 10:18 AM, Thomas De Schampheleire wrote:
> On Tue, Apr 21, 2015 at 3:05 PM, Mads Kiilerich <mads at kiilerich.com> wrote:
>> On 04/21/2015 06:34 AM, Thomas De Schampheleire wrote:
>>>
>>>> +import imp
>>>>    import logging
>>>>    import kallithea
>>>>    import platform
>>>> @@ -43,12 +45,25 @@ from kallithea.model.scm import ScmModel
>>>>    log = logging.getLogger(__name__)
>>>>
>>>>
>>>> +def load_hacks():
>>>> +    """
>>>> +    Load hacks - python files dropped in kallithea/hacks that will
>>>> monkeypatch
>>>> +    Kallithea internals
>>>> +    """
>>>> +    hacksdir = os.path.dirname(__file__) + '/../hacks'
>>> This should better be
>>>
>>> hacksdir = os.path.join(os.path.dirname(__file__), os.pardir, 'hacks')
>>
>> More verbose, yes, but will it really be better? It is less readable to me.
>>
> This is supposed to be more cross-platform. For example, will the
> forward slashes work on Windows?

In general: Yes.

/Mads


More information about the kallithea-general mailing list