Error while rendering collective.carousel portlet - plone

I've installed collective carousel 1.5 (note: I was using 1.6 and got the same error, was hoping it was a regression bug or something) on Plone 4.3.1.
I then create a carousel portlet associated with a collection on the site.
When I go to pages that contain the portlet I get the following error:
KeyError: 'carousel-portlet-view'
Here's the traceback:
- URL: /usr/local/share/plone/buildout-cache/eggs/collective.carousel-1.5-py2.7.egg/collective/carousel/po
rtlets/carousel.pt
- Line 44, Column 28
- Expression: <PythonExpr (view.get_tile(item_object))>
- Names:
{'args': (),
'container': <Collection at /mysite/aggregator>,
'context': <Collection at /mysite/aggregator>,
'default': <object object at 0x7fb332672b40>,
'here': <Collection at /mysite/aggregator>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x86704c8>,
'request': <HTTPRequest, URL=http://mysite.com/aggregator/folder_summary_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x69f4610>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <collective.carousel.portlets.carousel.Renderer object at 0x8671d50>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x86742d0>}
Module zope.tales.pythonexpr, line 59, in __call__
- __traceback_info__: (view.get_tile(item_object))
Module <string>, line 1, in <module>
Module collective.carousel.portlets.carousel, line 177, in get_tile
Module OFS.Traversable, line 300, in unrestrictedTraverse
- __traceback_info__: ([], 'carousel-portlet-view')
KeyError: 'carousel-portlet-view'

looking at the views registered for the name carousel-portelt-view in the source code
https://github.com/collective/collective.carousel/blob/master/collective/carousel/browser/configure.zcml one can see that those are all archetypes specific.
given the information of your comment that you're using dexterity i suppose you need to register a view for your dexterity content types.

Related

ModuleNotFoundError: No module named 'kivymd.stiffscroll'

Possible solution:
Some suggest that this problem happens because the kivymd I installed is only on the terminal and not on my IDE (Pycharm)'s Python Interpreter. I'm not so sure about this because first, I pip install kivymd on my terminal and manually added the kivy package onto my IDE's Python interpreter. And because second, my IDE Python interpreter is at "/Desktop/CoinSnack4/venv/bin/python" and my kivymd is installed at "/Users/kienletrung/Desktop/CoinSnack4/venv" on my terminal (I found this by typing "echo $VIRTUAL_ENV" into the terminal).
Also, my program, when run with the IDE, runs fine. The error below only happens when I open the .exe file of it...
Hi please anyone could help with this my exe file is throwing up this error:
The answer in this Stackoverflow (No module named kivymd.effects when using pyinstaller)didn't work for me...
[INFO ] [Logger ] Record log in /Users/kienletrung/.kivy/logs/kivy_22-01-18_0.txt
[INFO ] [Kivy ] v2.0.0
[INFO ] [Kivy ] Installed at "/var/folders/g4/1xyrvs4j721f0tlsddrbxch00000gn/T/_MEI2YvYUa/kivy/__init__.pyc"
[INFO ] [Python ] v3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53)
[Clang 6.0 (clang-600.0.57)]
[INFO ] [Python ] Interpreter at "/Users/kienletrung/Desktop/CoinSnack4/dist/financiaz"
[INFO ] [Factory ] 186 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_imageio, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [KivyMD ] 0.104.2.dev0 (installed at "/var/folders/g4/1xyrvs4j721f0tlsddrbxch00000gn/T/_MEI2YvYUa/kivymd/__init__.pyc")
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [GL ] Using the "OpenGL ES 2" graphics system
[INFO ] [GL ] Backend used <sdl2>
[INFO ] [GL ] OpenGL version <b'2.1 INTEL-14.7.18'>
[INFO ] [GL ] OpenGL vendor <b'Intel Inc.'>
[INFO ] [GL ] OpenGL renderer <b'Intel(R) HD Graphics 6000'>
[INFO ] [GL ] OpenGL parsed version: 2, 1
[INFO ] [GL ] Shading version <b'1.20'>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <16>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[ERROR ]
Traceback (most recent call last):
File "kivy/lang/parser.py", line 472, in execute_directives
ModuleNotFoundError: No module named 'kivymd.stiffscroll'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "kivy/lang/parser.py", line 474, in execute_directives
ModuleNotFoundError: No module named 'kivymd.stiffscroll'
Traceback (most recent call last):
File "kivy/lang/parser.py", line 472, in execute_directives
ModuleNotFoundError: No module named 'kivymd.stiffscroll'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "kivy/lang/parser.py", line 474, in execute_directives
ModuleNotFoundError: No module named 'kivymd.stiffscroll'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 24, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller/loader/pyimod03_importers.py", line 540, in exec_module
File "kivymd/uix/datatables.py", line 54, in <module>
File "kivy/lang/builder.py", line 373, in load_string
File "kivy/lang/parser.py", line 402, in __init__
File "kivy/lang/parser.py", line 508, in parse
File "kivy/lang/parser.py", line 483, in execute_directives
kivy.lang.parser.ParserException: Parser: File "<inline>", line 3:
...
1:
2:#:import DEVICE_TYPE kivymd.material_resources.DEVICE_TYPE
>> 3:#:import StiffScrollEffect kivymd.stiffscroll.StiffScrollEffect
4:
5:
...
Unable to import package 'kivymd.stiffscroll.StiffScrollEffect'
[8390] Failed to execute script main
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
It seems that the error happens all because the database.py file in kivymd/uix/database.py can't make the code "#:import StiffScrollEffect kivymd.stiffscroll.StiffScrollEffect" works for some reason!
If it helps, this my spec file:
# -*- mode: python ; coding: utf-8 -*-
from kivymd import hooks_path as kivymd_hooks_path
block_cipher = None
#changes the '/Users/kienletrung/Desktop/CoinSnack_MiniIA/main.py' below to the
#path to the python python file of the whole project. change the #'/Users/kienletrung/Desktop/CoinSnack_MiniIA' below to the folder that holds the previous python file.
a = Analysis(['/Users/kienletrung/Desktop/FinanciazIA/main.py'],
pathex=['/Users/kienletrung/Desktop/FinanciazIA'],
binaries=[],
datas=[],
hiddenimports=["kivymd"],
hookspath=[kivymd_hooks_path],
runtime_hooks=[],
excludes=['_tkinter', 'Tkinter', 'enchant', 'twisted'],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
#adds other files that are not the main python file with the way below: (needs to change the #'/Users/kienletrung/Desktop/CoinSnack_MiniIA/main.kv' to the appropriate path to the file)
a.datas += [('main.kv', '/Users/kienletrung/Desktop/FinanciazIA/main.kv', 'DATA'), ('Financiaz.png', '/Users/kienletrung/Desktop/FinanciazIA/Financiaz.png', 'DATA')]
#needs to change '/Users/kienletrung/Desktop/CoinSnack_MiniIA' to the path that holds the data that I add in the above line. change the "coinsnack" name to appropriate app name.
exe = EXE(pyz, Tree('/Users/kienletrung/Desktop/FinanciazIA', 'Data'),
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='financiaz',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False )
app = BUNDLE(exe,
name='financiaz.app',
icon=None,
bundle_identifier=None)
I tried days and days but I still couldn't solve this problem... I would be forever grateful if you could help me.
Thank you so much!
pip uninstall kivymd
pip install https://github.com/kivymd/KivyMD/archive/master.zip

How to expose spring tag lib to Freemaker configuration using java and to process Freemarker Template class?

I have been trying to use freemarker.template.Template class to process a given .ftl template. Basiclaly it is not finding the spring tag libs and fails when it encounters the first <#spring.url.../> tag. However, it reads spring macro directives just fine.
Attaching my freemarker config in spring and the error message:
I am using spring 4, with freemarker 2.3.23. While running my Spring MVC application on tomcat 7, it complains about following:
---- FTL stack trace ("~" means nesting-related):
- Failed at: #spring.url "/imports/app/vendor/boot... [in template "config/pages/default-page.ftl" at line 5, column 54]
----] with root cause FreeMarker template error: The following has evaluated to null or missing:
==> spring [in template "config/pages/default-page.ftl" at line 5, column 56]
Java stack trace (for programmers):
---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at
freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:131)
at
freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:77)
at
freemarker.core.UnexpectedTypeException.(UnexpectedTypeException.java:40)
at freemarker.core.NonHashException.(NonHashException.java:46)
at freemarker.core.Dot._eval(Dot.java:45) at
freemarker.core.Expression.eval(Expression.java:78) at
freemarker.core.UnifiedCall.accept(UnifiedCall.java:74) at
freemarker.core.Environment.visit(Environment.java:324) at
freemarker.core.MixedContent.accept(MixedContent.java:54) at
freemarker.core.Environment.visit(Environment.java:324) at
freemarker.core.Environment.process(Environment.java:302) at
freemarker.template.Template.process(Template.java:325) at
com.isys.ghp.server.services.web.impls.HtmlRenditionComposer.composeRendition(HtmlRenditionComposer.java:43)
at
com.isys.ghp.controllers.app.RootControllerApp.welcome(RootControllerApp.java:48)
at
com.isys.ghp.controllers.app.RootControllerApp$$FastClassBySpringCGLIB$$cebaa583.invoke()
at
org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at
org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at
org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at
com.isys.ghp.server.aspects.MethodLogger.around(MethodLogger.java:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at
org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at
org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
at
org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at
org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653)
at
com.isys.ghp.controllers.app.RootControllerApp$$EnhancerBySpringCGLIB$$55180b14.welcome()
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at
org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
at
org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:96)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at
org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at
org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
at
org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
at
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Code of MVCConfiguration extends WebMvcConfigurerAdapter
#Bean
public FreeMarkerViewResolver freemarkerViewResolver() {
LOGGER.debug("Executing freemarkerViewResolver()");
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
resolver.setExposeSpringMacroHelpers(true);
resolver.setExposeRequestAttributes(true);
resolver.setCache(true);
resolver.setPrefix("");
resolver.setSuffix(".ftl");
return resolver;
}
#Bean(name="fmAdvanceConfigFactoryBean")
public FreeMarkerConfigurer getFreemarkerConfig() throws IOException, TemplateException {
FreeMarkerConfigurationFactoryBean freeMarkerConfigurationFactoryBean = new FreeMarkerConfigurationFactoryBean();
FreeMarkerConfigurer result = new FreeMarkerConfigurer();
result.setTemplateLoaderPath("/WEB-INF/views");
result.setConfiguration(freeMarkerConfigurationFactoryBean.createConfiguration());
return result;
}
Template processing block:
Template pageHTML = fmAdvanceConfigFactoryBean.getTemplate("config/pages/default-page.ftl");
StringWriter pageWriter = new StringWriter();
Map<String, Object> map = new HashMap<>();
pageHTML.process(map, pageWriter);
I have been looking a lot of pages providing advance configuration but none of them is able to resolve this. I am not sure what I am missing here. Any help will be useful and appreciated!
Thanks!
Update: You were right, ddekany! Like you suggested, there was another method in different config file. I have commented that method and checked there is no other point of call. However, now its complaining about not finding the template. See my answer below. You were right. There was another method in different config file. I have commented that method and checked there is no other point of call. However, now its complaining about not finding the template:
freemarker.template.TemplateNotFoundException: Template not found for
name "/config/pages/default-page.ftl". The name was interpreted by
this TemplateLoader:
LegacyDefaultFileTemplateLoader(baseDir="/Users/mdani/Data_MD/Developer_MD/Workspace/Tools/GH-Platform/STS.app/Contents/MacOS",
canonicalBasePath="/Users/mdani/Data_MD/Developer_MD/Workspace/Tools/GH-Platform/STS.app/Contents/MacOS/").
Warning: The "template_loader" FreeMarker setting wasn't set
(Configuration.setTemplateLoader), and using the default value is most
certainly not intended and dangerous, and can be the cause of this
error. at
freemarker.template.Configuration.getTemplate(Configuration.java:2701)
at
freemarker.template.Configuration.getTemplate(Configuration.java:2503)
Simplified class:
#Loggable
#Bean(name="fmAdvanceConfigFactoryBean")
public FreeMarkerConfigurer getFreemarkerConfig() throws IOException, TemplateException {
Properties settings = new Properties();
settings.setProperty("auto_import", "/spring.ftl as spring");
FreeMarkerConfigurer result = new FreeMarkerConfigurer();
result.setTemplateLoaderPaths("/WEB-INF/views","classpath:/");
result.setFreemarkerSettings(settings);
return result;
}
New Error:
SEVERE: Servlet.service() for servlet [dispatcher] in context with
path [/GHPWebApp] threw exception [Request processing failed; nested
exception is freemarker.core.InvalidReferenceException: The following
has evaluated to null or missing:
==> springMacroRequestContext [in template "spring.ftl" at line 89, column 134]
---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default
value like myOptionalVar!myDefault, or use <#if
myOptionalVar??>when-present<#else>when-missing. (These only
cover the last step of the expression; to cover the whole expression,
use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
---- FTL stack trace ("~" means nesting-related):
- Failed at: ${springMacroRequestContext.getContex... [in template "spring.ftl" in macro "url" at line 89, column 132]
- Reached through: #spring.url "/imports/app/vendor/boot... [in template "config/pages/default-page.ftl" at line 4, column 54]
----] with root cause FreeMarker template error: The following has evaluated to null or missing:
==> springMacroRequestContext [in template "spring.ftl" at line 89, column 134]
---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default
value like myOptionalVar!myDefault, or use <#if
myOptionalVar??>when-present<#else>when-missing. (These only
cover the last step of the expression; to cover the whole expression,
use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
---- FTL stack trace ("~" means nesting-related):
- Failed at: ${springMacroRequestContext.getContex... [in template "spring.ftl" in macro "url" at line 89, column 132]
- Reached through: #spring.url "/imports/app/vendor/boot... [in template "config/pages/default-page.ftl" at line 4, column 54]
Java stack trace (for programmers):
---- freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at
freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
at
freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:85)
at
freemarker.core.UnexpectedTypeException.(UnexpectedTypeException.java:48)
at freemarker.core.NonHashException.(NonHashException.java:49)
I guess the spring variable is missing because your template doesn't start with <#import "/spring.ftl" as spring>, nor you have configured an auto-import for that. The last is the more convenient way. Something like Properties settings = new Properties(); settings.setProperty("auto_import", "/spring.ftl as spring"); configurer.setFreemarkerSettings(settings);.
(BTW, upgrade FreeMarker to the latest 2.x.x... 2.3.23 is old.)

(Static) Portlet of group: error while rendering

I've created a static portlet to AuthenticatedUsers group and get this error on page load: There was an error while rendering the portlet. Others types portlets generates no error
client1/Event.log:
2016-06-02T16:43:35 ERROR Zope.SiteErrorLog 1464896615.090.768319144619 <site>/front-page/document_view
Traceback (innermost last):
Module Products.PloneFormGen.patches, line 21, in safe_render
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 132, in pt_render
Module zope.pagetemplate.pagetemplate, line 240, in __call__
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 852, in do_condition
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: /usr/local/Plone/buildout-cache/eggs/plone.portlet.static-2.0.3-py2.7.egg/plone/portlet/static/static.pt
- Line 1, Column 0
- Expression: <PathExpr standard:u'view/transformed'>
- Names:
{'args': (),
'container': <ATDocument at /eleitoral/front-page>,
'context': <ATDocument at /eleitoral/front-page>,
'default': <object object at 0x7fc7329c4500>,
'here': <ATDocument at /eleitoral/front-page>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0x7fc71a6777e0>,
'request': <HTTPRequest, URL=<site>/front-page/document_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0x7fc723f6d390>,
'traverse_subpath': [],
'user': <PloneUser 'lhmp1967'>,
'view': <plone.portlet.static.static.Renderer object at 0x7fc71b031690>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0x7fc71a67c790>}
Module zope.tales.expressions, line 217, in __call__
Module Products.PageTemplates.Expressions, line 155, in _eval
Module Products.PageTemplates.Expressions, line 117, in render
Module plone.portlet.static.static, line 137, in transformed
Module OFS.Traversable, line 317, in restrictedTraverse
Module OFS.Traversable, line 285, in unrestrictedTraverse
- __traceback_info__: ([], 'AuthenticatedUsers')
AttributeError: AuthenticatedUsers
The plone.portlet.static Version 2.0.3 indicates you're using Plone 4.3.4, since Plone 4.3.3 has plone.portlet.static Version 2.0.2 and Plone 4.3.5 has plone.portlet.static Version 2.0.4.
The next Bugfix release of plone.portlet.static (2.0.4)fixes your Problem.
Check: https://github.com/plone/plone.portlet.static/commit/089012f2e4d7cf911c1361a3b0de334b3f1145c2
The portlet assignment context has been fixed for other categories than context portlets.
You may upgrade only the portlet to Version 2.0.4, or the whole site at least to Plone 4.3.5.

FosElasticaBundle: How to search using multiple keywords?

this is working for me ok: $results = $finder->find('muj*');
but when I try $results = $finder->find(array('muj*', 'hom*)); I get this:
SearchPhaseExecutionException[Failed to execute phase [query], all
shards failed; shardFailures {[qTMnzJeGTu-YVumR2xLW1Q][search]1:
RemoteTransportException[[Starshine][inet[/192.168.1.83:9302]][search/phase/query]];
nested: SearchParseException[search: from[-1],size[-1]: Parse
Failure [Failed to parse source
[{"0":"muj*","1":"hom*","query":{"match_all":{}}}]]]; nested:
SearchParseException[search: from[-1],size[-1]: Parse Failure [No
parser for element [0]]]; }{[LgfD_idnTtmv3JHcMPnkmw][search][0]:
SearchParseException[[search][0]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"0":"muj*","1":"hom*","query":{"match_all":{}}}]]]; nested:
SearchParseException[[search][0]: from[-1],size[-1]: Parse Failure [No
parser for element [0]]]; }{[vpaWi0XRT8eo7UYtgFFsag][search][3]:
RemoteTransportException[[Clint
Barton][inet[/192.168.1.83:9301]][search/phase/query]]; nested:
SearchParseException[[search][3]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"0":"muj*","1":"hom*","query":{"match_all":{}}}]]]; nested:
SearchParseException[[search][3]: from[-1],size[-1]: Parse Failure [No
parser for element [0]]]; }{[LgfD_idnTtmv3JHcMPnkmw][search][2]:
SearchParseException[[search][2]: from[-1],size[-1]: Parse Failure
[Failed to parse source
[{"0":"muj*","1":"hom*","query":{"match_all":{}}}]]]; nested:
SearchParseException[[search][2]: from[-1],size[-1]: Parse Failure [No
parser for element [0]]]; }{[qTMnzJeGTu-YVumR2xLW1Q][search][4]:
RemoteTransportException[[Starshine][inet[/192.168.1.83:9302]][search/phase/query]];
nested: SearchParseException[[search][4]: from[-1],size[-1]: Parse
Failure [Failed to parse source
[{"0":"muj*","1":"hom*","query":{"match_all":{}}}]]]; nested:
SearchParseException[[search][4]: from[-1],size[-1]: Parse Failure [No
parser for element [0]]]; }]
For me it is strange since the docs say that find() admits an array as parameter.

