Need help to set up a wizard in OpenERP 7.0 - button

I'm trying to implement a wizard that will update a form a then (if possible, send a signal to workflow to change status of an object, but that will be for later). I'm trying and trying, but I'm doing something wrong since I get stuck with this annoying error!
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
I've got these two files inside the "wizard" folder:
reformulate_wizard.py:
from openerp.osv import osv
from openerp.osv import fields
from openerp.tools.translate import _
class ref_generic_request(osv.osv_memory):
_name='ref.generic.request'
_columns = {
'reformulation_info': fields.text('Reformulation instructions', help='Instructions for the requestor justification the reformulation needs'),
}
def save_info(self, cr, uid, ids, context=None):
if 'active_id' in context:
info=self.browse(cr,uid,ids)[0].reformulation_info
self.pool.get('generic.request').write(cr,uid,context['active_id'],
{'reformulation_info' : reformulation_info})
return {
'type': 'ir.actions.act_window_close',
}
ref_generic_request()
reformulate_wizard.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_reformulate_generic_request_wizard" model="ir.ui.view">
<field name="name">reformulate_generic_request_wizard.form</field>
<field name="model">ref.generic.request</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Insert reformulation info" version="7.0">
<group colspan="4" >
<separator string="bla bla bla here" colspan="4"/>
<field name="reformulation_info" string="Reformulation info"/>
<newline/>
</group>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="save_info" string="Send to reformulation" type="object" />
</group>
</form>
</field>
</record>
<record id="action_reformulate_generic_request" model="ir.actions.act_window">
<field name="name">Reformulate Request</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">ref.generic.request</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_reformulate_generic_request_wizard"/>
<field name="target">new</field>
</record>
<act_window id="action_reformulate_generic_request"
name="Reformulate Request"
res_model="generic.request"
view_mode="form"
target="new"
/>
</data>
</openerp>
And I didn't forget the __init__.py with the "import reformulate_wizard" in it.
I am calling the wizard from my xml view like this (and I guess that's where I'm getting the error):
<button name="%(reformulate_generic_request_wizard)d" string="Button that calls wizard" type="object" />
In my base folder I'm importing the wizard folder inside the __init__.py:
import parecer
import pedido_generico
import tracing
import wizard
And here is the content of my __openerp__.py (The error might be from the order I'm loading things):
{
'name': 'Processos UC',
'version': '0.1',
'category': 'Tools',
'description': """
OpenERP Module that implements UC's business processes.""",
'author': 'Filipe Castanheira',
'website': 'http://www.uc.pt',
'depends': ['base','web'],
'demo': [],
'test':[],
#'js': [
# 'static/js/custom.js',
#],
'css': [ 'static/css/uc_css.css' ],
'update_xml' : [
'data/action_server.xml',
'security/security.xml',
'security/processos_uc_domain_rules.xml',
'wizard/reformulate_wizard.xml',
'processos_view.xml',
'parecer_wkf.xml',
'pedido_wkf.xml',
],
'data': [
'security/ir.model.access.csv',
'data/owner_groups.xml',
'data/subject_type.xml',
],
'installable': True,
'images': [],
}
Here is the error message from the server logs.
2014-05-14 16:55:45,182 19742 ERROR may_9 openerp.tools.convert: Parse error in /home/lfc/openerp/v7/addons/processos_uc/processos_view.xml:23:
(...)XML displayed here(...)
Traceback (most recent call last):
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 847, in parse
self._tags[rec.tag](self.cr, rec, n)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 807, in _tag_record
f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 154, in _eval_xml
for n in node]), idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 148, in _process
idref[id]=self.id_get(cr, id)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 824, in id_get
res = self.model_id_get(cr, id_str)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 833, in model_id_get
return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 869, in get_object_reference
data_id = self._get_id(cr, uid, module, xml_id)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 862, in _get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
2014-05-14 16:55:45,186 19742 ERROR may_9 openerp.netsvc: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
Traceback (most recent call last):
File "/opt/openerp/v7/server/openerp/netsvc.py", line 292, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp/v7/server/openerp/service/web_services.py", line 433, in dispatch
return fn(*params)
File "/opt/openerp/v7/server/openerp/service/web_services.py", line 444, in exp_authenticate
res_users = pooler.get_pool(db).get('res.users')
File "/opt/openerp/v7/server/openerp/pooler.py", line 49, in get_pool
return get_db_and_pool(db_name, force_demo, status, update_module)[1]
File "/opt/openerp/v7/server/openerp/pooler.py", line 33, in get_db_and_pool
registry = RegistryManager.get(db_name, force_demo, status, update_module)
File "/opt/openerp/v7/server/openerp/modules/registry.py", line 192, in get
update_module)
File "/opt/openerp/v7/server/openerp/modules/registry.py", line 218, in new
openerp.modules.load_modules(registry.db, force_demo, status, update_module)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 350, in load_modules
force, status, report, loaded_modules, update_module)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 256, in load_marked_modules
loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 187, in load_module_graph
load_update_xml(module_name, idref, mode)
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 74, in <lambda>
load_update_xml = lambda *args: _load_data(cr, *args, kind='update_xml')
File "/opt/openerp/v7/server/openerp/modules/loading.py", line 124, in _load_data
tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 954, in convert_xml_import
obj.parse(doc.getroot())
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 847, in parse
self._tags[rec.tag](self.cr, rec, n)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 807, in _tag_record
f_val = _eval_xml(self,field, self.pool, cr, self.uid, self.idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 154, in _eval_xml
for n in node]), idref)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 148, in _process
idref[id]=self.id_get(cr, id)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 824, in id_get
res = self.model_id_get(cr, id_str)
File "/opt/openerp/v7/server/openerp/tools/convert.py", line 833, in model_id_get
return model_data_obj.get_object_reference(cr, self.uid, mod, id_str)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 869, in get_object_reference
data_id = self._get_id(cr, uid, module, xml_id)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 18, in lookup
r = self.lookup(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/tools/cache.py", line 46, in lookup
value = d[key] = self.method(self2, cr, *args)
File "/opt/openerp/v7/server/openerp/addons/base/ir/ir_model.py", line 862, in _get_id
raise ValueError('No such external ID currently defined in the system: %s.%s' % (module, xml_id))
ValueError: No such external ID currently defined in the system: processos_uc.reformulate_generic_request_wizard
Any help is more than welcome!

The error message is telling you where the trouble is: you're using an id reformulate_generic_request_wizard that isn't declared anywhere.
Your button should point at the action's id, action_reformulate_generic_request_wizard.
So, try this:
<button name="%(action_reformulate_generic_request_wizard)d" string="Button that calls wizard" type="object" />

Related

sqllite argumentError absolute path

I am trying to create a sqlite database using windows and I have an error "ArgumentError: Invalid SQLite URL: sqlite://search.db" What is the absolute path syntax for creating an SQL lite db.
'sqlite://C:/Users..../search.db'
>>> from flaskapp import db
C:\Users\champ\Python_proj\main_env\lib\site-packages\flask_sqlalchemy\__init__.py:833: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning.
warnings.warn(FSADeprecationWarning(
>>> db.create_all()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\flask_sqlalchemy\__init__.py", line 1039, in create_all
self._execute_for_all_tables(app, bind, 'create_all')
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\flask_sqlalchemy\__init__.py", line 1031, in _execute_for_all_tables
op(bind=self.get_engine(app, bind), **extra)
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\flask_sqlalchemy\__init__.py", line 962, in get_engine
return connector.get_engine()
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\flask_sqlalchemy\__init__.py", line 556, in get_engine
self._engine = rv = self._sa.create_engine(sa_url, options)
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\flask_sqlalchemy\__init__.py", line 972, in create_engine
return sqlalchemy.create_engine(sa_url, **engine_opts)
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\sqlalchemy\engine\__init__.py", line 488, in create_engine
return strategy.create(*args, **kwargs)
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\sqlalchemy\engine\strategies.py", line 98, in create
(cargs, cparams) = dialect.create_connect_args(u)
File "C:\Users\champ\Python_proj\main_env\lib\site-packages\sqlalchemy\dialects\sqlite\pysqlite.py", line 466, in create_connect_args
raise exc.ArgumentError(
sqlalchemy.exc.ArgumentError: Invalid SQLite URL: sqlite://search.db
Valid SQLite URL forms are:
sqlite:///:memory: (or, sqlite://)
sqlite:///relative/path/to/file.db
sqlite:////absolute/path/to/file.db

Botocore raising OSError: [errno 14] Bad Address

My Python server is raising random OSError: [errno 14] Bad Address when I use pynamodb Model. This issue is happening in any of my pynamodb Models and is very rare to occur. Most of the calls will be successful.
The error is raised when botocore reads from file /usr/local/lib/python3.7/site-packages/botocore/data/dynamodb/2012-08-10/service-2.json. I have no idea why this happens and why it is random.
I'm using Python 3.7.3, Django 2.2.2, Pynamodb 3.3.3 and Gunicorn 19.9.0. I'm running the server on Docker base python:3.7-slim managed by Kubernetes.
Example:
>>> from pynamodb.models import Model
>>> class User(Model):
... hash = UnicodeAttribute(hash_key=True)
... username = UnicodeAttribute(null=True)
... class Meta:
... table_name = "user"
... read_capacity_units = 10
... write_capacity_units = 10
... region = "us-west-2"
...
>>> user = User.get("valid-user-id")
Traceback (most recent call last):
File "<input>", line 11, in <module>
user = User.get("valid-user-id")
File "pynamodb/models.py", line 485, in get
hash_key, range_key = cls._serialize_keys(hash_key, range_key)
File "pynamodb/models.py", line 1372, in _serialize_keys
hash_key = cls._hash_key_attribute().serialize(hash_key)
File "pynamodb/models.py", line 1219, in _hash_key_attribute
hash_keyname = cls._get_meta_data().hash_keyname
File "pynamodb/models.py", line 1262, in _get_meta_data
cls._meta_table = MetaTable(cls._get_connection().describe_table())
File "pynamodb/connection/table.py", line 263, in describe_table
return self.connection.describe_table(self.table_name)
File "pynamodb/connection/base.py", line 659, in describe_table
tbl = self.get_meta_table(table_name, refresh=True)
File "pynamodb/connection/base.py", line 504, in get_meta_table
data = self.dispatch(DESCRIBE_TABLE, operation_kwargs)
File "pynamodb/connection/base.py", line 313, in dispatch
data = self._make_api_call(operation_name, operation_kwargs)
File "pynamodb/connection/base.py", line 341, in _make_api_call
operation_model = self.client._service_model.operation_model(operation_name)
File "pynamodb/connection/base.py", line 492, in client
self._client = self.session.create_client(SERVICE_NAME, self.region, endpoint_url=self.host)
File "botocore/session.py", line 838, in create_client
client_config=config, api_version=api_version)
File "botocore/client.py", line 79, in create_client
service_model = self._load_service_model(service_name, api_version)
File "botocore/client.py", line 117, in _load_service_model
api_version=api_version)
File "botocore/loaders.py", line 132, in _wrapper
data = func(self, *args, **kwargs)
File "botocore/loaders.py", line 383, in load_service_model
model = self.load_data(full_path)
File "botocore/loaders.py", line 132, in _wrapper
data = func(self, *args, **kwargs)
File "botocore/loaders.py", line 420, in load_data
found = self.file_loader.load_file(possible_path)
File "botocore/loaders.py", line 173, in load_file
payload = fp.read().decode('utf-8')
OSError: [Errno 14] Bad address
UPDATE:
This specific issue was due to a lack of memory in the pods. It happens when I integrate my server with Scout. Other than this issue the rest of the app worked fine, and the error didn't suggest a memory issue. It was fixed after I raise the memory in the pod.

AuthorizationFailed - "The client 'xxx' with object id 'xxx does not have authorization to perform action

I've tried to get Workspace from config which I do have access to, but it fails with the following error:
import azureml.core
print("SDK version:", azureml.core.VERSION)
from azureml.core.workspace import Workspace
ws = Workspace.from_config()
print(ws.name, ws.resource_group, ws.location, ws.subscription_id, sep='\n')
SDK version: 0.1.80 Found the config file in:
C:\Users\gubert\Repos\Gimmonix\HotelMappingAI\aml_config\config.json
get_workspace error using subscription_id=xxxxxxxxxxxxxxxxxxxxxxx,
resource_group_name=xxxxxxxxxxxx, workspace_name=gmx-ml-mapping
Traceback (most recent call last): File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_project_commands.py",
line 320, in get_workspace workspace_name) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_base_sdk_common\workspace\operations\workspaces_operations.py",
line 78, in get raise
models.ErrorResponseWrapperException(self._deserialize, response)
azureml._base_sdk_common.workspace.models.error_response_wrapper.ErrorResponseWrapperException:
Operation returned an invalid status code 'Forbidden'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd_launcher.py",
line 38, in main(sys.argv) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_main_.py",
line 265, in main wait=args.wait) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_main_.py",
line 256, in handle_args run_main(addr, name, kind, *extra, **kwargs)
File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_local.py",
line 52, in run_main runner(addr, name, kind == 'module', *extra,
**kwargs) File "c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd\runner.py",
line 32, in run set_trace=False) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd\pydevd.py",
line 1283, in run return self._exec(is_module, entry_point_fn,
module_name, file, globals, locals) File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd\pydevd.py",
line 1290, in _exec pydev_imports.execfile(file, globals, locals) #
execute the script File
"c:\Users\gubert.vscode\extensions\ms-python.python-2018.10.1\pythonFiles\experimental\ptvsd\ptvsd_vendored\pydevd_pydev_imps_pydev_execfile.py",
line 25, in execfile exec(compile(contents+"\n", file, 'exec'), glob,
loc) File "c:\Users\gubert\Repos\Gimmonix\HotelMappingAI\test.py",
line 8, in ws = Workspace.from_config() File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml\core\workspace.py",
line 153, in from_config auth=auth) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml\core\workspace.py",
line 86, in init auto_rest_workspace = _commands.get_workspace(auth,
subscription_id, resource_group, workspace_name) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_project_commands.py",
line 326, in get_workspace resource_error_handling(response_exception,
WORKSPACE) File
"C:\Users\gubert.azureml\envs\myenv\lib\site-packages\azureml_base_sdk_common\common.py",
line 270, in resource_error_handling raise
ProjectSystemException(response_message)
azureml.exceptions._azureml_exception.ProjectSystemException: {
"error_details": { "error": { "code": "AuthorizationFailed",
"message": "The client 'xxxxxxxxxx#microsoft.com' with object id
'xxxxxxxxxxxxx' does not have authorization to perform action
'Microsoft.MachineLearningServices/workspaces/read' over scope
'/subscriptions/xxxxxxxxxxxxxx/resourceGroups/CarsolizeCloud - Test
Global/providers/Microsoft.MachineLearningServices/workspaces/gmx-ml-mapping'."
} }, "status_code": 403, "url":
"https://management.azure.com/subscriptions/xxxxxxxxxxxxx/resourceGroups/CarsolizeCloud%20-%20Test%20Global/providers/Microsoft.MachineLearningServices/workspaces/gmx-ml-mapping?api-version=2018-03-01-preview"
}
Try using the newest SDK version 1.0.10, this is a fairly old preview version you're using. If you still have a problem, let me know as I work on this SDK.

