Update gntp-1.0.3

This commit is contained in:
JonnyWong16 2021-10-14 23:45:51 -07:00
parent 624ae06b35
commit e55576fd80
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
6 changed files with 15 additions and 26 deletions

View file

@ -1,20 +0,0 @@
Copyright (c) 2013 Paul Traylor
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -118,9 +118,9 @@ def main():
# This would likely be better placed within the growl notifier # This would likely be better placed within the growl notifier
# class but until I make _checkIcon smarter this is "easier" # class but until I make _checkIcon smarter this is "easier"
if options.icon is not None and not options.icon.startswith('http'): if options.icon and growl._checkIcon(options.icon) is False:
logging.info('Loading image %s', options.icon) logging.info('Loading image %s', options.icon)
f = open(options.icon) f = open(options.icon, 'rb')
options.icon = f.read() options.icon = f.read()
f.close() f.close()

View file

@ -74,8 +74,15 @@ class _GNTPBase(object):
self.headers = {} self.headers = {}
self.resources = {} self.resources = {}
def __str__(self): # For Python2 we can just return the bytes as is without worry
return self.encode() # but on Python3 we want to make sure we return the packet as
# a unicode string so that things like logging won't get confused
if gntp.shim.PY2:
def __str__(self):
return self.encode()
else:
def __str__(self):
return gntp.shim.u(self.encode())
def _parse_info(self, data): def _parse_info(self, data):
"""Parse the first line of a GNTP message to get security and other info values """Parse the first line of a GNTP message to get security and other info values

View file

@ -69,7 +69,8 @@ class GrowlNotifier(object):
then we return False then we return False
''' '''
logger.info('Checking icon') logger.info('Checking icon')
return gntp.shim.u(data).startswith('http')
return gntp.shim.u(data)[:4] in ['http', 'file']
def register(self): def register(self):
"""Send GNTP Registration """Send GNTP Registration

View file

@ -10,6 +10,7 @@ https://pypi.python.org/pypi/six
import sys import sys
PY2 = sys.version_info[0] == 2
PY3 = sys.version_info[0] == 3 PY3 = sys.version_info[0] == 3
if PY3: if PY3:

View file

@ -1,4 +1,4 @@
# Copyright: 2013 Paul Traylor # Copyright: 2013 Paul Traylor
# These sources are released under the terms of the MIT license: see LICENSE # These sources are released under the terms of the MIT license: see LICENSE
__version__ = '1.0.2' __version__ = '1.0.3'