Shinyshell Community Forums > Coding > Python General Questions |
||||||
Sign Up | Member List | New Posts | Help |
September 06 02009, 01:34 GMT | ||||
Faltzer Member Location: Glendale, New York Post count: 38 |
said said That just makes everything else inconvenient. The reason why Mako is preferred over shoddy implementations like Genshi is because it's easy to understand. All Mako does is provide a simple library with bindings to the actual Python language. It doesn't force you to revolve around it; it does on you. You shouldn't have to learn an entirely new way of getting things done in a templating system. If you want to stuff all your logic in the controller, then you're free to do that and just pass the content to render(). I recommend you try the recently fleshed out SUIT Framework, if that's your perspective on how templating should be handled. It allows you to define your own nodes. A Python implementation is being written. It's worth dropping in. said What exactly is the issue with Pylons? It's a clean approach to the MVC structure, and a great RAD tool. It offers you the general flexibility of Python, and doesn't impose silly rules that many frameworks call "coding standards". In comparison to Django, Pylons ends up winning. Django makes use of too many in-house solutions and reinventing the wheel, which makes everything all the more non-Pythonic. ______________________________ FHQ |
September 06 02009, 01:39 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
'key in dict'? I'm afraid I don't understand, Faltzer. D:
Thanks, everyone for all your help. :o You're all pretty awesome. |
September 06 02009, 01:47 GMT | ||||
Faltzer Member Location: Glendale, New York Post count: 38 |
September 06 02009, 02:37 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
Okay, now I see. ^-^
But about the AJAX thing, how do I get the information back to the Javascript? Can I simply print it? |
September 06 02009, 02:43 GMT | ||||
Faltzer Member Location: Glendale, New York Post count: 38 |
September 06 02009, 03:09 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
I'm coding a quiz checker. Here's the quiz, then the Python script.
<script type="text/javascript"> #!/usr/bin/python I want to check it with AJAX, just to learn how to use AJAX and check the form successfully without having the answers THERE in the source code, like with only JavaScript. :D I just need to know how to call on the process_req_change function, I think. EDIT: I just revised it a little. I put in the AJAX? And this is the page. |
September 06 02009, 16:42 GMT | ||||
lec** Supra stultitiam Location: Varaždin, Croatia Post count: 173 |
Oh dear, first of all -- functions within functions are not what I'd do.
<script type="text/javascript"> That will get the stuff from your forms and make it AJAX-sendable. <div id="result"></div> That HTML will work with the above JS. So now you've only got your Python side to worry about. Oh, yeah, and HTML comments are <!-- comment --> Not <!-- bad syntax --!> The Python code looks okay to me, though I've made some changes. #!/usr/bin/python I tested this code out, so it should work for you. Let me know how it goes, and if anything needs explaining. |
September 06 02009, 17:22 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
Ok, I'm PRETTY SURE I did everything right. I even modified the Python file with the code you provided (I see what you did there, thanks). Page. I think everything's in order... it doesn't work, though. :'[
This is probably because I suck majorly at JavaScript or something. xD |
September 06 02009, 17:42 GMT | ||||
lec** Supra stultitiam Location: Varaždin, Croatia Post count: 173 |
Okay, I'm afraid I can't find the Javascript included anywhere in the page xD
|
September 06 02009, 18:09 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
Like I said.
I suck at JavaScript. xD I c/p'd the HTML you supplied, figuring that was the problem, and accidentally replaced the JS, too. Thx. |
September 06 02009, 18:31 GMT | ||||
SpaceMan Member Location: Earth Post count: 32 |
Actually, I don't know the whole Python CGI API, that's why I don't know has_key is deprecated.
I also made the following quiz script as a practice, I'm going to write a Ruby and Perl one and compare them. My server supports Ruby, Perl, Python and even ASP.NET 2. #!/usr/bin/env python |
September 06 02009, 22:45 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
New problem. We're using MyBB for the forum for now, so the DirectoryIndex thing in the .HTACCESS file messes that up a little. It doesn't seem to recognize index.php as an index. : [
|
September 06 02009, 23:15 GMT | ||||
SpaceMan Member Location: Earth Post count: 32 |
This is a PHP and .htaccess problem, not a Python one, did you reply to a wrong thread? (It almost happened to me several times)
|
September 06 02009, 23:20 GMT | ||||
lec** Supra stultitiam Location: Varaždin, Croatia Post count: 173 |
He probably did. Just put a new .htaccess into your forum directory with DirectoryIndex index.php in it :)
|
September 06 02009, 23:24 GMT | ||||
Peter* A Pythonic One Location: US Post count: 99 |
No I didn't xD I figured that it pertained to the topic, since I created the topic with the same site in mind. : o
Thanks guys. ^-^ |
September 07 02009, 00:23 GMT | ||||
Faltzer Member Location: Glendale, New York Post count: 38 |
That type of syntactical reference is found in the manual, actually. That also goes for everything else. I didn't ever have to ask anybody else for help on why my program was not working, why x function returned None, etc.. The manual had everything I ever needed. Everything else was a simple matter of logic and intelligence.
When it comes to programming, I find that giving people answers directly is just going to make them even more reluctant to actually use real sources of help and basically ask the same "can you do this for me?" questions. ______________________________ FHQ |
Forum Information |
||||||||||
|