Merge lp:~stefan-schwarzburg/qreator/fix_bug_1208033 into lp:qreator

Proposed by Schwarzburg
Status: Merged
Merged at revision: 177
Proposed branch: lp:~stefan-schwarzburg/qreator/fix_bug_1208033
Merge into: lp:qreator
Diff against target: 31 lines (+12/-2)
1 file modified
qreator/qrcodes/QRCodeWifiGtk.py (+12/-2)
To merge this branch: bzr merge lp:~stefan-schwarzburg/qreator/fix_bug_1208033
Reviewer Review Type Date Requested Status
David Planella Approve
Review via email: mp+178663@code.launchpad.net

Description of the change

This branch tries to fix bug 1208033.

The problem reported in this bug comes from the fact that the Wifi QR code type uses special characters to separate the ssid, the password and so on. Those characters have to be replaced.

To post a comment you must log in.
Revision history for this message
David Planella (dpm) wrote :

Looks good to me, thanks for the fix!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qreator/qrcodes/QRCodeWifiGtk.py'
2--- qreator/qrcodes/QRCodeWifiGtk.py 2012-12-30 14:48:29 +0000
3+++ qreator/qrcodes/QRCodeWifiGtk.py 2013-08-06 06:52:27 +0000
4@@ -20,6 +20,16 @@
5 from gi.repository import Gtk, NetworkManager, NMClient, GLib, GdkPixbuf
6
7
8+def _escape(st):
9+ """Replace problematic characters with the escaped versions.
10+
11+ Note that the backslash must be the first character to replace"""
12+ esc_string = st
13+ for c in ["\\", ",", ":", ";"]:
14+ esc_string = esc_string.replace(c, "\\" + c)
15+ return esc_string
16+
17+
18 class QRCodeWifiGtk(object):
19 def __init__(self, qr_code_update_func):
20 self.qr_code_update_func = qr_code_update_func
21@@ -94,8 +104,8 @@
22 if not security or ssid == '' or password == '':
23 return
24
25- wifi_qr_code = 'WIFI:T:{0};S:{1};P:{2};;'.format(security, ssid,
26- password)
27+ wifi_qr_code = 'WIFI:T:{0};S:{1};P:{2};;'.format(_escape(security), _escape(ssid),
28+ _escape(password))
29 self.qr_code_update_func(wifi_qr_code)
30
31 def on_comboboxtextSecurity_changed(self, widget, data=None):

Subscribers

People subscribed via source and target branches

to all changes: