Merge lp:~sinzui/launchpad/css-ui-0 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 12097
Proposed branch: lp:~sinzui/launchpad/css-ui-0
Merge into: lp:launchpad
Diff against target: 560 lines (+149/-117)
16 files modified
lib/canonical/launchpad/icing/style-3-0.css.in (+2/-2)
lib/canonical/launchpad/icing/style.css (+0/-1)
lib/canonical/launchpad/offline-maintenance-haproxy.html (+42/-32)
lib/canonical/launchpad/offline-maintenance.html (+11/-1)
lib/canonical/launchpad/offline-staging-code-update.html (+11/-1)
lib/canonical/launchpad/offline-staging-db-update.html (+11/-1)
lib/canonical/launchpad/offline-unplanned-haproxy.html (+42/-32)
lib/canonical/launchpad/offline-unplanned.html (+11/-1)
lib/canonical/launchpad/webapp/interfaces.py (+5/-13)
lib/canonical/launchpad/webapp/login.py (+2/-2)
lib/canonical/launchpad/webapp/notifications.py (+3/-12)
lib/lp/app/browser/tests/test_launchpad.py (+1/-1)
lib/lp/app/stories/basics/xx-notifications.txt (+2/-8)
lib/lp/app/templates/base-layout-macros.pt (+0/-4)
lib/lp/blueprints/browser/tests/test_specification.py (+3/-3)
lib/lp/registry/browser/person.py (+3/-3)
To merge this branch: bzr merge lp:~sinzui/launchpad/css-ui-0
Reviewer Review Type Date Requested Status
Edwin Grubbs (community) code Approve
Review via email: mp+43936@code.launchpad.net

Description of the change

Update browser notices and offline pages.

    Launchpad bug:
        https://bugs.launchpad.net/bugs/36287
        https://bugs.launchpad.net/bugs/253558
        https://bugs.launchpad.net/bugs/330035
    Pre-implementation: no one
    Test command: ./bin/test -vv -t notifications -t test_launchpad

Bug #36287 [NOTICE and INFO logging levels should be merged]
    NOTICE and INFO messages are shown identically. NOTICE seems to be
    custom fluff and should be removed.

Bug #253558 [New message styling obscures useful content]
     the message class styles obscure page content in multiple locations.

Bug #330035 ["Please try again" page is crooked]
    "Please try again" page <https://launchpad.net/offline.html>, the heading
    is correctly horizontally centered with respect to the whole viewport; but
    when the browser window is wider than 60em, the body text is way off to
    the left.

--------------------------------------------------------------------

RULES

Bug #36287 [NOTICE and INFO logging levels should be merged]
    * Remove NOTICE. Update the few callsite that use it to use INFO instead.

Bug #253558 [New message styling obscures useful content]
    * Add a top margin of 1em to clear the previous content. Use em units
      for margin and padding to keep the distance proportional to the font.

Bug #330035 ["Please try again" page is crooked]
    * The offline css needs a margin rule.
    * Several of the offline pages are trying to load the mast css file
      which cannot be guaranteed to be served. Inline the font and offline
      rules to ensure all pages are centered with the correct font.
    * Remove the unused .offline style from the style sheet.

QA

Bug #36287 [NOTICE and INFO logging levels should be merged]
    * Mark a blueprint as started.
    * Verify an info notice is shown. (This will look identical to
      product because the template macro converted NOTICE to INFO)

Bug #253558 [New message styling obscures useful content]
    * Mark a blueprint as started.
    * Verify the info icon is below the registration line.

Bug #330035 ["Please try again" page is crooked]
    * Not QAable while the server is up. The html file in the tree can
      be looked at with a browser without a running server.

LINT

    lib/canonical/launchpad/offline-maintenance-haproxy.html
    lib/canonical/launchpad/offline-maintenance.html
    lib/canonical/launchpad/offline-staging-code-update.html
    lib/canonical/launchpad/offline-staging-db-update.html
    lib/canonical/launchpad/offline-unplanned-haproxy.html
    lib/canonical/launchpad/offline-unplanned.html
    lib/canonical/launchpad/browser/tests/test_launchpad.py
    lib/canonical/launchpad/icing/style-3-0.css.in
    lib/canonical/launchpad/icing/style.css
    lib/canonical/launchpad/webapp/interfaces.py
    lib/canonical/launchpad/webapp/login.py
    lib/canonical/launchpad/webapp/notifications.py
    lib/lp/app/stories/basics/xx-notifications.txt
    lib/lp/app/templates/base-layout-macros.pt
    lib/lp/blueprints/browser/tests/test_specification.py
    lib/lp/registry/browser/person.py

^ There is a lot of lint in these files. I can fix this after the review.

IMPLEMENTATION

Bug #36287 [NOTICE and INFO logging levels should be merged]
    Removed NOTICE and and its tests. Updated the account and spec uses
    notices to use INFO.
    lib/canonical/launchpad/browser/tests/test_launchpad.py
    lib/canonical/launchpad/webapp/interfaces.py
    lib/canonical/launchpad/webapp/login.py
    lib/canonical/launchpad/webapp/notifications.py
    lib/lp/app/templates/base-layout-macros.pt
    lib/lp/blueprints/browser/tests/test_specification.py
    lib/lp/registry/browser/person.py
    lib/lp/app/stories/basics/xx-notifications.txt

