Пример #1
0
 def __init__(self, identifier):
     self.identifier = identifier
     identifier.ref = self
     self.code_path = "webapp/models.py"
     self.namespace = naming.Namespace(parent_namespace=self.identifier.ns)
     block_namespace(self.namespace, model_namespace_keywords)
     self.fields = []
Пример #2
0
def create_import_namespace(file_path):
    def add_imports_to_ns(ns, import_lines):
        for i in import_lines:
            prim_name = IMPORTS[i].split('import')[1].strip()
            ns.find_or_create_import(i, prim_name) # adds to the import namespace ;)

    ns = naming.Namespace()
    add_imports_to_ns(ns, FILE_IMPORT_MAP[file_path])
    return ns
Пример #3
0
    def __init__(self):

        self.model_namespace = create_import_namespace('webapp/models.py')
        self.form_namespace = create_import_namespace('webapp/forms.py')
        self.view_namespace = create_import_namespace('webapp/pages.py')
        self.fr_namespace = create_import_namespace('webapp/form_receivers.py')
        self.emailer_namespace = create_import_namespace('webapp/emailer.py')
        self.tests_namespace = create_import_namespace('webapp/tests.py')
        self.urls_namespace = create_import_namespace('webapp/urls.py')
        self.admin_namespace = create_import_namespace('webapp/admin.py')

        self.userrole_namespace = naming.Namespace()
Пример #4
0
 def __init__(self, identifier, model_id, field_ids, required_field_id_types=None):
     """
     For now it'll only work with model fields
     """
     self.identifier = identifier
     self.is_signup = False
     self.namespace = naming.Namespace(parent_namespace=identifier.ns)
     self.model_id = model_id
     self.code_path = 'webapp/forms.py'
     self.field_ids = field_ids
     self.required_field_id_types = [] if required_field_id_types is None else required_field_id_types
     # convert the type to django type
     self.required_field_id_types = [ (a, utils.CANON_TYPE_MAP[b].replace("TextField", "CharField")) for a, b in self.required_field_id_types]
Пример #5
0
    def __init__(self, identifier, api_key, app_name):
        """
            Renders the emailer module that lets the generated app to send emails via us.
        """
        self.identifier = identifier
        self.api_key = api_key
        self.app_name = app_name
        self.code_path = "webapp/emailer.py"

        self.locals = {}
        self.namespace = naming.Namespace(parent_namespace=self.identifier.ns)
        self.locals['api_key'] = api_key
        self.locals['app_name'] = app_name
        self.locals['requests'] = self.namespace.new_identifier('requests')
Пример #6
0
 def __init__(self, secret_key, provider_chunks):
     settings_namespace = naming.Namespace()
     super(SettingsFactory.DjangoSettings, self).__init__(settings_namespace)
     self.code_path = "settings/common.py"
     self.locals['secret_key'] = secret_key
     self.locals['provider_chunks'] = provider_chunks
Пример #7
0
 def __init__(self, identifier, original_sform_id):
     self.identifier = identifier
     self.namespace = naming.Namespace(parent_namespace=identifier.ns) # this is necessary so the coder can get imports from the namespace
     self.code_path = 'webapp/admin.py'
     self.super_class_id = original_sform_id
Пример #8
0
 def __init__(self, identifier, model_id):
     self.identifier = identifier
     self.is_signup = True
     self.namespace = naming.Namespace(parent_namespace=identifier.ns) # this is necessary so the coder can get imports from the namespace
     self.model_id = model_id
     self.code_path = 'webapp/forms.py'
Пример #9
0
 def __init__(self, identifier):
     self.code_path = 'webapp/admin.py'
     self.identifier = identifier
     self.namespace = naming.Namespace(parent_namespace=self.identifier.ns)
     block_namespace(self.namespace, model_namespace_keywords)