It is a fresh ubuntu install no modifications.  I am using Firefox
that  came with ubuntu 8.10 without any modifications.  I downloaded
and installed apache server.

I used easy_install to install TurboGears 1.1b3, Sqlalchemy,
sqlobject, pysqlite.

The databases were updated through the shell by copy and paste from
the tutorial.  In other words everything is right out of the box.

I am really impressed with turbogears and committed to using tg in a
project I have been planning for the last year.  I just need to get a
handle on some of the basics.

the Controller.py is:

# standard library imports
# import logging
import datetime

# third-party imports
from cherrypy import request
from turbogears import controllers, expose, flash, identity, redirect,
visit

# project specific imports
#from identity_tutorial import model
#from identity_tutorial import json
# log = logging.getLogger("identity_tutorial.controllers")
class Root(controllers.RootController):
    """The root controller of the application."""
    @expose()
   # @expose(template="identity_tutorial.templates.welcome")
    @identity.require(identity.in_group("admin"))
    def index(self):
        """"Show the welcome page."""
        # log.debug("Happy TurboGears Controller Responding For Duty")
        flash(_(u"Your application is now running"))
        return dict(now=datetime.datetime.now())
    @expose(template="identity_tutorial.templates.login")
    def login(self, forward_url=None, *args, **kw):
        """Show the login form or forward user to previously requested
page."""
        if forward_url:
            if isinstance(forward_url, list):
                forward_url = forward_url.pop(0)
            else:
                del request.params['forward_url']

        new_visit = visit.current()
        if new_visit:
            new_visit = new_visit.is_new

        if (not new_visit and not identity.current.anonymous
                and identity.was_login_attempted()
                and not identity.get_identity_errors()):
            redirect(forward_url or '/', kw)

        if identity.was_login_attempted():
            if new_visit:
                msg = _(u"Cannot log in because your browser "
                         "does not support session cookies.")
            else:
                msg = _(u"The credentials you supplied were not
correct or "
                         "did not grant access to this resource.")
        elif identity.get_identity_errors():
            msg = _(u"You must provide your credentials before
accessing "
                     "this resource.")
        else:
            msg = _(u"Please log in.")
            if not forward_url:
                forward_url = request.headers.get("Referer", "/")

        # we do not set the response status here anymore since it
        # is now handled in the identity exception.
        return dict(logging_in=True, message=msg,
            forward_url=forward_url, previous_url=request.path_info,
            original_parameters=request.params)

    @expose()
    def logout(self):
        """Log out the current identity and redirect to start page."""
        identity.current.logout()
        redirect("/")

The login.html is:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:py="http://genshi.edgewall.org/";
      xmlns:xi="http://www.w3.org/2001/XInclude";>

<xi:include href="master.html" />

<head>
    <meta content="text/html; charset=UTF-8"
        http-equiv="content-type" py:replace="''"/>
    <title>Login</title>
    <link rel="stylesheet" type="text/css" media="screen" href="$
{tg.url('/static/css/login.css')}" />
</head>

<body>
    <div id="loginBox">
        <h1>Login</h1>
        <p>${message}</p>
        <form action="${tg.url(previous_url)}" method="POST">
            <table>
                <tr>
                    <td class="label">
                        <label for="user_name">User Name:</label>
                    </td>
                    <td class="field">
                        <input type="text" id="user_name"
name="user_name"/>
                    </td>
                </tr>
                <tr>
                    <td class="label">
                        <label for="password">Password:</label>
                    </td>
                    <td class="field">
                        <input type="password" id="password"
name="password"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" class="buttons">
                        <input type="submit" name="login"
value="Login"/>
                    </td>
                </tr>
            </table>

            <input py:if="forward_url" type="hidden"
name="forward_url"
                value="${forward_url}"/>

            <div py:for="name,values in original_parameters.items()"
py:strip="1">
            <input py:for="value in isinstance(values, list) and
values or [values]"
                type="hidden" name="${name}" value="${value}"/>
            </div>
        </form>
    </div>
</body>
</html>

On Jan 6, 8:09 pm, "Jorge Vargas" <[email protected]> wrote:
> On Mon, Jan 5, 2009 at 9:51 PM, shorttimer <[email protected]> wrote:
>
> > I posted similar error back in Dec thought it was caused by 64 bit so
> > I tried to address that.  I am now working with 32bit and have vista
> > home editions and ubuntu 8.10.  Both operating systems are giving
> > errors.  The identity tutorial on ubuntu will open a file dialog
>
> > which is application/json
>
> > with options to open or save
>
> >  the file opened in a text editor includes:
> > {"tg_flash": "Your application is now running", "now": "2009-01-04
> > 20:43:50.372097"}
>
> > The microsoft error is a different issue, but I am more interested in
> > getting through the ubuntu issue so I can get on to my next hump with
> > identity.
>
> > any help would be appreciated.
>
> Hi, when posting for help please provide
> 1- the relevant code
> 2- the traceback
> 3- the version of TG you are using.
>
> From what you have I see no reference to identity other than the fact
> that you could be serving your /login url as json which if it's like
> that you put it there. if not it seems your browser is opening stuff
> as json which well makes no sense unless you set that their client or
> server side.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to