Merge lp:~marten-de-vries/openteacher/2.x-documentation into lp:~openteachermaintainers/openteacher/2.x-broken

Proposed by Marten de Vries
Status: Merged
Merged at revision: 134
Proposed branch: lp:~marten-de-vries/openteacher/2.x-documentation
Merge into: lp:~openteachermaintainers/openteacher/2.x-broken
Diff against target: 47 lines (+15/-4)
1 file modified
src/openteacher.py (+15/-4)
To merge this branch: bzr merge lp:~marten-de-vries/openteacher/2.x-documentation
Reviewer Review Type Date Requested Status
Marten de Vries Approve
Review via email: mp+64970@code.launchpad.net

Commit message

The Accept-Language header is now set when requesting the documentation site.

Description of the change

An Accept-Language header is now sent.

To post a comment you must log in.
Revision history for this message
Marten de Vries (marten-de-vries) wrote :

The headers were sent (according to Wireshark), and I couldn't find any bugs, so I merged it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/openteacher.py'
2--- src/openteacher.py 2011-06-13 19:29:06 +0000
3+++ src/openteacher.py 2011-06-17 11:31:42 +0000
4@@ -86,7 +86,7 @@
5
6 #import PyQt4 and dependancies
7 import sys
8-from PyQt4 import QtGui, QtCore, QtWebKit
9+from PyQt4 import QtGui, QtCore, QtWebKit, QtNetwork
10
11 #import mainwindow
12 import gui.openteacher
13@@ -272,12 +272,15 @@
14 self.view().setHtml("<p>%s</p>" % text)
15
16 class DocumentationDialog(QtGui.QDialog):
17- def __init__(self, parent=None):
18+ def __init__(self, language, parent=None):
19 QtGui.QDialog.__init__(self, parent)
20
21 webView = QtWebKit.QWebView()
22 webView.setPage(OpenTeacherWebPage(webView))
23- webView.setUrl(QtCore.QUrl(DOCUMENTATION_URL))
24+
25+ request = QtNetwork.QNetworkRequest(QtCore.QUrl(DOCUMENTATION_URL))
26+ request.setRawHeader("Accept-Language", language)
27+ webView.load(request)
28
29 vbox = QtGui.QVBoxLayout()
30 vbox.setContentsMargins(0, 0, 0, 0)
31@@ -2135,7 +2138,15 @@
32
33 def showDocumentationDialog(self):
34 """Shows the documentation dialog. Called by the user via action."""
35- docDialog = DocumentationDialog(self)
36+ #Get language
37+ #If the settings-dialog is never opened
38+ if self.settings.value("language").isNull():
39+ langAndCountry = unicode(QtCore.QLocale().name())
40+ lang = langAndCountry[:langAndCountry.find("_")]
41+ else:
42+ lang = unicode(self.settings.value("language").toString())
43+
44+ docDialog = DocumentationDialog(lang, self)
45 docDialog.exec_()
46
47 def setupDesignedDialog(self, designedDialogClass):

Subscribers

People subscribed via source and target branches