--- /dev/null
+# Copyright (C) 2018 The Meme Factory, Inc. http://www.meme.com/
+
+# This file is part of PGWUI_Common.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+# Karl O. Pinc <kop@meme.com>
+
+'''Path library for PGWUI
+'''
+from pyramid.path import AssetResolver
+
+
+def asset_abspath(asset):
+ '''Return the absolute path of a pyramid asset
+ '''
+ asset_resolver = AssetResolver(None)
+ return asset_resolver.resolve(asset).abspath()
</%doc>
<%!
- from pyramid.path import AssetResolver
+ from pgwui_common.path import asset_abspath
- asset_resolver = AssetResolver(None)
- base_mak = (asset_resolver.resolve('pgwui_common:templates/base.mak')
- .abspath())
+ base_mak = asset_abspath('pgwui_common:templates/base.mak')
%>
<%inherit file="${base_mak}" />
--- /dev/null
+# Copyright (C) 2018 The Meme Factory, Inc. http://www.meme.com/
+
+# This file is part of PGWUI_Common.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Affero General Public License
+# as published by the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public
+# License along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+#
+
+# Karl O. Pinc <kop@meme.com>
+
+from pyramid.path import AssetResolver
+
+import pgwui_common.path
+
+
+# Integration tests
+
+# asset_abspath()
+
+def test_asset_abspath():
+ '''Returns what pyramid's asset resolver returns'''
+ asset_resolver = AssetResolver(None)
+ asset = 'pgwui_common:templates/base.mk'
+ answer = asset_resolver.resolve(asset).abspath()
+ result = pgwui_common.path.asset_abspath(asset)
+ assert result == answer