|
@@ -1,7 +1,7 @@
|
|
|
#!/usr/bin/env python
|
|
#!/usr/bin/env python
|
|
|
import re
|
|
import re
|
|
|
import MySQLdb as mysql
|
|
import MySQLdb as mysql
|
|
|
-from singplur import singularize, pluralize
|
|
|
|
|
|
|
+from singplur import singularize
|
|
|
from itertools import combinations
|
|
from itertools import combinations
|
|
|
|
|
|
|
|
|
|
|
|
@@ -181,9 +181,10 @@ class Model(object):
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
if self.options.get('create_accessible', True):
|
|
if self.options.get('create_accessible', True):
|
|
|
- lines.append(self.php_attr_accessible())
|
|
|
|
|
|
|
+ lines.append(self.php_attr_accessible())
|
|
|
|
|
|
|
|
- php = classdef % '\n'.join([TAB + line for line in lines if line != None])
|
|
|
|
|
|
|
+ php = classdef % '\n'.join([TAB + line
|
|
|
|
|
+ for line in lines if line is not None])
|
|
|
|
|
|
|
|
return php_block(php) if add_php_block else php
|
|
return php_block(php) if add_php_block else php
|
|
|
|
|
|
|
@@ -274,10 +275,10 @@ if __name__ == '__main__':
|
|
|
help='MySQL username')
|
|
help='MySQL username')
|
|
|
parser.add_argument('-p', '--password', default='mysql12#$',
|
|
parser.add_argument('-p', '--password', default='mysql12#$',
|
|
|
help='MySQL password')
|
|
help='MySQL password')
|
|
|
- parser.add_argument('--has-one', nargs=2, dest='opt_has_one', action='append',
|
|
|
|
|
|
|
+ parser.add_argument('--has-one', nargs=2, dest='opt_has_one',
|
|
|
help='one-to-one relationships of the form '
|
|
help='one-to-one relationships of the form '
|
|
|
'\'payment-receipt\', where one payment has one '
|
|
'\'payment-receipt\', where one payment has one '
|
|
|
- 'receipt')
|
|
|
|
|
|
|
+ 'receipt', action='append')
|
|
|
parser.add_argument('--namespace', default='', dest='opt_namespace',
|
|
parser.add_argument('--namespace', default='', dest='opt_namespace',
|
|
|
help='PHP namespace to create models classes in')
|
|
help='PHP namespace to create models classes in')
|
|
|
parser.add_argument('--create-select', action='store_true',
|
|
parser.add_argument('--create-select', action='store_true',
|