_update: remove unused agent param

This commit is contained in:
Thomas Waldmann 2013-12-15 18:12:10 +01:00
parent 758a38f95e
commit 807fcaca5a

View File

@ -219,7 +219,7 @@ class NicUpdateView(View):
if ipaddr is None: if ipaddr is None:
ipaddr = request.META.get('REMOTE_ADDR') ipaddr = request.META.get('REMOTE_ADDR')
ssl = request.is_secure() ssl = request.is_secure()
return _update(host, hostname, ipaddr, agent, ssl, logger=logger) return _update(host, hostname, ipaddr, ssl, logger=logger)
class AuthorizedNicUpdateView(View): class AuthorizedNicUpdateView(View):
@ -249,22 +249,22 @@ class AuthorizedNicUpdateView(View):
logger.warning('%s - is not owned by user: %s' % (hostname, request.user.username, )) logger.warning('%s - is not owned by user: %s' % (hostname, request.user.username, ))
return Response('nohost') return Response('nohost')
logger.info("authenticated by session as user %s, creator of host %s" % (request.user.username, hostname)) logger.info("authenticated by session as user %s, creator of host %s" % (request.user.username, hostname))
# note: we do not check the user agent here as this is interactive
# and logged-in usage - thus misbehaved user agents are no problem.
ipaddr = request.GET.get('myip') ipaddr = request.GET.get('myip')
if not ipaddr: # None or empty string if not ipaddr: # None or empty string
ipaddr = request.META.get('REMOTE_ADDR') ipaddr = request.META.get('REMOTE_ADDR')
ssl = request.is_secure() ssl = request.is_secure()
agent = request.META.get('HTTP_USER_AGENT', 'unknown') return _update(host, hostname, ipaddr, ssl, logger=logger)
return _update(host, hostname, ipaddr, agent, ssl, logger=logger)
def _update(host, hostname, ipaddr, agent='unknown', ssl=False, logger=None): def _update(host, hostname, ipaddr, ssl=False, logger=None):
""" """
common code shared by the 2 update views common code shared by the 2 update views
:param host: host object :param host: host object
:param hostname: hostname (fqdn) :param hostname: hostname (fqdn)
:param ipaddr: new ip addr (v4 or v6) :param ipaddr: new ip addr (v4 or v6)
:param agent: remote's user agent string
:param ssl: True if we use SSL/https :param ssl: True if we use SSL/https
:param logger: a logger object :param logger: a logger object
:return: Response object with dyndns2 response :return: Response object with dyndns2 response