Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish documents with resources #5

Merged
merged 1 commit into from
Apr 24, 2014
Merged

Conversation

karenc
Copy link
Contributor

@karenc karenc commented Apr 22, 2014

This is mostly code taken from the publish branch in cnx-archive.

document = cnxepub.Document(id, content, metadata)
for ref in document.references:
if ref.uri.startswith('/resources/'):
hash = ref.uri.strip('/resources/')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope: strip takes a set of characters, and 'resources' includes characters that are allowed in the resource id:

uri='/resources/00645b805671fb9e77d5e533f4a4c9be'
uri.strip('/resources/')
'00645b805671fb9e77d5e533f4a4c9b'

note the missing 'e':

one option:

uri[len('/resources/'):]
'00645b805671fb9e77d5e533f4a4c9be'
(since we just determined it starts w/ /resources/ )
or even:
uri[11:] # 11 == len('/resources/')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

mmulich added a commit that referenced this pull request Apr 24, 2014
@mmulich mmulich merged commit c9a3d4a into master Apr 24, 2014
@mmulich mmulich deleted the publish-with-resources branch April 24, 2014 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants