예제 #1
0
    def get_app_choices(self):
        """
        Generate a choice list with all views witch can handle a empty root url.
        But PyLucid can only handle own plugins, see:
            http://trac.pylucid.net/ticket/333
        """
        if self._APP_CHOICES == None:
            try:
                root_apps = installed_apps_utils.get_filtered_apps(
                    resolve_url="/", no_args=False, skip_fail=True
                )
            except TypeError:
                # Old django-tools has no skip_fail parameter
                root_apps = installed_apps_utils.get_filtered_apps(
                    resolve_url="/", no_args=False
                )

            self._APP_CHOICES = [("", "---------")]
            for app in root_apps:
                plugin_name = app.split(".")[-1]
                if not plugin_name in PYLUCID_PLUGINS:
                    continue
                plugin_instance = PYLUCID_PLUGINS[plugin_name]

                self._APP_CHOICES.append(
                    (plugin_instance.installed_apps_string, plugin_instance.pkg_string)
                )

#            apps = [app for app in root_apps if not "pylucid_project.apps" in app]
#            self._APP_CHOICES = [("", "---------")] + [(app, app) for app in sorted(apps)]
        return self._APP_CHOICES
예제 #2
0
    def get_app_choices(self):
        """
        Generate a choice list with all views witch can handle a empty root url.
        But PyLucid can only handle own plugins, see:
            http://trac.pylucid.net/ticket/333
        """
        if self._APP_CHOICES == None:
            debug = settings.DEBUG and settings.RUN_WITH_DEV_SERVER

            root_apps = installed_apps_utils.get_filtered_apps(resolve_url="/",
                                                               no_args=False,
                                                               debug=debug,
                                                               skip_fail=True)

            self._APP_CHOICES = [("", "---------")]
            for app in root_apps:
                plugin_name = app.split(".")[-1]
                if not plugin_name in PYLUCID_PLUGINS:
                    continue
                plugin_instance = PYLUCID_PLUGINS[plugin_name]

                self._APP_CHOICES.append(
                    (plugin_instance.installed_apps_string,
                     plugin_instance.pkg_string))


#            apps = [app for app in root_apps if not "pylucid_project.apps" in app]
#            self._APP_CHOICES = [("", "---------")] + [(app, app) for app in sorted(apps)]
        return self._APP_CHOICES
 def test_get_filtered_apps1(self):
     apps = get_filtered_apps()
     self.assertEqual(apps, [])
 def test_get_filtered_apps4(self):
     apps = get_filtered_apps(resolve_url="login/", no_args=False)
     self.assertEqual(apps, ['django.contrib.auth', 'django.contrib.flatpages'])
 def test_get_filtered_apps3(self):
     apps = get_filtered_apps(resolve_url="login/",
         # debug=True
     )
     self.assertEqual(apps, ['django.contrib.auth'])
 def test_get_filtered_apps2(self):
     apps = get_filtered_apps(no_args=False)
     self.assertEqual(apps, ['django.contrib.flatpages'])
예제 #7
0
 def test_get_filtered_apps4(self):
     apps = get_filtered_apps(resolve_url="login/", no_args=False)
     assert_pformat_equal(
         apps, ["django.contrib.auth", "django.contrib.flatpages"])
예제 #8
0
 def test_get_filtered_apps3(self):
     apps = get_filtered_apps(resolve_url="login/",
                              # debug=True
                              )
     assert_pformat_equal(apps, ["django.contrib.auth"])
예제 #9
0
 def test_get_filtered_apps2(self):
     apps = get_filtered_apps(no_args=False)
     assert_pformat_equal(apps, ["django.contrib.flatpages"])
예제 #10
0
 def test_get_filtered_apps1(self):
     apps = get_filtered_apps()
     assert_pformat_equal(apps, [])
 def test_get_filtered_apps4(self):
     apps = get_filtered_apps(resolve_url="login/", no_args=False)
     self.assertEqual(apps, ['django.contrib.flatpages', 'django.contrib.auth'])
 def test_get_filtered_apps3(self):
     apps = get_filtered_apps(resolve_url="login/",
         # debug=True
     )
     self.assertEqual(apps, ['django.contrib.auth'])
 def test_get_filtered_apps2(self):
     apps = get_filtered_apps(no_args=False)
     self.assertEqual(apps, ['django.contrib.flatpages'])
 def test_get_filtered_apps1(self):
     apps = get_filtered_apps()
     self.assertEqual(apps, [])