Creating a Plone 4 custom portlet manager

I am trying to create a custom portlet manager to my theme's footer by following tutorials from Plone.org and WebLion.
What I am trying to do is adding a viewlet manager and a viewlet, that should be functioning as the portlet manager, into my theme.
I am getting a ContentProviderLookupError for the viewlet that is supposed to work as my portlet manager when the viewlet's template has a TAL-block in it. The viewletmanager and viewlet template is shown correctly on the page as far as I can tell if I omit the TAL-block.
The theme is done using the sane_plone_addon_template from here
I really cant see what I am doing wrong here and being a complete noob when it comes to Plone really doesn't help, so any ideas to nudge me in the right direction would really be appreciated.
Heres my configure.zcml
<browser:viewletManager
name="footerPortlets1"
provides=".interfaces.IspFooterPortletsViewletManager"
class="plone.app.viewletmanager.manager.OrderedViewletManager"
layer=".interfaces.IThemeSpecific"
permission="zope2.View"
/>
<browser:viewlet
name="footerPortlets"
manager=".interfaces.IspFooterPortletsViewletManager"
template="templates/footerPortlets.pt"
layer=".interfaces.IThemeSpecific"
permission="zope2.View"
/>
portlets.xml in profiles/default/
<?xml version="1.0"?>
<portlets
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<portletmanager
name="footerPortlets"
type="mytheme.interfaces.IFooterPortlets"
/>
</portlets>
interfaces.py
from plone.portlets.interfaces import IPortletManager
from plone.app.portlets.interfaces import IColumn
class IFooterPortlets(IPortletManager, IColumn):
""""""
heres the viewlet template footerPortlets.pt
<div id = "footer-portlets-container">
test
<tal:block replace="structure provider:footerPortlets" /> <!-- This part fails -->
</div>
And here's the stacktrace for the error:
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 Shared.DC.Scripts.Bindings, line 322, in __call__
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.CMFCore.FSPageTemplate, line 237, in _exec
Module Products.CMFCore.FSPageTemplate, line 177, in pt_render
Module Products.PageTemplates.PageTemplate, line 79, in pt_render
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 888, in do_useMacro
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 533, in do_optTag_tal
Module zope.tal.talinterpreter, line 518, in do_optTag
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: file:/home/user/Plone/zinstance/src/santasport/santasport/templates/plonetheme.sunburst.skins.sunburst_templates.main_template.pt
- Line 181, Column 3
- Expression: <StringExpr u'footerPortlets1'>
- Names:
{'container': <ATDocument at /Santasport/front-page>,
'context': <ATDocument at /Santasport/front-page>,
'default': <object object at 0xb77bc7d0>,
'here': <ATDocument at /Santasport/front-page>,
'loop': {},
'nothing': None,
'options': {'args': ()},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb4a8e34c>,
'request': <HTTPRequest, URL=http://127.0.0.1:8080/Santasport/front-page/document_view>,
'root': <Application at >,
'template': <FSPageTemplate at /Santasport/front-page/document_view>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>}
Module zope.contentprovider.tales, line 80, in __call__
Module plone.app.viewletmanager.manager, line 154, in render
Module plone.app.viewletmanager.manager, line 85, in render
Module zope.browserpage.simpleviewclass, line 44, in __call__
Module Products.Five.browser.pagetemplatefile, line 125, in __call__
Module Products.Five.browser.pagetemplatefile, line 59, in __call__
Module zope.pagetemplate.pagetemplate, line 113, in pt_render
Module zope.tal.talinterpreter, line 271, in __call__
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 531, in do_optTag_tal
Module zope.tal.talinterpreter, line 513, in no_tag
Module zope.tal.talinterpreter, line 343, in interpret
Module zope.tal.talinterpreter, line 742, in do_insertStructure_tal
Module Products.PageTemplates.Expressions, line 218, in evaluateStructure
Module zope.tales.tales, line 696, in evaluate
- URL: /home/user/Plone/zinstance/src/santasport/santasport/templates/footerPortlets.pt
- Line 3, Column 1
- Expression: <StringExpr u'footerportlets'>
- Names:
{'args': (),
'container': <ATDocument at /my-theme/front-page>,
'context': <ATDocument at /my-theme/front-page>,
'default': <object object at 0xb77bc7d0>,
'here': <ATDocument at /my-theme/front-page>,
'loop': {},
'nothing': None,
'options': {},
'repeat': <Products.PageTemplates.Expressions.SafeMapping object at 0xb4a7dcfc>,
'request': <HTTPRequest, URL=http://127.0.0.1:8080/my-theme/front-page/document_view>,
'root': <Application at >,
'template': <Products.Five.browser.pagetemplatefile.ViewPageTemplateFile object at 0xb5e055ac>,
'traverse_subpath': [],
'user': <PropertiedUser 'admin'>,
'view': <Products.Five.viewlet.viewlet.SimpleViewletClass from /home/user/Plone/zinstance/src/my-theme/my-theme/templates/footerPortlets.pt object at 0xb4a3f52c>,
'views': <Products.Five.browser.pagetemplatefile.ViewMapper object at 0xb5e2cdac>}
Module zope.contentprovider.tales, line 66, in __call__
ContentProviderLookupError: footerPortlets
EDIT:
I got this code working somewhat by adding my viewlet to viewlets.xml and adding it to my profiles-folder (as one of the tutorials said FML), but I didn't really test it out any further but instead looked into Mikko's tutorial which worked for me out of the box really nicely.
Ps: Any ideas how to mark this question up?
You'll need to import the portlets.xml configuration.
The most direct way is via the portal_setup tool in the ZMI. Find your product name on the "Import" tab (in the Select Profile or Snapshot select box), then when the page has reloaded (shows 'Available Import Steps for "Name of your product profile"') you need to look up the Portlets import step in the list ("Import portlet managers, types, assignments and blacklistings"), tick it's box, and hit the "Import selected steps" button at the bottom.
The WebLion tutorial documented this a little vaguely as "The configuration is now complete. Uninstall your theme, restart Zope and reinstall your theme.". The Plone.org documentation appears to omit it entirely.

Resources