2018-02-09 05:54:42 -06:00
|
|
|
##########################################################################
|
|
|
|
#
|
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
|
|
|
#
|
|
|
|
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
|
|
|
# This software is released under the PostgreSQL Licence
|
|
|
|
#
|
|
|
|
##########################################################################
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
2018-02-26 07:54:58 -06:00
|
|
|
def compile_template_name(
|
|
|
|
template_prefix, template_file_name, server_type, version):
|
2018-03-13 11:45:14 -05:00
|
|
|
|
|
|
|
# Template path concatenation should be same as
|
|
|
|
# Ref: ../pgadmin4/web/pgadmin/utils/versioned_template_loader.py +54
|
|
|
|
# to avoid path mismatch in windows
|
|
|
|
return compile_template_path(template_prefix, server_type, version) + \
|
|
|
|
'/' + template_file_name
|
2018-02-19 04:40:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
def compile_template_path(template_prefix, server_type, version):
|
2018-02-09 05:54:42 -06:00
|
|
|
if server_type == 'gpdb':
|
|
|
|
version_path = '#{0}#{1}#'.format(server_type, version)
|
|
|
|
else:
|
|
|
|
version_path = '#{0}#'.format(version)
|
2018-03-13 11:45:14 -05:00
|
|
|
|
|
|
|
# Template path concatenation should be same as
|
|
|
|
# Ref: ../pgadmin4/web/pgadmin/utils/versioned_template_loader.py +54
|
|
|
|
# to avoid path mismatch in windows
|
|
|
|
return template_prefix + '/' + version_path
|