Not sure how to get started..getting error 500

1 view
Skip to first unread message

onmountain

unread,
Nov 14, 2007, 10:53:06 AM11/14/07
to tg-registration
Hi. I am pretty new to TG and have been building an app website. Going
ok so far with all my code, but decided to take a break form that and
start a new app from scratch with Identity running. I then realized
that it only had login/logout, hence I found your Registration system.
Looks great. I did the following from my Windows XP PC (my development
has been on that up to this point, although I have a webfaction
account and will have production on it):
easy_install registration (seemed to work fine)
tg-admin quickstart -t registration (created my new project watcher5,
with yes for Identity - seems ok)

I read in your configuration file that TurboMail is preferred so I
went ahead and installed that:
easy_install TurboMail (seemed ok)

I added following to the dev.cfg:
mail.on = True
mail.server = 'www.hotmail.com'
mail.username = blahbl...@hotmail.com
mail.password = 'blahblah'


I indeed can get the login and logout to work. I also can get the
registration form up, fill it out, etc. I get an error however as
follows:
-----------------------------------------------------------
500 Internal error

The server encountered an unexpected condition which prevented it from
fulfilling the request.

Page handler: <bound method UserRegistration.create of
<watcher5.register_controllers.UserRegistration object at 0x016A9A50>>
Traceback (most recent call last):
File "C:\Python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy
\_cphttptools.py", line 105, in _run
self.main()
File "C:\Python25\lib\site-packages\cherrypy-2.2.1-py2.5.egg\cherrypy
\_cphttptools.py", line 254, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in create
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\controllers.py", line 344, in expose
*args, **kw)
File "<string>", line 5, in run_with_transaction
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\database.py", line 316, in so_rwt
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\controllers.py", line 359, in <lambda>
mapping, fragment, args, kw)))
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\controllers.py", line 386, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\errorhandling.py", line 72, in try_call
return func(self, *args, **kw)
File "<string>", line 3, in create
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\controllers.py", line 181, in validate
return errorhandling.run_with_errors(errors, func, *args, **kw)
File "C:\Python25\lib\site-packages\turbogears-1.0.4b1-py2.5.egg
\turbogears\errorhandling.py", line 110, in run_with_errors
return func(self, *args, **kw)
File "C:\data\turbogears\watcher5\watcher5\register_controllers.py",
line 73, in create
self.mail_new_validation_email(pend)
File "C:\data\turbogears\watcher5\watcher5\register_controllers.py",
line 164, in mail_new_validation_email
body % {'validation_url': url})
File "C:\data\turbogears\watcher5\watcher5\register_controllers.py",
line 382, in send_email
smtp = smtplib.SMTP(self.smtp_server, self.smtp_port)
File "C:\Python25\lib\smtplib.py", line 244, in __init__
(code, msg) = self.connect(host, port)
File "C:\Python25\lib\smtplib.py", line 311, in connect
(code, msg) = self.getreply()
File "C:\Python25\lib\smtplib.py", line 355, in getreply
raise SMTPServerDisconnected("Connection unexpectedly closed")
SMTPServerDisconnected: Connection unexpectedly closed

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

Now the potentially stupid part. I don't think I can access my SMTP
account at webfaction form a remote PC, as they only allow their own
servers access to email system??? That is my belief, so I also tried
using my hotmail account. Then I though maybe I am missing on that
also, so I added the last two lines below to my dev.cfg file.

mail.on = True
mail.server = 'www.hotmail.com'
mail.username = 'blahbl...@hotmail.com'
mail.password = 'blahblah

mail.testmode = True
mail.debug = True

NOTE: These last two seem to have no effect on anything. I don't see
any debug info and it is obviously still trying to email out.

Anyway, I am asking for advice.
1. Should I dump using the PC as development and start using
webfaction account?
2. If I should/can use PC, is there an easy SMTP thing I can load here
(I know how to do it on Linux but not Windows :-)
3. Is there something else I shoudl be doing to make TurboMail work
with Registration???? Like import statements in anyo fthe various .py
files? How does it know not to use the mail configurations in its own
cfg file (it says it will ignore them but how?).
4. My strategy at this point is to get the user registration and login
part working on this fresh, clean project, then slowly integrate all
of my stuff back in one by one, testing that it keeps working at each
baby step.

