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 1eviZU-0005Gi-3T for pgadmin-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 11:58:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eviZS-0005vM-Vu for pgadmin-hackers@arkaria.postgresql.org; Tue, 13 Mar 2018 11:58:22 +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 1eviZS-0005vC-Pk for pgadmin-hackers@lists.postgresql.org; Tue, 13 Mar 2018 11:58:22 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eviZO-0002Vl-VG for pgadmin-hackers@postgresql.org; Tue, 13 Mar 2018 11:58:22 +0000 Received: by mail-wr0-x244.google.com with SMTP id z12so21849572wrg.4 for ; Tue, 13 Mar 2018 04:58:18 -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=RL1i7gT/pqMWyE6/IeiCP3Q/VBlbQPkoELFD4uJ/a60=; b=Nwwo1zC0lGvg55erhGF5JMSn8Z6byWhyej8FK2fK+eVqUd/B3PH7mV7jssWXGLefUu H8r9pxXA041xqD4xyKiJm0SrLlG7COlvc3tVe6nDoV18k8FWTK+xY6MebaJMiJVGfEKm BJPxdbK0ukcNB41e6k7zsu68d0HjUQZJMWsx/sqxq8ifoZFOeVzPf8prxGCAb+SCWEz9 80gZeK5dOsjfth3aKRbe7xCLTgyY6rUEAqdEQ357Kf+Jj7EdH5zGrh7zVRWDoJ9uHrbi q0oQa1AkWs8VaeizIAoa2v7gx7MHoEJDF5eZ5xQIEGUp5+T51N+q/Rgy9gUPcAmBJ/wI TXng== 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=RL1i7gT/pqMWyE6/IeiCP3Q/VBlbQPkoELFD4uJ/a60=; b=XO1eAAAuzHcAi8epvKP8doSRYT5QTKVdjuTlrE9YKXtIQu3ips13qbeI96vBh4ydS8 z8gCVG2Q8+0sVhLZErNZTf20k8V+qBE5K+rQHbzF7r8cpvCfOXRPjb9G9ZZ3NWUsGHH3 CfLnGZvLGppYr65U7niS2WZZmhitALRu7LDs6QuT8MYk5y7LHPTJ/2hh/XbJ8BVPJ5aE ijQ48eTjMnx81QFZa+j9sDCb7mzl4VV+yoR/xFoZbKykANP3J9kFWgrQaSY5bCGK4fYr 0jJ6D6GPeA2UUzlWcC2LGEupSclwICXPSoK2ORoGpnBWcefC5Trkhhf34E4CIDMcHgcp kElA== X-Gm-Message-State: AElRT7HJtlVMII5e5btRFuCuYaPstWDEtJWojAFzdaryuaMlug0eCWWT YP6+rR5oxD8Y7rlDEHFTex2z7GSpuKVFSMJCUuDuyfUk X-Google-Smtp-Source: AG47ELto7slx27Ev96YTBpCToQRIn+l88zCQ1EI9cVQBZh1s018PlpkmwwwcgSM6yu2zTuN+VWZxAA6RykeI9c1wJQY= X-Received: by 10.28.167.151 with SMTP id q145mr581792wme.64.1520942297693; Tue, 13 Mar 2018 04:58:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.109.7 with HTTP; Tue, 13 Mar 2018 04:58:17 -0700 (PDT) In-Reply-To: References: From: Dave Page Date: Tue, 13 Mar 2018 07:58:17 -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="001a114b3cd460cbaa056749f907" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --001a114b3cd460cbaa056749f907 Content-Type: text/plain; charset="UTF-8" OK, thanks. Patch applied. On Tue, Mar 13, 2018 at 12:32 AM, Murtuza Zabuawala < 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 --001a114b3cd460cbaa056749f907 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
OK, thanks. Patch applied.

On Tue, Mar 13, 2018 at 12:32 AM, Murtuza Z= abuawala <murtuza.zabuawala@enterprisedb.com> wrote:
Hi Dave,

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

Some of examples,
=

render_templat= e(
=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/s= ql/#{0}#/stats.sql".format(manager.version),
=C2=A0 =C2=A0 conn=3Dco= nn, _=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
EnterpriseDB:=C2=A0http://www.= enterprisedb.com
The Enterprise PostgreSQL Company

<= /div>

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

EnterpriseDB= UK: http://www.e= nterprisedb.com
The Enterprise PostgreSQL Company




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

EnterpriseDB UK: http://www.enterprisedb.com<= br>The Enterprise PostgreSQL Company
--001a114b3cd460cbaa056749f907--