Traceback when viewing ##personal-information page after following collective.userdata.examples Plone 4

I have been following collective.examples.userdata in a Plone 4 site in an attempt to add more fields to the /##personal-information page.
I am looking to add the following fields (all will be text string fields):
Position
Facebook
Twitter
LinkedIn
I have decided to just try and get the "Position" field working first and have successfully installed and activated my add-on without any trouble.
I do however get this traceback when I go to mysite.com/##personal-preferences:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module zope.formlib.form, line 795, in __call__
Module five.formlib.formbase, line 50, in update
Module zope.formlib.form, line 758, in update
Module plone.fieldsets.form, line 30, in setUpWidgets
Module zope.formlib.form, line 383, in setUpEditWidgets
TypeError: ('Could not adapt', <PloneSite at /peacehospice>, <InterfaceClass
kcs.userdata.userdataschema.IEnhancedUserDataSchema>)
My add-on structure is as follows:
kcs.userdata
|
--kcs
|
--__init.py__
--userdata
|
--adapter.py
--configure.zcml
--__init__.py
--tests.py
--userdataschema.py
--profiles
|
--default
|
--componentregistry.xml
--metadata_properties.xml
--propertiestool.xml
The kcs.userdata folder is sitting in my src folder located inside of my instance folder.
I have plone.app.users included in my buildout under the eggs section
Below are the contents of my files:
Location: kcs.userdata/setup.py
from setuptools import setup, find_packages
import os
version = '1.0'
setup(name='kcs.userdata',
version=version,
description="",
long_description=open("README.txt").read() + "\n" +
open(os.path.join("docs", "HISTORY.txt")).read(),
# Get more strings from
# http://pypi.python.org/pypi?:action=list_classifiers
classifiers=[
"Framework :: Plone",
"Programming Language :: Python",
],
keywords='',
author='',
author_email='',
url='http://svn.plone.org/svn/collective/',
license='GPL',
packages=find_packages(exclude=['ez_setup']),
namespace_packages=['kcs'],
include_package_data=True,
zip_safe=False,
install_requires=[
'setuptools',
'plone.app.users >= 1.0b7',
],
entry_points="""
# -*- Entry points: -*-
[z3c.autoinclude.plugin]
target = plone
""",
setup_requires=["PasteScript"],
paster_plugins=["ZopeSkel"],
)
Location: kcs.userdata/kcs/userdata/adapter.py
from plone.app.users.browser.personalpreferences import UserDataPanelAdapter
class EnhancedUserDataPanelAdapter(UserDataPanelAdapter):
def get_position(self):
return self.context.getProperty('position','')
def set_position(self, value):
return self.context.setMemberProperties({'position': value})
position = property(get_position, set_position)
Location: kcs.userdata/kcs/userdata/configure.zcml:
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:five="http://namespaces.zope.org/five"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="kcs.userdata">
<five:registerPackage package="." initialize=".initialize" />
<genericsetup:registerProfile
name="default"
title="KCS User Data"
directory="profiles/default"
description='Adds position field to user data'
provides="Products.GenericSetup.interfaces.EXTENSION"
/>
</configure>
Location: kcs.userdata/kcs/userdata/init.py
from zope.i18nmessageid import MessageFactory
_ = MessageFactory("kcs.userdata")
def initialize(context):
"""Initializer called when used as a Zope 2 product."""
Location: kcs.userdata/kcs/userdata/userdataschema.py
from zope.interface import Interface, implements
from zope import schema
from kcs.userdata import _
from plone.app.users.userdataschema import IUserDataSchemaProvider
from plone.app.users.userdataschema import IUserDataSchema
def validateAccept(value):
if not value == True:
return False
return True
class UserDataSchemaProvider(object):
implements(IUserDataSchemaProvider)
def getSchema(self):
return IEnhancedUserDataSchema
class IEnhancedUserDataSchema(IUserDataSchema):
position = schema.TextLine(
title=_(u'label_position', default=u'Position'),
description=_(u'help_position', default=u"Fill in your position in the company"),
required=False,
)
Location: kcs.userdata/kcs/userdata/profiles/default/componentregistry.xml
<?xml version="1.0"?>
<componentregistry>
<utilities>
<utility
interface="plone.app.users.userdataschema.IUserDataSchemaProvider"
factory="kcs.userdata.userdataschema.UserDataSchemaProvider"
/>
</utilities>
</componentregistry>
Location: kcs.userdata/kcs/userdata/profiles/default/metadata_properties.xml
<?xml version="1.0"?>
<object name="portal_memberdata" meta_type="Plone Memberdata Tool">
<property name="position" type="string"></property>
</object>
Location: kcs.userdata/kcs/userdata/profiles/default/propertiestool.xml
<?xml version="1.0"?>
<object name="portal_properties" meta_type="Plone Properties Tool">
<object name="site_properties" meta_type="Plone Property Sheet">
<property name="user_registration_fields" type="lines">
<element value="position" />
</property>
</object>
</object>
TL;DR
Made a custom add-on using the collective.examples.userdata example, when trying to view mysite.com/##personal-information I receive the following traceback:
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module zope.formlib.form, line 795, in __call__
Module five.formlib.formbase, line 50, in update
Module zope.formlib.form, line 758, in update
Module plone.fieldsets.form, line 30, in setUpWidgets
Module zope.formlib.form, line 383, in setUpEditWidgets
TypeError: ('Could not adapt', <PloneSite at /peacehospice>, <InterfaceClass
kcs.userdata.userdataschema.IEnhancedUserDataSchema>)
Can anyone lend any insight as to what it is trying to tell me?
You are missing a overrides.zcml, registering your adapter override:
<adapter
provides=".userdataschema.IEnhancedUserDataSchema"
for="Products.CMFCore.interfaces.ISiteRoot"
factory=".adapter.EnhancedUserDataPanelAdapter"
/>
You can also register a local+to-your-plonesite persistent utility like in see link

