Skip to content

Commit

Permalink
OOP
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirupsen committed Dec 6, 2009
1 parent dc35266 commit d5cbe15
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions flimpl.py
Expand Up @@ -3,7 +3,7 @@

class Flimpl:

def app():
def app(self):
controller = open('application/controllers/' + sys.argv[2] + '.php', 'wa')
controller.write('<?php\n\nclass ' + sys.argv[2] + '_Controller extends Controller {\n\n}')
controller.close()
Expand All @@ -17,8 +17,8 @@ def app():
index = open('application/views/' + sys.argv[2] + '.php', 'wa')
index.close()

def appdel():
input = raw_input("Are you sure? ")
def appdel(self):
input = raw_input("Sure you want to delete the " + sys.argv[2] + " app? ")

if input in ('y', 'Y', 'yes'):
if os.path.exists('application/controllers/' + sys.argv[2] + '.php'):
Expand All @@ -29,7 +29,7 @@ def appdel():

if os.path.exists('application/models/' + sys.argv[2] + '.php'):
os.remove('application/models/' + sys.argv[2] + '.php')
print "View for", sys.argv[2], "app deleted"
print "Model for", sys.argv[2], "app deleted"
else:
print "Model for", sys.argv[2], "app not found"

Expand All @@ -41,5 +41,4 @@ def appdel():
else:
print "Not deleting app", sys.argv[2]


Flimpl.sys.argv[1]()
getattr(Flimpl(), sys.argv[1])()

0 comments on commit d5cbe15

Please sign in to comment.