Example #1
0
 def _get_key(self, path):
     if self._prefix.split('/')[-1] == path:
         try:
             self._client.head_object(Bucket=self._bucket, Key=self._prefix)
         except ClientError as e:
             if e.response['Error']['Code'] == "404":
                 return posix_join(self._prefix, path)
             raise
         return self._prefix
     return posix_join(self._prefix, path) if path else self._prefix
    def _set_package_url(self, runner):
        if self.get('package_url'):
            return

        agent_package_name = None

        if self.is_windows:
            # No distribution difference in windows installation
            agent_package_name = 'cloudify-windows-agent.exe'
        else:
            self._set_agent_distro(runner)
            self._set_agent_distro_codename(runner)

            if 'distro' in self and 'distro_codename' in self:
                agent_package_name = '{0}-{1}-agent.tar.gz'.format(
                    self['distro'], self['distro_codename']
                )

        if agent_package_name:
            file_server_url = agent_utils.get_manager_file_server_url(
                self['rest_host'], self['rest_port']
            )
            self['package_url'] = posix_join(
                file_server_url, 'packages', 'agents', agent_package_name
            )
Example #3
0
    def _set_package_url(self, runner):
        if self.get('package_url'):
            return

        agent_package_name = None

        if self.is_windows:
            # No distribution difference in windows installation
            agent_package_name = 'cloudify-windows-agent.exe'
        else:
            self._set_agent_distro(runner)
            self._set_agent_distro_codename(runner)

            if 'distro' in self and 'distro_codename' in self:
                agent_package_name = '{0}-{1}-agent.tar.gz'.format(
                    self['distro'], self['distro_codename']
                )

        if agent_package_name:
            file_server_url = agent_utils.get_manager_file_server_url(
                self['rest_host'], self['rest_port']
            )
            self['package_url'] = posix_join(
                file_server_url, 'packages', 'agents', agent_package_name
            )
 def test_download_attachments(self):
     real_file = os.path.join(CUR_DIR, 'content/article.rst')
     good_url = path_to_file_url(real_file)
     bad_url = 'http://localhost:1/not_a_file.txt'
     silent_da = mute()(download_attachments)
     with temporary_folder() as temp:
         locations = list(silent_da(temp, [good_url, bad_url]))
         self.assertEqual(1, len(locations))
         directory = locations[0]
         self.assertTrue(
             directory.endswith(posix_join('content', 'article.rst')),
             directory)
Example #5
0
    def setUp(self):
        super(TestStatic, self).setUp()
        self.settings = get_settings(
            STATIC_SAVE_AS='{path}',
            STATIC_URL='{path}',
            PAGE_SAVE_AS=os.path.join('outpages', '{slug}.html'),
            PAGE_URL='outpages/{slug}.html')
        self.context = self.settings.copy()

        self.static = Static(content=None, metadata={}, settings=self.settings,
                             source_path=posix_join('dir', 'foo.jpg'),
                             context=self.context)

        self.context['filenames'] = {self.static.source_path: self.static}
Example #6
0
    def setUp(self):
        super().setUp()
        self.settings = get_settings(
            STATIC_SAVE_AS='{path}',
            STATIC_URL='{path}',
            PAGE_SAVE_AS=os.path.join('outpages', '{slug}.html'),
            PAGE_URL='outpages/{slug}.html')
        self.context = get_context(self.settings)

        self.static = Static(content=None, metadata={}, settings=self.settings,
                             source_path=posix_join('dir', 'foo.jpg'),
                             context=self.context)

        self.context['static_content'][self.static.source_path] = self.static
Example #7
0
    def _set_package_url(self, runner):
        if self.get('package_url'):
            return

        agent_package_name = None

        if self.is_windows:
            # No distribution difference in windows installation
            agent_package_name = 'cloudify-windows-agent.exe'
        else:
            self._set_agent_distro(runner)
            self._set_agent_distro_codename(runner)

            if self.get('distro') and self.get('distro_codename'):
                agent_package_name = '{0}-{1}-agent.tar.gz'.format(
                    self['distro'], self['distro_codename']
                )

        if agent_package_name:

            self['package_url'] = posix_join(
                self['file_server_url'], 'packages', 'agents',
                agent_package_name
            )
