Skip to content

Commit 871a4b7

Browse files
author
Dulshani Gunawardhana
committed
Fixes 821: Add Tablet info to browser name
1 parent c7af669 commit 871a4b7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

webcompat/helpers.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,12 @@ def get_browser_name(user_agent_string):
106106
'''
107107
ua_dict = user_agent_parser.Parse(user_agent_string)
108108
name = ua_dict.get('user_agent').get('family').lower()
109+
device = ua_dict.get('device').get('model')
109110
if (name == 'firefox mobile' and
110111
ua_dict.get('os').get('family') == 'Firefox OS'):
111112
name = 'other'
113+
if device == 'Tablet':
114+
name += " " + device.lower()
112115
return name
113116

114117

@@ -128,7 +131,12 @@ def get_browser(user_agent_string):
128131
version = version + "." + ua.get('patch')
129132
else:
130133
version = ''
131-
return '{0} {1}'.format(name, version)
134+
# Check for tablet devices
135+
if ua_dict.get('device').get('model') == 'Tablet':
136+
model = '(Tablet)'
137+
else:
138+
model = ''
139+
return '{0} {1} {2}'.format(name, version, model)
132140

133141

134142
def get_os(user_agent_string):

0 commit comments

Comments
 (0)