Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1evbbx-0007rb-U0 for pgadmin-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 04:32:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1evbbw-0000rE-Js for pgadmin-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 04:32:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1evbbw-0000r2-Dz for pgadmin-hackers@lists.postgresql.org; Tue, 13 Mar 2018 04:32:28 +0000 Received: from mail-ot0-x230.google.com ([2607:f8b0:4003:c0f::230]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1evbbs-0001Ny-Ku for pgadmin-hackers@postgresql.org; Tue, 13 Mar 2018 04:32:27 +0000 Received: by mail-ot0-x230.google.com with SMTP id l5so17625503otf.9 for ; Mon, 12 Mar 2018 21:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=z3O+dNSxqqant16A/tSqAVnhg+Xh+dheJelEZMEPj1g=; b=likS7xGS1oTVdZPZ1gUZkdZAQFXKmQkKhbjmFdzyEhpuSuOqUd+s5LZtMSU+0Gjxdy QyWKv12T0/90bT+KvhVxAfXCLpwontL400490VrannxjZW1z7BySTZrF2T7t1lvymzBR LUQiBQnsP3+0nVDrYvZSNYxbNlPXhwEqV/7Duw/tLOt1qakQM0fj3CwwrH5VM9+YmhHq FyCDp7Csi933pYqe9hZD4ZM7dDH2yasAUo+LN2vfCS1TVU/Lj9tw1EKck/pBTBj/ZT+5 x6TXT9VS4IQoj54cnyBhw5sqLUdZUf9iYGb3e5+qa/CHYi2lQBNkAGN60Iridnv3fIbK W/aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=z3O+dNSxqqant16A/tSqAVnhg+Xh+dheJelEZMEPj1g=; b=l1y/7eQ4sndjBfTCAXjL2GtLmQV295JQrgL1WV/tt3L3Vwr06IO5dEoWdwMGPPa/pQ a512jDjSVqVuH09HUot906N2SB3ROhm5texC1hJnC+X8IGW37NNo7ydCZ7xQ4h/fO9Gc 2E1xFUJhTJA5ybLI2lScvA9NgwuYThJWU6AqDMuCbg6gQgmOcGW8aMUnWR6fHuJasbec 6xxAY+Ocux1UnyGo10fytmANu9ByPqj6uXAwQ2zdCLvOGlsU7lLZoXF3ghXuYqxxALcr ntlML5fS5Uo6tZu6Ri66oEYuTtJqo1zAYXe67OoR9jmkpVZGvRtPyJCv96ks6VIbVtBf FMUQ== X-Gm-Message-State: AElRT7EJFigPbfuwCw3KifAZTBN7urCuIFIo60Dq8hm2kGtosH3YUhuy xyQtedSTPqVRZ6bEfDX3hYhlwljynPRZuh2ILpaknQ== X-Google-Smtp-Source: AG47ELtygjMT9QwWz9awGkYSAHjjn7JIsE3zps+tuntuJgYHWW3ZUPncBstoe8984Y+azdlCxnYxCBItJ8B8MZQFdsE= X-Received: by 10.157.58.53 with SMTP id j50mr6750523otc.157.1520915542054; Mon, 12 Mar 2018 21:32:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.8.150 with HTTP; Mon, 12 Mar 2018 21:32:01 -0700 (PDT) In-Reply-To: References: From: Murtuza Zabuawala Date: Tue, 13 Mar 2018 10:02:01 +0530 Message-ID: Subject: Re: [pgAdmin4][RM#3139] Create proper template path if Windows To: Dave Page Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="001a114719109e3543056743be59" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --001a114719109e3543056743be59 Content-Type: text/plain; charset="UTF-8" Hi Dave, We are not joining template path with os.path.join because we are passing prefix paths in render_template(..) at many places, we are passing them as below, Some of examples, render_template( "exclusion_constraint/js/exclusion_constraint.js", _=_ ), recovery_check_sql = render_template( "connect/sql/#{0}#/check_recovery.sql".format(postgres_version)) sql = render_template( "/servers/sql/#{0}#/stats.sql".format(manager.version), conn=conn, _=gettext ) sql = render_template( "/".join([self.template_path, 'create.sql']), data=data, conn=self.conn ) def csssnippets(self): """ Returns a snippet of css to include in the page """ snippets = [render_template("css/servers.css")] So again it will conflict if use os.path.join, To make it consistent with render_template(...) and VersionedTemplateLoader(..) class we opt'd for this mechanism. -- Regards, Murtuza Zabuawala EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company On Tue, Mar 13, 2018 at 6:11 AM, Dave Page wrote: > Hi > > On Mon, Mar 12, 2018 at 10:15 AM, Murtuza Zabuawala enterprisedb.com> wrote: > >> Hi, >> >> PFA patch to correct the template path generation logic incase of Windows >> system. >> > > Seems like it would be better to fix it the other way round to me - e.g. > update the template loader to use os.path.join. > > Any reason not to do that? > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > --001a114719109e3543056743be59 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Dave,

We are not joining template path with os.path.join because we ar= e passing prefix paths in render_template(..) at many places,
we are passing them as below,

Some of examples,

render_template(
<= font color=3D"#444444" style=3D"background-color:rgb(238,238,238)" face=3D"= arial, helvetica, sans-serif">=C2=A0 =C2=A0 "exclusion_constraint/js/<= wbr>exclusion_constraint.js",
=C2=A0 =C2=A0 _=3D_
),

recovery_check_sql =3D= render_template(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 "connect/sql/#{0}#/check_recovery.sql".format(postgres_version))

sql =3D render_template= (
= =C2=A0 =C2=A0 "/servers/sql/#{0}#/stats.sql".format(manager.= version),
=C2=A0 =C2=A0 conn=3Dconn, _=3Dgettext
)

sql =3D render_template(=
=C2=A0 = =C2=A0 "/".join([self.template_path, 'create.sql']),
=C2=A0 = =C2=A0 data=3Ddata, conn=3Dself.conn
)

def csssnippets(self):
=C2=A0 =C2=A0 "= ;""
=C2=A0 =C2=A0 Returns a snippet of css to include in the page
=C2= =A0 =C2=A0 """
=C2=A0 =C2=A0 snippets =3D [render_template(&quo= t;css/servers.css")]


=
So again it will conflict if use os.path.join, To make= it consistent with render_template(...) and=C2=A0VersionedTemplateLoader(.= .) class we opt'd for this mechanism.


=
--
Regards,
Murtuza Zabuawala
EnterpriseDB:=C2=A0h= ttp://www.enterprisedb.com
The Enterprise PostgreSQL Company
<= /font>


On Tue, Mar 13, 2018 at 6:11 AM, Dave Page <= span dir=3D"ltr"><dpage@pgadmin.org> wrote:
=
Hi

On Mon, Mar 12, 2018 at 10:15 AM, Murtuza Zabuawala <= ;mu= rtuza.zabuawala@enterprisedb.com> wrote:
Hi,

PFA patch to correct the template path generation logic incase of= Windows system.

Seems like it = would be better to fix it the other way round to me - e.g. update the templ= ate loader to use os.path.join.

Any reason not to = do that?=C2=A0

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitte= r: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise Postgr= eSQL Company

--001a114719109e3543056743be59--