Example #8
0
 'THEME':
 DEFAULT_THEME,
 'OUTPUT_PATH':
 'output',
 'READERS': {},
 'STATIC_PATHS': ['images'],
 'STATIC_EXCLUDES': [],
 'STATIC_EXCLUDE_SOURCES':
 True,
 'THEME_STATIC_DIR':
 'theme',
 'THEME_STATIC_PATHS': [
     'static',
 ],
 'FEED_ALL_ATOM':
 posix_join('feeds', 'all.atom.xml'),
 'CATEGORY_FEED_ATOM':
 posix_join('feeds', '{slug}.atom.xml'),
 'AUTHOR_FEED_ATOM':
 posix_join('feeds', '{slug}.atom.xml'),
 'AUTHOR_FEED_RSS':
 posix_join('feeds', '{slug}.rss.xml'),
 'TRANSLATION_FEED_ATOM':
 posix_join('feeds', 'all-{lang}.atom.xml'),
 'FEED_MAX_ITEMS':
 '',
 'RSS_FEED_SUMMARY_ONLY':
 True,
 'SITEURL':
 '',
 'SITENAME':
Example #9
0
 def url(self, path):
     return posix_join(self.urlbase, str(self.bankid), path)
Example #10
0
                             'themes', 'notmyidea')
DEFAULT_CONFIG = {
    'PATH': os.curdir,
    'ARTICLE_PATHS': [''],
    'ARTICLE_EXCLUDES': [],
    'PAGE_PATHS': ['pages'],
    'PAGE_EXCLUDES': [],
    'THEME': DEFAULT_THEME,
    'OUTPUT_PATH': 'output',
    'READERS': {},
    'STATIC_PATHS': ['images'],
    'STATIC_EXCLUDES': [],
    'STATIC_EXCLUDE_SOURCES': True,
    'THEME_STATIC_DIR': 'theme',
    'THEME_STATIC_PATHS': ['static', ],
    'FEED_ALL_ATOM': posix_join('feeds', 'all.atom.xml'),
    'CATEGORY_FEED_ATOM': posix_join('feeds', '%s.atom.xml'),
    'AUTHOR_FEED_ATOM': posix_join('feeds', '%s.atom.xml'),
    'AUTHOR_FEED_RSS': posix_join('feeds', '%s.rss.xml'),
    'TRANSLATION_FEED_ATOM': posix_join('feeds', 'all-%s.atom.xml'),
    'FEED_MAX_ITEMS': '',
    'SITEURL': '',
    'SITENAME': 'A Pelican Blog',
    'DISPLAY_PAGES_ON_MENU': True,
    'DISPLAY_CATEGORIES_ON_MENU': True,
    'DOCUTILS_SETTINGS': {},
    'OUTPUT_SOURCES': False,
    'OUTPUT_SOURCES_EXTENSION': '.text',
    'USE_FOLDER_AS_CATEGORY': True,
    'DEFAULT_CATEGORY': 'misc',
    'WITH_FUTURE_DATES': True,
Example #11
0
                             'themes', 'notmyidea')
