Skip to content

Commit

Permalink
NameObject str __init__, .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
switham committed Apr 22, 2014
1 parent 55e8169 commit 8a0f996
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.pyc
*.swp
.DS_Store
7 changes: 5 additions & 2 deletions PyPDF2/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,13 @@ def writeToStream(self, stream, encryption_key):


class NameObject(str, PdfObject):
delimiterCharacters = b_("("), b_(")"), b_("<"), b_(">"), b_("["), b_("]"), b_("{"), b_("}"), b_("/"), b_("%")
delimiterCharacters = tuple(b_(c) for c in "()<>[]{}/%")

# Because of how subclassing str works, x = NameObject("sometext") sets the
# str value before __init__ is called. An __init__ method isn't needed.
# This __init__ is here to add to if more initialization becomes necessary.
def __init__(self, data):
str.__init__(super(NameObject, self).__new__(str, data))
pass

def writeToStream(self, stream, encryption_key):
stream.write(b_(self))
Expand Down

0 comments on commit 8a0f996

Please sign in to comment.