I appreciate any guidance. I am sure it is 99.99% something that is
obvious and my fault, but I just don't know how to debug it.
Jamie

Patrick Lewis

unread,
Nov 15, 2007, 12:44:20 PM11/15/07
to tg-registration
On Nov 14, 10:53 am, onmountain <onmount...@gmail.com> wrote:
> Hi. I am pretty new to TG and have been building an app website. Going
> ok so far with all my code, but decided to take a break form that and
> start a new app from scratch with Identity running. I then realized
> that it only had login/logout, hence I found your Registration system.
> Looks great. I did the following from my Windows XP PC (my development
> has been on that up to this point, although I have a webfaction
> account and will have production on it):
> easy_install registration (seemed to work fine)
> tg-admin quickstart -t registration (created my new project watcher5,
> with yes for Identity - seems ok)
>
> I read in your configuration file that TurboMail is preferred so I
> went ahead and installed that:
> easy_install TurboMail (seemed ok)
>
> I added following to the dev.cfg:
> mail.on = True
> mail.server = 'www.hotmail.com'
> mail.username = blahblahb...@hotmail.com
From the traceback, you are seeing an error originate from a part of
the code that doesn't use TurboMail (i.e. the error is coming from the
'dumb' built-in email handler). The values for the 'dumb' handler are
probably still set to the defaults, so it isn't suprising that it
doesn't work.

So, I guess we need to figure out why TurboMail isn't being detected.
Since you have 'mail.on=True' in your config file, the only thing I
can think of is that you are unable to import the turbomail module. In
your main controllers.py, can you try

import turbomail

and see if that works without an exception?

> ---------------------------------------------
>
> Now the potentially stupid part. I don't think I can access my SMTP
> account at webfaction form a remote PC, as they only allow their own
> servers access to email system??? That is my belief, so I also tried
> using my hotmail account. Then I though maybe I am missing on that
> also, so I added the last two lines below to my dev.cfg file.
>
> mail.on = True
> mail.server = 'www.hotmail.com'
> mail.username = 'blahblahb...@hotmail.com'
> mail.password = 'blahblah
>
> mail.testmode = True
> mail.debug = True
>
> NOTE: These last two seem to have no effect on anything. I don't see
> any debug info and it is obviously still trying to email out.
>
> Anyway, I am asking for advice.
> 1. Should I dump using the PC as development and start using
> webfaction account?
Let's not get too far ahead here; there may

> 2. If I should/can use PC, is there an easy SMTP thing I can load here
> (I know how to do it on Linux but not Windows :-)

Sorry, I'm no help here. Your ISP (not webfaction) doesn't have a
mail server you can use?

> 3. Is there something else I shoudl be doing to make TurboMail work
> with Registration???? Like import statements in anyo fthe various .py
> files? How does it know not to use the mail configurations in its own
> cfg file (it says it will ignore them but how?).

You can see how this works in the 'send_email' method in
register_controllers.py. It's not too tricky. The method sees if it
can import turbomail and if it is turned on. If that is true, it's
going to send use turbomail; otherwise, it uses the standard library
and the registration config variables to do the mailing.

To help things out, you may want to throw a log message (or just print
statements) in this method to clarify what is going on.

> 4. My strategy at this point is to get the user registration and login
> part working on this fresh, clean project, then slowly integrate all
> of my stuff back in one by one, testing that it keeps working at each
> baby step.
>
> I appreciate any guidance. I am sure it is 99.99% something that is
> obvious and my fault, but I just don't know how to debug it.
> Jamie

Let's see if turbomail is actually visible, and then go from there.

anseljh

unread,
Nov 16, 2007, 10:45:25 AM11/16/07
to tg-registration
Actually, it's probably the fact that www.hotmail.com isn't a valid
SMTP server:

> > mail.server = 'www.hotmail.com'

$ telnet www.hotmail.com 25
Trying 64.70.45.46...
telnet: connect to address 64.70.45.46: Operation timed out
telnet: Unable to connect to remote host
Reply all
Reply to author
Forward
0 new messages