title: TypeError: 'Key' object is not iterable
body: <p>Application - Flask app hosted on google app engine. </p>
  
  <p>I get the following error when I try rendering my template</p>
  
  <pre><code>  File "Show_Messages.html", line 1, in top-level template code
      {% extends "AdminMaster.html" %}
  TypeError: 'Key' object is not iterable
  </code></pre>
  
  <p>My template (Show_messages.html)</p>
  
  <pre><code>{% extends "AdminMaster.html" %}
  {% block title %}News{% endblock %}
  {% block page %}News{% endblock %}
  {% block head %}
      {{ super() }}
  {% endblock %}
  {% block content %}
      &lt;div class="container"&gt;
          &lt;div class="page-header"&gt;
              &lt;h1&gt;News&lt;/h1&gt;
          &lt;/div&gt;
      &lt;div class="col-lg-12"&gt;
          &lt;ul class="list-group"&gt;
              {% for newsitem in newsitems %}
                  &lt;li class="list-group-item"&gt;
                      &lt;span class="badge"&gt;
                          &lt;a href="Edit-NewsItem?ID={{ newsitem.key.urlsafe() }}"&gt;
                              &lt;span class="glyphicon glyphicon-pencil" aria-hidden="true"&gt;&lt;/span&gt;
                          &lt;/a&gt;
                      &lt;/span&gt;
                  &lt;/li&gt;
              {% endfor %}
          &lt;/ul&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p>The route function</p>
  
  <pre><code>@message_admin_routes.route('/xxxx/xxxx-xxxx')
  @authenticate_admin
  def show_messages():
      breadcrumb, user = build_user_and_breadcrumbs()
      messages = MessageFactory().get_messages_key()
      return render_template('Show_Messages.html',
                             user=user,
                             breadcrumb=breadcrumb,
                             newsitems=messages)
  </code></pre>
  
  <p>------Edited---------</p>
  
  <p>AdminMaster.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/html"&gt;
  &lt;head&gt;
  &lt;!--googleoff: snippet--&gt;
  {% block head %}
      &lt;title&gt;CFC Melbourne - {% block title %}{%endblock%}&lt;/title&gt;
      &lt;meta name="Section" content="{% block page %}{%endblock%}"&gt;
      &lt;META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW"&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;link rel="stylesheet" href="https://storage.googleapis.com/xxxx/xxx/xxx.css" type="text/css"&gt;
      &lt;link rel="stylesheet" href="https://storage.googleapis.com/xxxx/xxxx/xxxx.css" type="text/css"&gt;
    &lt;link rel="shortcut icon" href="https://storage.googleapis.com/xxxx/xxxx/favicon.ico"&gt;
      &lt;link href='https://storage.googleapis.com/xxx/xxx.css' rel='stylesheet' type='text/css'&gt;
      &lt;link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet"&gt;
  {% endblock %}
      &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
      &lt;script&gt;
          /**
          * Function that tracks a click on an outbound link in Google Analytics.
          * This function takes a valid URL string as an argument, and uses that URL string
          * as the event label.
          */
          var trackOutboundLink = function(url) {
             ga('send', 'event', 'outbound', 'click', url, {'hitCallback':
               function () {
               document.location = url;
               }
             });
          }
      &lt;/script&gt;
      &lt;script&gt;
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
        (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
        m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
  
        ga('create', 'xxx-xx-xx', 'xxx-xx-xx.xxx.xxx');
        ga('send', 'pageview');
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body itemscope itemtype="http://schema.org/WebPage"&gt;
  &lt;div id="wrap"&gt;
      &lt;div id="menu"&gt;
          &lt;nav class="navbar navbar-default" style="margin-bottom: 0px;"&gt;
              &lt;div class="container-fluid"&gt;
                     &lt;!-- Brand and toggle get grouped for better mobile display --&gt;
      &lt;div class="navbar-header"&gt;
        &lt;button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false"&gt;
          &lt;span class="sr-only"&gt;Toggle navigation&lt;/span&gt;
          &lt;span class="icon-bar"&gt;&lt;/span&gt;
          &lt;span class="icon-bar"&gt;&lt;/span&gt;
          &lt;span class="icon-bar"&gt;&lt;/span&gt;
        &lt;/button&gt;
        &lt;a class="navbar-brand" href="/Eden"&gt;&lt;div class='logo-text-a' style="color: black"&gt;CFC Melbourne Admin&lt;/div&gt;&lt;/a&gt;
      &lt;/div&gt;
  
      &lt;!-- Collect the nav links, forms, and other content for toggling --&gt;
      &lt;div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"&gt;
        &lt;ul class="nav navbar-nav"&gt;
          &lt;li class="dropdown"&gt;
            &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;Applications &lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
            &lt;ul class="dropdown-menu"&gt;
              &lt;li&gt;&lt;a href="/Eden/Applications"&gt;List all applications&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="/Eden/New-Application"&gt;Create new application&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;Something else here&lt;/a&gt;&lt;/li&gt;
              &lt;li role="separator" class="divider"&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="/Eden/Vision"&gt;Vision&lt;/a&gt;&lt;/li&gt;
              &lt;li role="separator" class="divider"&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;One more separated linkkk&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul class="nav navbar-nav navbar-right"&gt;
          &lt;li class="dropdown"&gt;
            &lt;a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"&gt;{{ user.nickname() }}&lt;span class="caret"&gt;&lt;/span&gt;&lt;/a&gt;
            &lt;ul class="dropdown-menu"&gt;
              &lt;li&gt;&lt;a href="#"&gt;Permissions&lt;/a&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="#"&gt;User Information&lt;/a&gt;&lt;/li&gt;
              &lt;li role="separator" class="divider"&gt;&lt;/li&gt;
              &lt;li&gt;&lt;a href="{{ logout }}"&gt;Logout&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/div&gt;&lt;!-- /.navbar-collapse --&gt;
              &lt;/div&gt;
          &lt;/nav&gt;
          {% include 'AdminBreadcrumb.html' %}
      &lt;/div&gt;
  
      &lt;div id="content"&gt;
          {% block content %}{% endblock %}
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;!--googleoff: snippet--&gt;
  {% block footer %}
  
      &lt;script src="https://storage.googleapis.com/xxxx/js/jquery-2.1.0.min.js"&gt;&lt;/script&gt;
      &lt;script src="https://storage.googleapis.com/xxxx/js/bootstrap.min.js"&gt;&lt;/script&gt;
          &lt;script&gt;
  // Remove active for all items.
          $('.page-sidebar-menu li').removeClass('active');
  
          // highlight submenu item
          $('li a[href="' + this.location.pathname + '"]').parent().addClass('active');
  
          // Highlight parent menu item.
          $('ul a[href="' + this.location.pathname + '"]').parents('li').addClass('active');
      &lt;/script&gt;
  {% endblock%}
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>