DEFAULT_CONFIG = {
    'PATH': os.curdir,
    'ARTICLE_PATHS': [''],
    'ARTICLE_EXCLUDES': [],
    'PAGE_PATHS': ['pages'],
    'PAGE_EXCLUDES': [],
    'THEME': DEFAULT_THEME,
    'OUTPUT_PATH': 'output',
    'READERS': {},
    'STATIC_PATHS': ['images'],
    'STATIC_EXCLUDES': [],
    'STATIC_EXCLUDE_SOURCES': True,
    'THEME_STATIC_DIR': 'theme',
    'THEME_STATIC_PATHS': ['static', ],
    'FEED_ALL_ATOM': posix_join('feeds', 'all.atom.xml'),
    'CATEGORY_FEED_ATOM': posix_join('feeds', '%s.atom.xml'),
    'AUTHOR_FEED_ATOM': posix_join('feeds', '%s.atom.xml'),
    'AUTHOR_FEED_RSS': posix_join('feeds', '%s.rss.xml'),
    'TRANSLATION_FEED_ATOM': posix_join('feeds', 'all-%s.atom.xml'),
    'FEED_MAX_ITEMS': '',
    'SITEURL': '',
    'SITENAME': 'A Pelican Blog',
    'DISPLAY_PAGES_ON_MENU': True,
    'DISPLAY_CATEGORIES_ON_MENU': True,
    'DOCUTILS_SETTINGS': {},
    'OUTPUT_SOURCES': False,
    'OUTPUT_SOURCES_EXTENSION': '.text',
    'USE_FOLDER_AS_CATEGORY': True,
    'DEFAULT_CATEGORY': 'misc',
    'WITH_FUTURE_DATES': True,
Example #12
0
DEFAULT_THEME = os.path.join(os.path.dirname(os.path.abspath(__file__)), "themes", "notmyidea")
DEFAULT_CONFIG = {
    "PATH": os.curdir,
    "ARTICLE_PATHS": [""],
    "ARTICLE_EXCLUDES": [],
    "PAGE_PATHS": ["pages"],
    "PAGE_EXCLUDES": [],
    "THEME": DEFAULT_THEME,
    "OUTPUT_PATH": "output",
    "READERS": {},
    "STATIC_PATHS": ["images"],
    "STATIC_EXCLUDES": [],
    "STATIC_EXCLUDE_SOURCES": True,
    "THEME_STATIC_DIR": "theme",
    "THEME_STATIC_PATHS": ["static"],
    "FEED_ALL_ATOM": posix_join("feeds", "all.atom.xml"),
    "CATEGORY_FEED_ATOM": posix_join("feeds", "%s.atom.xml"),
    "AUTHOR_FEED_ATOM": posix_join("feeds", "%s.atom.xml"),
    "AUTHOR_FEED_RSS": posix_join("feeds", "%s.rss.xml"),
    "TRANSLATION_FEED_ATOM": posix_join("feeds", "all-%s.atom.xml"),
    "FEED_MAX_ITEMS": "",
    "RSS_FEED_SUMMARY_ONLY": True,
    "SITEURL": "",
    "SITENAME": "A Pelican Blog",
    "DISPLAY_PAGES_ON_MENU": True,
    "DISPLAY_CATEGORIES_ON_MENU": True,
    "DOCUTILS_SETTINGS": {},
    "OUTPUT_SOURCES": False,
    "OUTPUT_SOURCES_EXTENSION": ".text",
    "USE_FOLDER_AS_CATEGORY": True,
    "DEFAULT_CATEGORY": "misc",
Example #13
0
 def create_api_url(self, *args):
     args = filter(None, map(lambda s: str(s).strip('/'), args))
     return posix_join(self.api_baseurl, *args)
Example #14
0
# Django settings for djtest project.
import os
from posixpath import join as posix_join


def rel(*x):
    return os.path.normpath(os.path.join(os.path.abspath(os.path.dirname(__file__)), *x))


PROJ_ROOT = os.path.dirname(os.path.realpath(__file__))

if os.sep == "\\":
    PROJ_ROOT = PROJ_ROOT.replace("\\", "/")

STATIC_DOC_ROOT = posix_join(PROJ_ROOT, "static_media")

DEBUG = True
TEMPLATE_DEBUG = DEBUG

ADMINS = (
    # ('Your Name', '*****@*****.**'),
)

MANAGERS = ADMINS

DATABASE_ENGINE = "sqlite3"  # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = rel("..", "..", "deploy.sqlite3")  # Or path to database file if using sqlite3.
# DATABASE_NAME = '../deploy.sqlite3'             # Or path to database file if using sqlite3.
DATABASE_USER = ""  # Not used with sqlite3.
DATABASE_PASSWORD = ""  # Not used with sqlite3.
DATABASE_HOST = ""  # Set to empty string for localhost. Not used with sqlite3.