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 1evjO8-00081y-JH for pgadmin-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 12:50:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1evjO7-0004mE-IJ for pgadmin-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 12:50:43 +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 1evjO7-0004m3-Bk for pgadmin-hackers@lists.postgresql.org; Tue, 13 Mar 2018 12:50:43 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1evjO2-0003lC-Vy for pgadmin-hackers@postgresql.org; Tue, 13 Mar 2018 12:50:42 +0000 Received: by mail-wr0-x242.google.com with SMTP id k3so2911094wrg.6 for ; Tue, 13 Mar 2018 05:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Lt1yRMyErQNLQ+6MlBRB83+pRshUd5fDgMj/Z0veuSw=; b=UhJDMj3guwz1IYKR9v+/mIohFy2/05MoauGSK6UdYzwMjZCrL9m4RPy/Y9U5RyWzsY s44z5qpzQUGXoNTRFqrCYu5F4atQtaK/errZjiFeUm2YYB+rtobK+FZyZm1KQDI5Qh7b 0jWSSk0iZ4nM5iX4xy6Vzc1bGwK8pCHlvogJrLCgpsSt/EvrhJAXI0HkaTO3RxFtksNO LUh/VcYn62CWi9dZiyiCmjiwnaa8qvCxyoHrIhKSPmSSi6atCIbifEBYae0JrnpcKHwP /a4TNwrRkZhf7pCJGL5nWVF3BVUAB2bg/Nom06x2udLepOQHKPUTspEQiuwiGbVrZRLo o+5Q== 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=Lt1yRMyErQNLQ+6MlBRB83+pRshUd5fDgMj/Z0veuSw=; b=n/P4Hg7arFY/HMiLAFMiYAna/TIEp4uGuldYojp5mNvMF25+oWyslDZiTQFRrx1YeY 0a9Wz859pqdnJXPBMoTxPlMqFM1Oz8vQeLwCvsUApx2CK6qLqWGW2roErFRA1UItz6Oy NhO4IxGQZKZdxscPJgK8SFFflhJF5jp9sdaCcQlsN2scnVxblSyxwVJeSL+xMDmsS/We YNrk8CMNeQ3Tar76JxK62sT1wYc/5r8mpqhtlbRoZ2/gqyWMumO4uEaYzu75m9nqCgwz KaWSNRLGBaPrJw8t/HVMVlr2oLXS4Co8rZgS3SLQBbDiQBtgxBIOF86mP2/RY+sKRbQD 90lw== X-Gm-Message-State: AElRT7Fy9RDlPxsz8ry69aGIOE2oKNe67J05BE976A2alCZKvweIipuQ R795NwanaXrrb3HwfQSCZUkIDKEk4iw6Sn4jOjCTNLUW X-Google-Smtp-Source: AG47ELtgfskdJLivjFgbbK8flcudTPg/hKdbIiXNcM7zYEBMuQoieAWGbs6FloJtgU6/3JLI1YYXXiPbMYgOKTvc1+o= X-Received: by 10.28.5.75 with SMTP id 72mr710826wmf.154.1520945437314; Tue, 13 Mar 2018 05:50:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.109.7 with HTTP; Tue, 13 Mar 2018 05:50:36 -0700 (PDT) In-Reply-To: References: From: Dave Page Date: Tue, 13 Mar 2018 08:50:36 -0400 Message-ID: Subject: Re: [pgAdmin4][RM#3139] Create proper template path if Windows To: Murtuza Zabuawala Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="001a114429c883a9d605674ab49b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --001a114429c883a9d605674ab49b Content-Type: text/plain; charset="UTF-8" And... reverted. It seems this makes Jenkins very unhappy. On Tue, Mar 13, 2018 at 7:58 AM, Dave Page wrote: > OK, thanks. Patch applied. > > On Tue, Mar 13, 2018 at 12:32 AM, Murtuza Zabuawala enterprisedb.com> wrote: > >> 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 < >>> 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 >>> >> >> > > > -- > Dave Page > Blog: http://pgsnake.blogspot.com > Twitter: @pgsnake > > EnterpriseDB UK: http://www.enterprisedb.com > The Enterprise PostgreSQL Company > -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company --001a114429c883a9d605674ab49b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
And... reverted. It seems this makes Jenkins very unhappy.=

On Tue, Mar= 13, 2018 at 7:58 AM, Dave Page <dpage@pgadmin.org> wrote:
OK, thanks. Patch applied= .
<= br>
On Tue, Mar 13, 2018 at 12:32 AM, Murtuza Zab= uawala <murtuza.zabuawala@enterprisedb.com> wrote:
Hi Dave,

We are not joini= ng template path with os.path.join because we are passing prefix paths in r= ender_template(..) at many places,
we are passing them= as below,

Some of examples,

render_tem= plate(
=C2=A0 =C2=A0 "exclusion_constraint/js/exclusion_constraint.j= s",
=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=3Dc= onn, _=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("css/servers.css")]
=

So again it w= ill conflict if use os.path.join, To make it consistent with render_templat= e(...) and=C2=A0VersionedTemplateLoader(..) class we opt'd for thi= s mechanism.


=
--
Regards,
Murtuza Zabuawala
EnterpriseD= B:=C2=A0http://www.enterprisedb.com
The Enterprise PostgreS= QL Company


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
Twitter: @pgsnake

EnterpriseD= B UK: http://www.= enterprisedb.com
The Enterprise PostgreSQL Company



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

EnterpriseDB UK: http://www.enterprised= b.com
The Enterprise PostgreSQL Company
--001a114429c883a9d605674ab49b--