openstack team mailing list archive
-
openstack team
-
Mailing list archive
-
Message #22116
Re: register a new panel in overrides.py
Neither of those works.
When I use "settings.register(ec2list.EC2ListPanel)" I get this error:
"Error registering panel: 'module' object has no attribute 'EC2ListPanel'"
If I just use: settings.register(EC2ListPanel), I get the same sort of error:
Error registering panel: name 'EC2ListPanel' is not defined
-Wyllys
On Mar 20, 2013, at 1:10 PM, "Lyle, David (Cloud Services)" <david.lyle@xxxxxx> wrote:
> But you should be registering the Panel like
> settings.register(EC2ListPanel)
> or settings.register(ec2list.EC2ListPanel)
>
> not ec2list
>
> -Dave
>
> -----Original Message-----
> From: Wyllys Ingersoll [mailto:Wyllys.Ingersoll@xxxxxxxxxx]
> Sent: Wednesday, March 20, 2013 11:04 AM
> To: Lyle, David (Cloud Services)
> Cc: openstack@xxxxxxxxxxxxxxxxxxx
> Subject: Re: register a new panel in overrides.py
>
>
> Thats not working for me.
>
> My module is installed in /usr/lib/python2.7/dist-packages/horizon/dashboards/settings as 'ec2list', it is in the python path so thats not the issue.
>
> overrides.py looks like this:
> ------------
> import horizon
> import logging
>
> settings= horizon.get_dashboard('settings')
>
> LOG = logging.getLogger(__name__)
>
> import ec2list
>
> try:
> settings.register(ec2list)
> except Exception as exc:
> LOG.debug("Error registering ec2list panel: %s" % exc)
> -------------
>
> I've also tried using ec2list.__class__, but then I get the following error:
> "Error registering ec2list panel: Only Panel classes or subclasses may be registered."
>
> However, my ec2list Panel is a valid panel, as is evident by the fact that when I put it directly into the settings/dashboard.py file list of panels, it works just fine. Here is the panel.py file:
>
> ------
> from django.utils.translation import ugettext_lazy as _
>
> import horizon
> from horizon.dashboards.settings import dashboard
>
> class EC2ListPanel(horizon.Panel):
> name = _("EC2 List Credentials")
> slug = 'ec2list'
>
> dashboard.Settings.register(EC2ListPanel)
> ---------
>
>
>
>
>
>
> On Mar 20, 2013, at 12:34 PM, "Lyle, David (Cloud Services)" <david.lyle@xxxxxx> wrote:
>
>> There's a couple of changes that you need to make...
>>
>> First, edit the overrides.py file: (e.g., if we wanted to add the panel to the admin dashboard so this uses the admin dashboard slug: 'admin')
>>
>> import horizon
>> from path_to_module.panel import YourNewPanelClass
>>
>> admin_dashboard = horizon.get_dashboard("admin")
>> admin_dashboard.register(YourNewPanelClass)
>>
>>
>> Next, make sure your overrides.py file is being called in your settings.py
>>
>> HORIZON_CONFIG = {
>> dashboards = ('project', 'admin','settings'),
>> ...,
>> 'customization_module': 'your_base_module.overrides'
>> }
>>
>> -Dave
>>
>> -----Original Message-----
>> From: openstack-bounces+david.lyle=hp.com@xxxxxxxxxxxxxxxxxxx [mailto:openstack-bounces+david.lyle=hp.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of Wyllys Ingersoll
>> Sent: Wednesday, March 20, 2013 9:50 AM
>> To: openstack@xxxxxxxxxxxxxxxxxxx
>> Subject: [Openstack] register a new panel in overrides.py
>>
>>
>> Can someone give a pointer to how one goes about adding a new panel to an existing panel using overrides.py ?
>>
>> I know my panel is working because if I hardcode it into an existing dashboard.py file, it is found and displayed. I'd prefer to put it in overrides.py instead and am wondering how that would be coded.
>>
>> thanks,
>> Wyllys
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~openstack
>> Post to : openstack@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~openstack
>> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References