sqlalchemy Sqlite not loading table rows

I'm using sqlite with sqlalchemy:
when I execute this command:
engine.execute("select * from teams");
<sqlalchemy.engine.base.ResultProxy object at 0x245b190>
Thus, it works as it returns a reference
I've a .py file which contain the class Team:
class Team(Base):
__tablename__ = 'teams'
id = Column(Integer,autoincrement=False, primary_key=True)
name = Column(String(255))
flag = Column(String(255))
url = Column(String(255))
I import Team from classes import
But when I try to use the ORM, i get the following error:
for instance in session.query(Team):
... print instance.id
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/orm/query.py", line 2224, in __iter__
return self._execute_and_instances(context)
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/orm/query.py", line 2239, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/engine/base.py", line 1450, in execute
params)
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/engine/base.py", line 1583, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/engine/base.py", line 1697, in _execute_context
context)
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/engine/base.py", line 1690, in _execute_context
context)
File "/usr/lib/python2.7/site-packages/SQLAlchemy-0.7.7-py2.7.egg/sqlalchemy/engine/default.py", line 331, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (OperationalError) no such table: teams u'SELECT teams.id AS teams_id, teams.name AS teams_name, teams.flag AS teams_flag, teams.url AS teams_url \nFROM teams' ()
It says it can't find the table teams- confirm with SqlLite ( I use firefox plugin) that it exists and that is the name. Also, copy the SQL in the error message in a Sqlite window and see if it runs.

Resources