How can I avoid Flask-Admin 2.1 warning "UserWarning: Fields missing from ruleset"? - flask-admin

I'm using Flask-Admin 2.1 with Python 2.7.6.
One of my Flask-Admin model classes inherits from flask.ext.admin.contrib.sqla.ModelView and overrides form_rules.
When I run my application, this warning is displayed: "UserWarning: Fields missing from ruleset"
The warning is accurate: There are fields in my model that are not included in the ruleset. But that's by design. I don't want those fields to be displayed when users create or edit instances of this model.
I have already read this: https://github.com/flask-admin/flask-admin/pull/815#issuecomment-81963865
How can I suppress the warning?

You can suppress the warning when the view is added by using this snippet with the assumed name UserView:
import warnings
with warnings.catch_warnings():
warnings.filterwarnings('ignore', 'Fields missing from ruleset', UserWarning)
admin.add_view(UserView())
Reference: https://docs.python.org/2/library/warnings.html#warnings.filterwarnings

Related

React hook form dynamic fields validations

My task is to implant a functionality that includes dynamically creation of fields and apply validation on those dynamically created fields.
I have found a prefect example that fits my use case which is here (https://stackblitz.com/edit/react-hook-form-dynamic-form-example) but the issue that I am facing is every time I try to download the example from stackblitz and run locally I get error below error:
{"tickets":{"message":"tickets must be a `array` type, but the final value was: `null` (cast from the value `{\n \"0name\": \"\\\"\\\"\",\n \"0email\": \"\\\"\\\"\",\n \"1name\": \"\\\"\\\"\",\n \"1email\": \"\\\"\\\"\"\n}`).\n If \"null\" is intended as an empty value be sure to mark the schema as `.nullable()`","type":"typeError"}}
I am wondering if someone could help me run this example locally, rest I can work out.
Many thanks :)

fox:alt-text not allowed to appear in element 'fo:external-graphic'."

I'm trying to add the alternate text into my images just as the Apache FOP documentation instructs: By using fox-alt:-text.
<fo:external-graphic src="logo.gif" content-width="75%" content-height="75%" fox:alt-text="My company logo"/>
I'm using Apache FOP version 2.5 and accessibility is ON (setted true in fop.xconf). For some reason I'm getting an error message saying
org.xml.sax.SAXParseException:cvc-complex-type.3.2.2: Attribute 'fox:alt-text' is not allowed to appear in element 'fo:external-graphic'.
Any ideas on what might be wrong?
I now realized that the problem is not in Apache FOP but it's in my code. Our system is doing some additional schema validation (javax.xml.validation.Validator) against the plain fo schema and doesn't see the fox extension.
fox:alt-text is not a part of the original fo schema's fo:external-graphic definition and is causing validation failures.

0x80048470 - Importing CRM Solution

I am trying to import an unmanaged solution but for some reason I am getting the following error:
Failure: 0x80048470 - The entity relationship role of the referencing entity is required when creating a new one-to-many entity relationship business_unit_new_contract.
It's interesting because I've opened the costumizations.xml and the relationship is there. Also, when I look up at the exported solution entity that has the relationship, the relationship is also displayed.
At first, I was receiving an 0x8004803A error as shown:
Failure: 0x8004803A - The import has failed because component of type 50 is not declared in the solution file as a root component. To fix this, import again using the XML file that was generated when you exported the solution.
So, I opened the solution.xml and added a new for that particular type, which was not in the file.
Has anyone ever experienced that? Also, This relationship shown is between businessunit and one of my entities.
Is there any way of fixing it through database? What would be the best solution?
Thanks in advance,
Dem
I'll just try to explain your second problem (0x8004803A), since it happened to me today.
By the way, this was one of the few times when 'Download log' was actually helpful (it contained the real error).
The import has failed because component of type 50 is not declared in the solution file as a root component.
Entity type code 50 apparently stands for (global) Application Ribbon. This can happen when manually adding the <RibbonXmlDiff /> section to customizations.xml. If this happens it is enough to add following line to solution.xml:
<RootComponents>
...
<RootComponent type="50" schemaName=":RibbonDiffXml" />
</RootComponents>

Typo3 Tree Import fail

I'm using Typo3 6.2 and I want move my Projekt to another Computer with Typo3 6.2 but I'm failing to import the tree structure ...
When I'm import a single page it works but when if the page has a subpages it doesnt work.
After I uploading a receive this Error:
"Possible error: pages:15 had no new id assigned to it. This indicates that the record was not added to database during import. Please check changelog!"
Here is the import file, maybe it just doesnt work on my system...
File leist.t3d
means
I had this error, too.
In my case, I got an error message after enabling error messages, it was a missing field in table "pages", after a "DB compare", the import worked.
Not sure, but is sounds like a known bug:
https://forge.typo3.org/issues/59055
Or more specific (copy pasted from that bug):
When I change uniqid('NEW'); to uniqid('NEW', TRUE); in class
ImportExport the functional tests aren't failing and I assume
introduction extension is imported correctly (no errors in typo3.log).
(again not totally certain) but you might wanna patch it for testing or fetching a patched source for
/typo3/sysext/impexp/Classes/ImportExport.php

Magento - Error after disabling modules

I've disabled the Rss and Newsletter modules of my Magento 1.7 instance following the instructions of this post:
http://inchoo.net/ecommerce/magento/how-to-fully-disable-turn-off-magento-module/comment-page-1/#comment-65853
I just edited the app\etc\modules\Mage_All.xml file by changing to <active>false</active> in both Mage_Rss and Mage_Newsletter modules.
The problem is that when I try to load a customer page through admin panel, I get the following error:
Fatal error: Call to a member function loadByCustomer() on a
non-object in app\code\core\Mage\Newsletter\Model\Subscriber.php on
line 267
Why is it happening? Why is this code being executing even though I've disabled such module?
Thanks!
First step after disabling a module through its <active> entry. Always clear cache and if you use the compiler, recompile so you don't have code referencing classes in the disabled module.
Often the problem is not with code executing after the module is shut off through the app/etc/modules/mod_name.xml by setting <active> to false, but with other modules, templates or layouts attempting to call code in the disabled module.
Where issues come in are if another module lists the module just turned off in its dependency list. Always check all the other module xml files dependency lists for mention of the module you are deactivating.
Also, you have to check for template .phtml files that reference classes in the disabled module. This can throw the dreaded call to a non-object type exception errors. As an example, one module that provides custom cart attributes asks you to add entries to your cart templates. Shutting off the module does not get rid of the references.
Make sure no layouts are attempting to load anything referencing this module as well (custom layout local.xml).
You also might want to go to System Config, Advanced and shut the Newsletter module output off there in case the Magento Customer Account is depending on testing for the module being disabled by calling that entry instead of actually checking to see if the Module is loaded. Sometimes Magento programmers forget to do proper error trapping, which has thrown me for a loop before.
I believe I could solve the problem (not sure if generated any side effect):
Just edited the file app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tabs.php around line 90 by adding the external if clause:
if (Mage::helper('core')->isModuleEnabled('Mage_Newsletter')) {
if (Mage::getSingleton('admin/session')->isAllowed('newsletter/subscriber')) {
$this->addTab('newsletter', array(
'label' => Mage::helper('customer')->__('Newsletter'),
'content' => $this->getLayout()->createBlock('adminhtml/customer_edit_tab_newsletter')->initForm()->toHtml()
));
}
}
+1 if I saved your day and please let me know if you noticed and possible impact :D