Bug #253558 [New message styling obscures useful content]
    Added 1em to the top margin and updated the padding to be in em units.
    lib/canonical/launchpad/icing/style-3-0.css.in

Bug #330035 ["Please try again" page is crooked]
    Inlined the CSS rules for the pages and removed the rule that was never
    loaded.
    lib/canonical/launchpad/offline-maintenance-haproxy.html
    lib/canonical/launchpad/offline-maintenance.html
    lib/canonical/launchpad/offline-staging-code-update.html
    lib/canonical/launchpad/offline-staging-db-update.html
    lib/canonical/launchpad/offline-unplanned-haproxy.html
    lib/canonical/launchpad/offline-unplanned.html
    lib/canonical/launchpad/icing/style.css

To post a comment you must log in.
Revision history for this message
Edwin Grubbs (edwin-grubbs) wrote :
Download full text (3.4 KiB)

Hi Curtis,

This branch looks good. I just have some minor comments.

-Edwin

>=== modified file 'lib/canonical/launchpad/offline-maintenance-haproxy.html'
>--- lib/canonical/launchpad/offline-maintenance-haproxy.html 2010-04-01 13:43:01 +0000
>+++ lib/canonical/launchpad/offline-maintenance-haproxy.html 2010-12-16 18:25:39 +0000
>@@ -6,7 +6,17 @@
> <head>
> <title>Launchpad is offline for maintenance</title>
> <style type="text/css" media="screen, print">
>- .offline{text-align:center;margin:2em 0}
>+ html, body {
>+ font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
>+ }
>+ .offline {
>+ text-align: center;
>+ max-width: 60em;
>+ }
>+ .offline > * {
>+ margin-left: auto;
>+ margin-right: auto;
>+ }
> </style>
> </head>
> <body>

This file has CR/LF. How did that happen?

>=== modified file 'lib/canonical/launchpad/offline-unplanned-haproxy.html'
>--- lib/canonical/launchpad/offline-unplanned-haproxy.html 2010-03-02 10:42:06 +0000
>+++ lib/canonical/launchpad/offline-unplanned-haproxy.html 2010-12-16 18:25:39 +0000
>@@ -6,7 +6,17 @@
> <head>
> <title>Please try again</title>
> <style type="text/css" media="screen, print">
>- .offline{text-align:center;margin:2em 0}
>+ html, body {
>+ font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
>+ }
>+ .offline {
>+ text-align: center;
>+ max-width: 60em;
>+ }
>+ .offline > * {
>+ margin-left: auto;
>+ margin-right: auto;
>+ }
> </style>
> </head>
> <body>

CR/LF again.

>=== modified file 'lib/canonical/launchpad/webapp/interfaces.py'
>--- lib/canonical/launchpad/webapp/interfaces.py 2010-11-02 19:55:24 +0000
>+++ lib/canonical/launchpad/webapp/interfaces.py 2010-12-16 18:25:39 +0000
>@@ -568,15 +568,12 @@
> """Matches the standard logging levels, with the addition of notice
> (which we should probably add to our log levels as well)
> """

The above docstring should be updated.

>- # XXX mpt 2006-03-22 bugs=36287:
>- # NOTICE and INFO should be merged.
> DEBUG = logging.DEBUG # A debugging message
> INFO = logging.INFO # simple confirmation of a change
>- NOTICE = logging.INFO + 5 # action had effects you might not have intended
> WARNING = logging.WARNING # action will not be successful unless you ...
> ERROR = logging.ERROR # the previous action did not succeed, and why
>
>- ALL_LEVELS = (DEBUG, INFO, NOTICE, WARNING, ERROR)
>+ ALL_LEVELS = (DEBUG, INFO, WARNING, ERROR)
>
>
> class INotification(Interface):
>=== modified file 'lib/canonical/launchpad/webapp/notifications.py'
>--- lib/canonical/launchpad/webapp/notifications.py 2010-08-20 20:31:18 +0000
>+++ lib/canonical/launchpad/webapp/notifications.py 2010-12-16 18:25:39 +0000
>@@ -334,8 +327,6 @@
> structured('Debug notification <b>%d</b>' % count))
> response.addInfoNotification(
> structured('Info notification <b>%d</b>' % count))
>- response.addNoticeNotificat...

Read more...

