Browse Source

renamed Network_Manager to simply NetworkManager, since we expect all the networks to use it, so it will be easier to type

master
Julio Biason 15 years ago
parent
commit
960a4df215
  1. 12
      mitterlib/network/__init__.py
  2. 2
      mitterlib/network/twitter.py
  3. 2
      mitterlib/ui/ui_pygtk.py

12
mitterlib/network/__init__.py

@ -42,8 +42,8 @@ have the following options:
case the next network causes Mitter to crash or something related.) A value case the next network causes Mitter to crash or something related.) A value
of 0 means the Network Manager will save the config file after each round of of 0 means the Network Manager will save the config file after each round of
requests to all networks (failing or succeding); for devices that use flash requests to all networks (failing or succeding); for devices that use flash
drives as storage, it's recommended some large value (since those devices drives as storage, it's recommended some large value (since those storage
have a defined number of writes as lifetime.) Default is '5'. devices have a lifetime based on the number of writes.) Default is '5'.
""" """
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -140,7 +140,7 @@ class Networks(object):
def _save(self): def _save(self):
"""Check the number of operations and, if it above the minimum value, """Check the number of operations and, if it above the minimum value,
save the config file.""" save the config file."""
max_count = self._options['Network_Manager']['save_count'] max_count = self._options['NetworkManager']['save_count']
_log.debug('Operations %d, max %d', self._operations, max_count) _log.debug('Operations %d, max %d', self._operations, max_count)
if self._operations > max_count: if self._operations > max_count:
self._options.save() self._options.save()
@ -167,17 +167,17 @@ class Networks(object):
conn.options(self._options) conn.options(self._options)
# add Networks own options # add Networks own options
self._options.add_group('Network_Manager', 'Network Manager') self._options.add_group('NetworkManager', 'Network Manager')
self._options.add_option( self._options.add_option(
'--timeout', '--timeout',
group='Network_Manager', group='NetworkManager',
option='timeout', option='timeout',
help='Timeout for requests in all networks.', help='Timeout for requests in all networks.',
type='int', type='int',
metavar='SECONDS', metavar='SECONDS',
default=120) default=120)
self._options.add_option( self._options.add_option(
group='Network_Manager', group='NetworkManager',
option='save_count', option='save_count',
help='Number of network operations till the config file ' \ help='Number of network operations till the config file ' \
'is saved', 'is saved',

2
mitterlib/network/twitter.py

@ -252,7 +252,7 @@ class Connection(NetworkBase):
_log.debug('Body: %s' % (body)) _log.debug('Body: %s' % (body))
request.add_data(body) request.add_data(body)
timeout = self._options['Network_Manager']['timeout'] timeout = self._options['NetworkManager']['timeout']
try: try:
_log.debug('Starting request of %s (timeout %d)' % (url, timeout)) _log.debug('Starting request of %s (timeout %d)' % (url, timeout))
response = urllib2.urlopen(request, timeout=timeout) response = urllib2.urlopen(request, timeout=timeout)

2
mitterlib/ui/ui_pygtk.py

@ -1274,7 +1274,7 @@ class Interface(object):
def _download_pic(self, url): def _download_pic(self, url):
"""Download a picture from the web. Can be used in a thread.""" """Download a picture from the web. Can be used in a thread."""
request = urllib2.Request(url=url) request = urllib2.Request(url=url)
timeout = self._options['Network_Manager']['timeout'] timeout = self._options['NetworkManager']['timeout']
_log.debug('Starting request of %s (timeout %d)' % (url, timeout)) _log.debug('Starting request of %s (timeout %d)' % (url, timeout))
response = urllib2.urlopen(request, timeout=timeout) response = urllib2.urlopen(request, timeout=timeout)
data = response.read() data = response.read()

Loading…
Cancel
Save