Your SlideShare is downloading. ×
Rails vs Web2py
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Rails vs Web2py

7,020
views

Published on

My presentation for Athens Digital Week 2009

My presentation for Athens Digital Week 2009

Published in: Technology

0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,020
On Slideshare
0
From Embeds
0
Number of Embeds
12
Actions
Shares
0
Downloads
54
Comments
0
Likes
7
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Rails vs Web2Py From ”Ruby On Rails” to ”Web to Python”     http://jon.is.emotionull.com
  • 2. Controllers     class MyTestController < ApplicationController     def index         render_text “Hello World”     end end    def index():      return "Hello World"    
  • 3. Params    class MyTestController < ApplicationController     def index         render_text “Hello ”+params[:who]     end end    def index():      return "Hello %s" % request.vars.who def index():      return "Hello %s" % request.args[0]    
  • 4. Dispatching      http://hostname/MyTest/index class MyTestController < ApplicationController     def index         render_text “Hello World”     end end     http://hostname/myapp/mycontroller/index calls def index():      return "Hello %s" % request.vars.who    
  • 5. Routing  routes.rb    routes.py (reversed routing, with or without  regex, IP filtering)    
  • 6. Views    <table>  <% @recipes.each do |recipe| %>   <tr>    <td><%= recipe.name %></td>   </tr>  <% end %> </table>    <table>  {{for recipe in recipes:}}>   <tr>    <td>{{=recipe.name}}</td>   </tr>  {{pass}}     </table>
  • 7. Passing vars in views    class MyTestController < ApplicationController     def index         @message=“Hello World”     end end    def index():      return dict(message=”Hello World”)    
  • 8. Layouts    <title>Layout Example</title>   <body>     <%= yield %>   </body> </html>    <title>Layout Example</title>   <body>     {{include}}   </body> </html> and in view:     {{extend ‘layout.html’}} body
  • 9. Forms    <%= form_tag :action => "update" dp %>  Name: <%= text_field "item", "name" %><br />  Value: <%= text_field "item", "value" %><br />  <%= submit_tag %> <%= end %>    def contact():     form = SQLFORM(Article)     if form.accepts(request.vars):         redirect('thanks')     return dict(form=form)    
  • 10. Validation    ActiveForm::Definition::create :article do |f|  f.section :details do |s|  s.text_element :email,:class => 'required' do |e|     e.validates_as_email :msg => 'not email'  end end    db.define_table(‘Article’,SQLField(‘email’)) db.Article.email.requires=IS_EMAIL()    
  • 11. Migrations    class Article < ActiveRecord::Migration   def self.up       create_table :articles do |t|         t.column :name, :string         t.column :description, :text       end   end end    Article=db.define_table(‘Article’,            SQLField(‘email’,’string’),            SQLField(‘description’,’text’)    
  • 12. Queries    Article.find(:first,:conditions => [    "id > :id AND name = :name",         {:id => 3,      :name => "test" }])    db(Article.id>3 and Article.name==’test’).select()    
  • 13. Gems / Plugins  Lots of them   Free Appliaces (plugin system still under  planning)    
  • 14. Installation  Must install ruby, Rails, gems, databases   Just a zip (cross­platform)    
  • 15. Web Administration  Nope    Killer­full fledged administration (even  dedicated for apps)    
  • 16. Upload files  Plugins (paperclip)  Built in (specify as an 'upload' field    
  • 17. Users/Roles  Plugins    Built in (trivial to override)    
  • 18. Application Distribution   'Frozen' Applications     Share the application directory ByteCode compilation    
  • 19. Ticketing system/VC/ Unit testing  External    Built­in (you can even make patches via web  interface)    
  • 20. Google App Engine  via JRuby (with LOTS of changes and hacks)    Natively (only framework that runs  UNMODIFIED on GAE)    
  • 21. Caching  MemCache  For any function cache: in RAM, disk,  memcache or combinations    
  • 22. Translations  Natively (but still hard to use)  You can add/edit translations via web interface    
  • 23. Routing  routes.rb  routes.py (reversed routing, with or without  regex, IP filtering)    
  • 24. Support  Many books, very big community and tutorials    Two 'manual' books, smaller but dedicated  community    
  • 25.   Thank for watching! Questions? http://jon.is.emotionull.com jon@emotionull.com    

×