review: Approve (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

On Thu, 2010-12-16 at 22:15 +0000, Edwin Grubbs wrote:
> Review: Approve code
> Hi Curtis,
>
> This branch looks good. I just have some minor comments.
>
> -Edwin
>
> >=== modified file 'lib/canonical/launchpad/offline-maintenance-haproxy.html'
> >--- lib/canonical/launchpad/offline-maintenance-haproxy.html 2010-04-01 13:43:01 +0000
> >+++ lib/canonical/launchpad/offline-maintenance-haproxy.html 2010-12-16 18:25:39 +0000
> >@@ -6,7 +6,17 @@
> > <head>
> > <title>Launchpad is offline for maintenance</title>
> > <style type="text/css" media="screen, print">
> >- .offline{text-align:center;margin:2em 0}
> >+ html, body {
> >+ font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
> >+ }
> >+ .offline {
> >+ text-align: center;
> >+ max-width: 60em;
> >+ }
> >+ .offline > * {
> >+ margin-left: auto;
> >+ margin-right: auto;
> >+ }
> > </style>
> > </head>
> > <body>
>
>
> This file has CR/LF. How did that happen?

I think they have always been like that. Both haproxy page may have been
cargo culted from somewhere else.

--
__Curtis C. Hovey_________
http://launchpad.net/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/canonical/launchpad/icing/style-3-0.css.in'
--- lib/canonical/launchpad/icing/style-3-0.css.in 2010-10-31 20:18:45 +0000
+++ lib/canonical/launchpad/icing/style-3-0.css.in 2010-12-17 14:00:43 +0000
@@ -969,8 +969,8 @@
969 border: solid #666;969 border: solid #666;
970 border-width: 1px 2px 2px 1px;970 border-width: 1px 2px 2px 1px;
971 color: black;971 color: black;
972 margin: 0 auto 10px auto;972 margin: 1em auto 1em auto;
973 padding: 0 10px 10px 20px;973 padding: 0 1em 1em 2em;
974 width: 30em;974 width: 30em;
975 }975 }
976.error.message::before, .warning.message::before,976.error.message::before, .warning.message::before,
977977
=== modified file 'lib/canonical/launchpad/icing/style.css'
--- lib/canonical/launchpad/icing/style.css 2010-11-19 20:34:37 +0000
+++ lib/canonical/launchpad/icing/style.css 2010-12-17 14:00:43 +0000
@@ -32,7 +32,6 @@
32.exception {color: #cc0000;}32.exception {color: #cc0000;}
33.discreet, .lesser, .duplicate-details {font-size: 90%;}33.discreet, .lesser, .duplicate-details {font-size: 90%;}
34.extra-discreet {font-size: 75%;}34.extra-discreet {font-size: 75%;}
35.offline {text-align: center; margin: 2em 0;}
36.unavailable {color: #999; background: none;}35.unavailable {color: #999; background: none;}
3736
38.duplicate-details p { padding: 0em; margin-top: 0em; margin-bottom: 0.2em; }37.duplicate-details p { padding: 0em; margin-top: 0em; margin-bottom: 0.2em; }
3938
=== modified file 'lib/canonical/launchpad/offline-maintenance-haproxy.html'
--- lib/canonical/launchpad/offline-maintenance-haproxy.html 2010-04-01 13:43:01 +0000
+++ lib/canonical/launchpad/offline-maintenance-haproxy.html 2010-12-17 14:00:43 +0000
@@ -1,32 +1,42 @@
1HTTP/1.1 503 Service Unavailable1HTTP/1.1 503 Service Unavailable
2Content-Type: text/html2Content-Type: text/html
33
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <head>6 <head>
7 <title>Launchpad is offline for maintenance</title>7 <title>Launchpad is offline for maintenance</title>
8 <style type="text/css" media="screen, print">8 <style type="text/css" media="screen, print">
9 .offline{text-align:center;margin:2em 0}9 html, body {
10 </style>10 font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
11 </head>11 }
12 <body>12 .offline {
13 <div class="offline">13 text-align: center;
14 <!-- Before editing, please see14 max-width: 60em;
15 https://bugs.launchpad.net/bugs/475371, especially comment #2,15 }
16 for details on this file. In particular, please maintain the16 .offline > * {
17 \r\n line endings, at least for the HTTP header lines. -->17 margin-left: auto;
18 <h1>Sorry</h1>18 margin-right: auto;
19 <p>19 }
20 Launchpad is offline for scheduled maintenance.20 </style>
21 We should be back soon.21 </head>
22 </p>22 <body>
23 <p>23 <div class="offline">
24 You can find more information on the24 <!-- Before editing, please see
25 <a href="http://identi.ca/launchpadstatus">Launchpad system status25 https://bugs.launchpad.net/bugs/475371, especially comment #2,
26 </a> page.26 for details on this file. In particular, please maintain the
27 </p>27 \r\n line endings, at least for the HTTP header lines. -->
28 <p>Thanks for your patience.</p>28 <h1>Sorry</h1>
2929 <p>
30 </div>30 Launchpad is offline for scheduled maintenance.
31 </body>31 We should be back soon.
32</html>32 </p>
33 <p>
34 You can find more information on the
35 <a href="http://identi.ca/launchpadstatus">Launchpad system status
36 </a> page.
37 </p>
38 <p>Thanks for your patience.</p>
39
40 </div>
41 </body>
42</html>
3343
=== modified file 'lib/canonical/launchpad/offline-maintenance.html'
--- lib/canonical/launchpad/offline-maintenance.html 2010-04-01 13:43:01 +0000
+++ lib/canonical/launchpad/offline-maintenance.html 2010-12-17 14:00:43 +0000
@@ -3,7 +3,17 @@
3 <head>3 <head>
4 <title>Launchpad is offline for maintenance</title>4 <title>Launchpad is offline for maintenance</title>
5 <style type="text/css" media="screen, print">5 <style type="text/css" media="screen, print">
6 @import url(https://launchpad.net/+icing/rev5/+combo.css);6 html, body {
7 font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
8 }
9 .offline {
10 text-align: center;
11 max-width: 60em;
12 }
13 .offline > * {
14 margin-left: auto;
15 margin-right: auto;
16 }
7 </style>17 </style>
8 </head>18 </head>
9 <body>19 <body>
1020
=== modified file 'lib/canonical/launchpad/offline-staging-code-update.html'
--- lib/canonical/launchpad/offline-staging-code-update.html 2010-05-14 15:52:49 +0000
+++ lib/canonical/launchpad/offline-staging-code-update.html 2010-12-17 14:00:43 +0000
@@ -3,7 +3,17 @@
3 <head>3 <head>
4 <title>Please try again</title>4 <title>Please try again</title>
5 <style type="text/css" media="screen, print">5 <style type="text/css" media="screen, print">
6 @import url(https://launchpad.net/+icing/rev5/combo.css);6 html, body {
7 font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
8 }
9 .offline {
10 text-align: center;
11 max-width: 60em;
12 }
13 .offline > * {
14 margin-left: auto;
15 margin-right: auto;
16 }
7 </style>17 </style>
8 </head>18 </head>
9 <body>19 <body>
1020
=== modified file 'lib/canonical/launchpad/offline-staging-db-update.html'
--- lib/canonical/launchpad/offline-staging-db-update.html 2010-05-14 15:52:49 +0000
+++ lib/canonical/launchpad/offline-staging-db-update.html 2010-12-17 14:00:43 +0000
@@ -3,7 +3,17 @@
3 <head>3 <head>
4 <title>Please try again</title>4 <title>Please try again</title>
5 <style type="text/css" media="screen, print">5 <style type="text/css" media="screen, print">
6 @import url(https://launchpad.net/+icing/rev5/combo.css);6 html, body {
7 font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
8 }
9 .offline {
10 text-align: center;
11 max-width: 60em;
12 }
13 .offline > * {
14 margin-left: auto;
15 margin-right: auto;
16 }
7 </style>17 </style>
8 </head>18 </head>
9 <body>19 <body>
1020
=== modified file 'lib/canonical/launchpad/offline-unplanned-haproxy.html'
--- lib/canonical/launchpad/offline-unplanned-haproxy.html 2010-03-02 10:42:06 +0000
+++ lib/canonical/launchpad/offline-unplanned-haproxy.html 2010-12-17 14:00:43 +0000
@@ -1,32 +1,42 @@
1HTTP/1.1 503 Service Unavailable1HTTP/1.1 503 Service Unavailable
2Content-Type: text/html2Content-Type: text/html
33
4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">4<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6 <head>6 <head>
7 <title>Please try again</title>7 <title>Please try again</title>
8 <style type="text/css" media="screen, print">8 <style type="text/css" media="screen, print">
9 .offline{text-align:center;margin:2em 0}9 html, body {
10 </style>10 font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
11 </head>11 }
12 <body>12 .offline {
13 <div class="offline">13 text-align: center;
14 <!-- Before editing, please see14 max-width: 60em;
15 https://bugs.launchpad.net/bugs/475371, especially comment #2,15 }
16 for details on this file. In particular, please maintain the16 .offline > * {
17 \r\n line endings, at least for the HTTP header lines. -->17 margin-left: auto;
18 <h1>Please try again</h1>18 margin-right: auto;
19 <p>19 }
20 Sorry, there was a problem connecting to the Launchpad server.20 </style>
21 </p>21 </head>
22 <p>22 <body>
23 Try reloading this page in a minute or two.23 <div class="offline">
24 If the problem persists, let us know in24 <!-- Before editing, please see
25 <a href="irc://chat.freenode.net/#launchpad"25 https://bugs.launchpad.net/bugs/475371, especially comment #2,
26 >the #launchpad IRC channel on Freenode</a>.26 for details on this file. In particular, please maintain the
27 </p>27 \r\n line endings, at least for the HTTP header lines. -->
28 <p>Thanks for your patience.</p>28 <h1>Please try again</h1>
2929 <p>
30 </div>30 Sorry, there was a problem connecting to the Launchpad server.
31 </body>31 </p>
32</html>32 <p>
33 Try reloading this page in a minute or two.
34 If the problem persists, let us know in
35 <a href="irc://chat.freenode.net/#launchpad"
36 >the #launchpad IRC channel on Freenode</a>.
37 </p>
38 <p>Thanks for your patience.</p>
39
40 </div>
41 </body>
42</html>
3343
=== modified file 'lib/canonical/launchpad/offline-unplanned.html'
--- lib/canonical/launchpad/offline-unplanned.html 2010-01-04 12:58:17 +0000
+++ lib/canonical/launchpad/offline-unplanned.html 2010-12-17 14:00:43 +0000
@@ -3,7 +3,17 @@
3 <head>3 <head>
4 <title>Please try again</title>4 <title>Please try again</title>
5 <style type="text/css" media="screen, print">5 <style type="text/css" media="screen, print">
6 @import url(https://launchpad.net/+icing/rev5/combo.css);6 html, body {
7 font-family: UbuntuBeta, Ubuntu, 'Bitstream Vera Sans', 'DejaVu Sans', Tahoma, sans-serif;
8 }
9 .offline {
10 text-align: center;
11 max-width: 60em;
12 }
13 .offline > * {
14 margin-left: auto;
15 margin-right: auto;
16 }
7 </style>17 </style>
8 </head>18 </head>
9 <body>19 <body>
1020
=== modified file 'lib/canonical/launchpad/webapp/interfaces.py'
--- lib/canonical/launchpad/webapp/interfaces.py 2010-11-02 19:55:24 +0000
+++ lib/canonical/launchpad/webapp/interfaces.py 2010-12-17 14:00:43 +0000
@@ -565,18 +565,13 @@
565#565#
566566
567class BrowserNotificationLevel:567class BrowserNotificationLevel:
568 """Matches the standard logging levels, with the addition of notice568 """Matches the standard logging levels."""
569 (which we should probably add to our log levels as well)
570 """
571 # XXX mpt 2006-03-22 bugs=36287:
572 # NOTICE and INFO should be merged.
573 DEBUG = logging.DEBUG # A debugging message569 DEBUG = logging.DEBUG # A debugging message
574 INFO = logging.INFO # simple confirmation of a change570 INFO = logging.INFO # simple confirmation of a change
575 NOTICE = logging.INFO + 5 # action had effects you might not have intended
576 WARNING = logging.WARNING # action will not be successful unless you ...571 WARNING = logging.WARNING # action will not be successful unless you ...
577 ERROR = logging.ERROR # the previous action did not succeed, and why572 ERROR = logging.ERROR # the previous action did not succeed, and why
578573
579 ALL_LEVELS = (DEBUG, INFO, NOTICE, WARNING, ERROR)574 ALL_LEVELS = (DEBUG, INFO, WARNING, ERROR)
580575
581576
582class INotification(Interface):577class INotification(Interface):
@@ -593,7 +588,7 @@
593588
594 def __getitem__(index_or_levelname):589 def __getitem__(index_or_levelname):
595 """Retrieve an INotification by index, or a list of INotification590 """Retrieve an INotification by index, or a list of INotification
596 instances by level name (DEBUG, NOTICE, INFO, WARNING, ERROR).591 instances by level name (DEBUG, INFO, WARNING, ERROR).
597 """592 """
598593
599 def __iter__():594 def __iter__():
@@ -616,7 +611,7 @@
616 have been set when redirect() is called.611 have been set when redirect() is called.
617 """612 """
618613
619 def addNotification(msg, level=BrowserNotificationLevel.NOTICE):614 def addNotification(msg, level=BrowserNotificationLevel.INFO):
620 """Append the given message to the list of notifications.615 """Append the given message to the list of notifications.
621616
622 A plain string message will be CGI escaped. Passing a message617 A plain string message will be CGI escaped. Passing a message
@@ -629,7 +624,7 @@
629 or an instance of `IStructuredString`.624 or an instance of `IStructuredString`.
630625
631 :param level: One of the `BrowserNotificationLevel` values: DEBUG,626 :param level: One of the `BrowserNotificationLevel` values: DEBUG,
632 INFO, NOTICE, WARNING, ERROR.627 INFO, WARNING, ERROR.
633 """628 """
634629
635 def removeAllNotifications():630 def removeAllNotifications():
@@ -649,9 +644,6 @@
649 def addInfoNotification(msg):644 def addInfoNotification(msg):
650 """Shortcut to addNotification(msg, INFO)."""645 """Shortcut to addNotification(msg, INFO)."""
651646
652 def addNoticeNotification(msg):
653 """Shortcut to addNotification(msg, NOTICE)."""
654
655 def addWarningNotification(msg):647 def addWarningNotification(msg):
656 """Shortcut to addNotification(msg, WARNING)."""648 """Shortcut to addNotification(msg, WARNING)."""
657649
658650
=== modified file 'lib/canonical/launchpad/webapp/login.py'
--- lib/canonical/launchpad/webapp/login.py 2010-10-26 15:47:24 +0000
+++ lib/canonical/launchpad/webapp/login.py 2010-12-17 14:00:43 +0000
@@ -119,7 +119,7 @@
119 target = self.getRedirectURL(current_url, query_string)119 target = self.getRedirectURL(current_url, query_string)
120 # A dance to assert that we want to break the rules about no120 # A dance to assert that we want to break the rules about no
121 # unauthenticated sessions. Only after this next line is it safe121 # unauthenticated sessions. Only after this next line is it safe
122 # to use the ``addNoticeNotification`` method.122 # to use the ``addInfoNotification`` method.
123 allowUnauthenticatedSession(self.request)123 allowUnauthenticatedSession(self.request)
124 self.request.response.redirect(target)124 self.request.response.redirect(target)
125 # Maybe render page with a link to the redirection?125 # Maybe render page with a link to the redirection?
@@ -365,7 +365,7 @@
365 # The authentication failed (or was canceled), but the user is365 # The authentication failed (or was canceled), but the user is
366 # already logged in, so we just add a notification message and366 # already logged in, so we just add a notification message and
367 # redirect.367 # redirect.
368 self.request.response.addNoticeNotification(368 self.request.response.addInfoNotification(
369 _(u'Your authentication failed but you were already '369 _(u'Your authentication failed but you were already '
370 'logged into Launchpad.'))370 'logged into Launchpad.'))
371 self._redirect()371 self._redirect()
372372
=== modified file 'lib/canonical/launchpad/webapp/notifications.py'
--- lib/canonical/launchpad/webapp/notifications.py 2010-08-20 20:31:18 +0000
+++ lib/canonical/launchpad/webapp/notifications.py 2010-12-17 14:00:43 +0000
@@ -16,7 +16,6 @@
1616
17from datetime import datetime17from datetime import datetime
1818
19from zope.app.security.interfaces import IUnauthenticatedPrincipal
20from zope.interface import implements19from zope.interface import implements
21from zope.session.interfaces import ISession20from zope.session.interfaces import ISession
2221
@@ -114,7 +113,6 @@
114 >>> response.addNotification("Whatever", BrowserNotificationLevel.DEBUG)113 >>> response.addNotification("Whatever", BrowserNotificationLevel.DEBUG)
115 >>> response.addDebugNotification('Debug')114 >>> response.addDebugNotification('Debug')
116 >>> response.addInfoNotification('Info')115 >>> response.addInfoNotification('Info')
117 >>> response.addNoticeNotification('Notice')
118 >>> response.addWarningNotification('Warning')116 >>> response.addWarningNotification('Warning')
119117
120 And an odd one to test Bug #54987118 And an odd one to test Bug #54987
@@ -127,11 +125,10 @@
127125
128 >>> for notification in response.notifications:126 >>> for notification in response.notifications:
129 ... print "%d -- %s" % (notification.level, notification.message)127 ... print "%d -- %s" % (notification.level, notification.message)
130 25 -- <b>&lt;Fnord&gt;</b>128 20 -- <b>&lt;Fnord&gt;</b>
131 10 -- Whatever129 10 -- Whatever
132 10 -- Debug130 10 -- Debug
133 20 -- Info131 20 -- Info
134 25 -- Notice
135 30 -- Warning132 30 -- Warning
136 40 -- Error133 40 -- Error
137134
@@ -144,7 +141,7 @@
144 >>> for notification in ISession(request)[SESSION_KEY]['notifications']:141 >>> for notification in ISession(request)[SESSION_KEY]['notifications']:
145 ... print "%d -- %s" % (notification.level, notification.message)142 ... print "%d -- %s" % (notification.level, notification.message)
146 ... break143 ... break
147 25 -- <b>&lt;Fnord&gt;</b>144 20 -- <b>&lt;Fnord&gt;</b>
148145
149 If there are no notifications, the session is not touched. This ensures146 If there are no notifications, the session is not touched. This ensures
150 that we don't needlessly burden the session storage.147 that we don't needlessly burden the session storage.
@@ -172,7 +169,7 @@
172 # which would be bad.169 # which would be bad.
173 _notifications = None170 _notifications = None
174171
175 def addNotification(self, msg, level=BrowserNotificationLevel.NOTICE):172 def addNotification(self, msg, level=BrowserNotificationLevel.INFO):
176 """See `INotificationResponse`."""173 """See `INotificationResponse`."""
177 self.notifications.append(174 self.notifications.append(
178 Notification(level, escape(msg)))175 Notification(level, escape(msg)))
@@ -237,10 +234,6 @@
237 """See `INotificationResponse`."""234 """See `INotificationResponse`."""
238 self.addNotification(msg, BrowserNotificationLevel.INFO)235 self.addNotification(msg, BrowserNotificationLevel.INFO)
239236
240 def addNoticeNotification(self, msg):
241 """See `INotificationResponse`."""
242 self.addNotification(msg, BrowserNotificationLevel.NOTICE)
243
244 def addWarningNotification(self, msg):237 def addWarningNotification(self, msg):
245 """See `INotificationResponse`."""238 """See `INotificationResponse`."""
246 self.addNotification(msg, BrowserNotificationLevel.WARNING)239 self.addNotification(msg, BrowserNotificationLevel.WARNING)
@@ -334,8 +327,6 @@
334 structured('Debug notification <b>%d</b>' % count))327 structured('Debug notification <b>%d</b>' % count))
335 response.addInfoNotification(328 response.addInfoNotification(
336 structured('Info notification <b>%d</b>' % count))329 structured('Info notification <b>%d</b>' % count))
337 response.addNoticeNotification(
338 structured('Notice notification <b>%d</b>' % count))
339 response.addWarningNotification(330 response.addWarningNotification(
340 structured('Warning notification <b>%d</b>' %count))331 structured('Warning notification <b>%d</b>' %count))
341 response.addErrorNotification(332 response.addErrorNotification(
342333
=== renamed file 'lib/canonical/launchpad/browser/tests/test_launchpad.py' => 'lib/lp/app/browser/tests/test_launchpad.py'
--- lib/canonical/launchpad/browser/tests/test_launchpad.py 2010-10-21 04:41:30 +0000
+++ lib/lp/app/browser/tests/test_launchpad.py 2010-12-17 14:00:43 +0000
@@ -127,7 +127,7 @@
127 def assertDisplaysNotice(self, path, notification):127 def assertDisplaysNotice(self, path, notification):
128 """Assert that traversal redirects back with the specified notice."""128 """Assert that traversal redirects back with the specified notice."""
129 self.assertDisplaysNotification(129 self.assertDisplaysNotification(
130 path, notification, BrowserNotificationLevel.NOTICE)130 path, notification, BrowserNotificationLevel.INFO)
131131
132 def assertDisplaysError(self, path, notification):132 def assertDisplaysError(self, path, notification):
133 """Assert that traversal redirects back with the specified notice."""133 """Assert that traversal redirects back with the specified notice."""
134134
=== renamed file 'lib/canonical/launchpad/pagetests/standalone/xx-notifications.txt' => 'lib/lp/app/stories/basics/xx-notifications.txt'
--- lib/canonical/launchpad/pagetests/standalone/xx-notifications.txt 2009-10-22 18:13:42 +0000
+++ lib/lp/app/stories/basics/xx-notifications.txt 2010-12-17 14:00:43 +0000
@@ -15,8 +15,8 @@
15...<div class="error message">Error notification <b>2</b></div>15...<div class="error message">Error notification <b>2</b></div>
16...<div class="warning message">Warning notification <b>1</b></div>16...<div class="warning message">Warning notification <b>1</b></div>
17...<div class="warning message">Warning notification <b>2</b></div>17...<div class="warning message">Warning notification <b>2</b></div>
18...<div class="informational message">Notice notification <b>1</b></div>18...<div class="informational message">Info notification <b>1</b></div>
19...<div class="informational message">Notice notification <b>2</b></div>19...<div class="informational message">Info notification <b>2</b></div>
20...<div class="debug message">Debug notification <b>1</b></div>20...<div class="debug message">Debug notification <b>1</b></div>
21...<div class="debug message">Debug notification <b>2</b></div>21...<div class="debug message">Debug notification <b>2</b></div>
22...22...
@@ -49,8 +49,6 @@
49...<div class="error message">Error notification <b>2</b></div>49...<div class="error message">Error notification <b>2</b></div>
50...<div class="warning message">Warning notification <b>1</b></div>50...<div class="warning message">Warning notification <b>1</b></div>
51...<div class="warning message">Warning notification <b>2</b></div>51...<div class="warning message">Warning notification <b>2</b></div>
52...<div class="informational message">Notice notification <b>1</b></div>
53...<div class="informational message">Notice notification <b>2</b></div>
54...<div class="informational message">Info notification <b>1</b></div>52...<div class="informational message">Info notification <b>1</b></div>
55...<div class="informational message">Info notification <b>2</b></div>53...<div class="informational message">Info notification <b>2</b></div>
56...<div class="debug message">Debug notification <b>1</b></div>54...<div class="debug message">Debug notification <b>1</b></div>
@@ -90,8 +88,6 @@
90...<div class="error message">Error notification <b>2</b></div>88...<div class="error message">Error notification <b>2</b></div>
91...<div class="warning message">Warning notification <b>1</b></div>89...<div class="warning message">Warning notification <b>1</b></div>
92...<div class="warning message">Warning notification <b>2</b></div>90...<div class="warning message">Warning notification <b>2</b></div>
93...<div class="informational message">Notice notification <b>1</b></div>
94...<div class="informational message">Notice notification <b>2</b></div>
95...<div class="informational message">Info notification <b>1</b></div>91...<div class="informational message">Info notification <b>1</b></div>
96...<div class="informational message">Info notification <b>2</b></div>92...<div class="informational message">Info notification <b>2</b></div>
97...<div class="debug message">Debug notification <b>1</b></div>93...<div class="debug message">Debug notification <b>1</b></div>
@@ -151,8 +147,6 @@
151...<div class="error message">Error notification <b>2</b></div>147...<div class="error message">Error notification <b>2</b></div>
152...<div class="warning message">Warning notification <b>1</b></div>148...<div class="warning message">Warning notification <b>1</b></div>
153...<div class="warning message">Warning notification <b>2</b></div>149...<div class="warning message">Warning notification <b>2</b></div>
154...<div class="informational message">Notice notification <b>1</b></div>
155...<div class="informational message">Notice notification <b>2</b></div>
156...<div class="informational message">Info notification <b>1</b></div>150...<div class="informational message">Info notification <b>1</b></div>
157...<div class="informational message">Info notification <b>2</b></div>151...<div class="informational message">Info notification <b>2</b></div>
158...<div class="debug message">Debug notification <b>1</b></div>152...<div class="debug message">Debug notification <b>1</b></div>
159153
=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
--- lib/lp/app/templates/base-layout-macros.pt 2010-12-14 20:53:23 +0000
+++ lib/lp/app/templates/base-layout-macros.pt 2010-12-17 14:00:43 +0000
@@ -23,10 +23,6 @@
23 tal:content="structure notification/message"23 tal:content="structure notification/message"
24 >A warning notification message</div>24 >A warning notification message</div>
25 <div class="informational message"25 <div class="informational message"
26 tal:repeat="notification notifications/notice"
27 tal:content="structure notification/message"
28 >A notice notification message</div>
29 <div class="informational message"
30 tal:repeat="notification notifications/info"26 tal:repeat="notification notifications/info"
31 tal:content="structure notification/message"27 tal:content="structure notification/message"
32 >An info notification message</div>28 >An info notification message</div>
3329
=== modified file 'lib/lp/blueprints/browser/tests/test_specification.py'
--- lib/lp/blueprints/browser/tests/test_specification.py 2010-12-01 11:26:57 +0000
+++ lib/lp/blueprints/browser/tests/test_specification.py 2010-12-17 14:00:43 +0000
@@ -129,7 +129,7 @@
129 SpecificationImplementationStatus.STARTED, spec.implementation_status)129 SpecificationImplementationStatus.STARTED, spec.implementation_status)
130 self.assertEqual(spec.owner, spec.starter)130 self.assertEqual(spec.owner, spec.starter)
131 [notification] = view.request.notifications131 [notification] = view.request.notifications
132 self.assertEqual(BrowserNotificationLevel.NOTICE, notification.level)132 self.assertEqual(BrowserNotificationLevel.INFO, notification.level)
133 self.assertEqual(133 self.assertEqual(
134 'Blueprint is now considered "Started".', notification.message)134 'Blueprint is now considered "Started".', notification.message)
135135
@@ -162,7 +162,7 @@
162 spec.implementation_status)162 spec.implementation_status)
163 self.assertIs(None, spec.starter)163 self.assertIs(None, spec.starter)
164 [notification] = view.request.notifications164 [notification] = view.request.notifications
165 self.assertEqual(BrowserNotificationLevel.NOTICE, notification.level)165 self.assertEqual(BrowserNotificationLevel.INFO, notification.level)
166 self.assertEqual(166 self.assertEqual(
167 'Blueprint is now considered "Not started".', notification.message)167 'Blueprint is now considered "Not started".', notification.message)
168168
@@ -182,7 +182,7 @@
182 spec.implementation_status)182 spec.implementation_status)
183 self.assertEqual(spec.owner, spec.completer)183 self.assertEqual(spec.owner, spec.completer)
184 [notification] = view.request.notifications184 [notification] = view.request.notifications
185 self.assertEqual(BrowserNotificationLevel.NOTICE, notification.level)185 self.assertEqual(BrowserNotificationLevel.INFO, notification.level)
186 self.assertEqual(186 self.assertEqual(
187 'Blueprint is now considered "Complete".', notification.message)187 'Blueprint is now considered "Complete".', notification.message)
188188
189189
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2010-12-15 22:05:43 +0000
+++ lib/lp/registry/browser/person.py 2010-12-17 14:00:43 +0000
@@ -1538,7 +1538,7 @@
1538 def deactivate_action(self, action, data):1538 def deactivate_action(self, action, data):
1539 self.context.deactivateAccount(data['comment'])1539 self.context.deactivateAccount(data['comment'])
1540 logoutPerson(self.request)1540 logoutPerson(self.request)
1541 self.request.response.addNoticeNotification(1541 self.request.response.addInfoNotification(
1542 _(u'Your account has been deactivated.'))1542 _(u'Your account has been deactivated.'))
1543 self.next_url = self.request.getApplicationURL()1543 self.next_url = self.request.getApplicationURL()
15441544
@@ -1810,12 +1810,12 @@
1810 # email is sent to the user.1810 # email is sent to the user.
1811 data['password'] = 'invalid'1811 data['password'] = 'invalid'
1812 self.person.setPreferredEmail(None)1812 self.person.setPreferredEmail(None)
1813 self.request.response.addNoticeNotification(1813 self.request.response.addInfoNotification(
1814 u'The account "%s" has been suspended.' % (1814 u'The account "%s" has been suspended.' % (
1815 self.context.displayname))1815 self.context.displayname))
1816 if (data['status'] == AccountStatus.ACTIVE1816 if (data['status'] == AccountStatus.ACTIVE
1817 and self.context.status != AccountStatus.ACTIVE):1817 and self.context.status != AccountStatus.ACTIVE):
1818 self.request.response.addNoticeNotification(1818 self.request.response.addInfoNotification(
1819 u'The user is reactivated. He must use the '1819 u'The user is reactivated. He must use the '
1820 u'"forgot password" to log in.')1820 u'"forgot password" to log in.')
1821 self.updateContextFromData(data)1821 self.updateContextFromData(data)