#NEWLINE# def _generate_form( form_name ) : #NEWLINE# #INDENT# form_template = os . path . join ( dirname ( abspath ( __file__ ) ) , 'templates/form.py' ) #NEWLINE# current_path = os . getcwd ( ) #NEWLINE# if ( not form_file_path ) : #NEWLINE# #INDENT# logger . warning ( 'Form name cannot be empty.' ) #NEWLINE# return #NEWLINE# #UNINDENT# form_file_path = os . path . join ( current_path , 'application/forms' , ( form_name + '.py' ) ) #NEWLINE# shutil . copy ( form_template , form_file_path ) #NEWLINE# logger . info ( ( 'New: %s' % _relative_path ( form_file_path ) ) ) #NEWLINE# with open ( os . path . join ( current_path , 'application/forms/__init__.py' ) , 'a' ) as package_file : #NEWLINE# #INDENT# package_file . write ( ( '\nfrom .%s import *' % form_name ) )