<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Mar 2, 2010, at 12:45 PM, Kevin Horn wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_quote">On Tue, Mar 2, 2010 at 1:19 PM, Fred C <span dir="ltr">&lt;<a href="mailto:fred@bsdhost.net">fred@bsdhost.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); margin-top: 0pt; margin-right: 0pt; margin-bottom: 0pt; margin-left: 0.8ex; padding-left: 1ex; position: static; z-index: auto; ">
<br>
Hello,<br>
<br>
I am totally new with Twisted and this the first code I have ever written using that package. One of my main problem was to figure out how to fit things together and I am not even sure I understand everything I am doing here.<br>

<br>
Anyway, for a project I have to write a proxy that figure out where is located a resource by requesting a database. then figure out if the resource is accessible and them open a proxy connection to download that resource.<br>

<br>
I was wandering if there is someone in that mailing list who can review that code and tell me how I can improve things. I know I am not accessing the database the right way but I can't figure out how to work with the Callbacks.<br>

<br>
Any help or advice will be very much appreciated. The code is available here: <a href="http://pastebin.com/BGcqzh4Y" target="_blank">http://pastebin.com/BGcqzh4Y</a><br>
<br>
-fred-<br>
<font color="#888888"></font><br></blockquote></div><br>I don't really use Twisted for web work, so I don't have much of a comment on that, but for database access you probably want to use `twisted.enterprise.adbapi`.<br></blockquote><div><br></div><div><br></div><div>That was of the thing I know it's wrong with my code. I have to use adbapi and have a call back to get the result from the database. My main problem in that case is I don't know how to have the caller wait for the response from the database.</div><div><br></div><div>Thanks for taking time to look at that code and for your reply.</div><div><br></div><div>-fred-</div></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Trebuchet MS'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Trebuchet MS'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><font class="Apple-style-span" face="'Trebuchet MS'"><font class="Apple-style-span" face="Courier" size="3"><span class="Apple-style-span" style="font-size: 12px; line-height: 15px;"><span class="Apple-style-span" style="font-family: monospace; font-size: medium; line-height: normal; "><a href="http://kiq.me/oi">http://kiq.me/oi</a><br></span></span></font></font></div><div><font class="Apple-style-span" face="monospace"><br></font></div></div></span></div></span></div></span></div></span></span></div></body></html>