Skip to content

Commit

Permalink
Merge "Move api_samples to doc dir"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Sep 6, 2012
2 parents a68dfb7 + 6bc7055 commit a083325
Show file tree
Hide file tree
Showing 54 changed files with 14 additions and 3 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
17 changes: 14 additions & 3 deletions nova/tests/integrated/test_api_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def to_dict(node):
return to_dict(etree.fromstring(data))

@classmethod
def _get_sample(cls, name, suffix=''):
parts = [os.path.dirname(os.path.abspath(__file__))]
def _get_sample_path(cls, name, dirname, suffix=''):
parts = [dirname]
parts.append('api_samples')
if cls.all_extensions:
parts.append('all_extensions')
Expand All @@ -96,8 +96,19 @@ def _get_sample(cls, name, suffix=''):
parts.append(name + "." + cls.ctype + suffix)
return os.path.join(*parts)

@classmethod
def _get_sample(cls, name):
dirname = os.path.dirname(os.path.abspath(__file__))
dirname = os.path.join(dirname, "../../../doc")
return cls._get_sample_path(name, dirname)

@classmethod
def _get_template(cls, name):
dirname = os.path.dirname(os.path.abspath(__file__))
return cls._get_sample_path(name, dirname, suffix='.tpl')

def _read_template(self, name):
template = self._get_sample(name, suffix='.tpl')
template = self._get_template(name)
if self.generate_samples and not os.path.exists(template):
with open(template, 'w') as outf:
pass
Expand Down

0 comments on commit a083325

Please sign in to comment.