You are not logged in.
Pages: 1
Hi ab,
I find a strange issue since recent update of Mormot2 (2.0.4099), Win10.
The MVC Server (from your example) with fMainRunner := TMvcRunOnRestServer.Create(Self);
It always overwrites my existing html template in folder "Views" (eg. HTML file content is about -> {{! void template created for the IWebApplication.xxx View: )
Any settings need ?
Thanks
Last edited by Mark (2022-09-22 02:14:58)
Offline
Are you sure you generated the executable in the right folder?
Because on my side, if I compile it into the exe sub-folder on the sample directory, then it properly find the existing exe/Views template files.
Offline
Hello, Ab,
The issue still remain.
I build the MVCServer sample, it is success to generate MVCServer.exe in folder "exe".
But when I run the exe,
I find that all html files (under folder Views) content updated with default void statements "{{! void template created" .
That means all the existing *.html content cleared (eg. <!DOCTYPE html> ... >> {{! void template created for the xxx.yyy View: ...)
I check the log, find:
0000000000000619 ! warn {"TMvcViewsMustache(01510930)":{}}.Create: Missing View file in Default.* << Already exists Default.html in Views folder, why cannot find?
00000000000007C4 ! warn {"TMvcViewsMustache(01510930)":{}}.Create: Missing View file in Error.* << Ditto
00000000000008E7 ! warn {"TMvcViewsMustache(01510930)":{}}.Create: Missing View file in ArticleView.* << Ditto
0000000000000AAD ! warn {"TMvcViewsMustache(01510930)":{}}.Create: Missing View file in AuthorView.* << Ditto
0000000000000C2D ! warn {"TMvcViewsMustache(01510930)":{}}.Create: Missing View file in ArticleEdit.* << Ditto
Win10, Mormot2 (2.0.4099), FP (3.2.2), Laz (2.2.2)
Please help !
Last edited by Mark (2022-09-26 06:46:08)
Offline
Still clean my pre-set html templates when run the MVC Server program.
Is it wrong code calling?
Code:
fMainRunner := TMvcRunOnRestServer.Create(Self);
Offline
I am not able to reproduce the problem, as I wrote above.
Please try to debug on your side in TMvcViewsMustache.Create to see what happens.
For instance, didn't you change the ViewTemplateFolder value?
Offline
Try to update your mORMot code with latest version.
Code is fine and it will create template with default settings, I think it's better if you specify it yourself, for example:
var
Params: TMVCViewsMustacheParameters;
begin
FillChar(Params, sizeof(Params), 0);
Params.Folder := Settings.TemplatesLocation;
Params.FileTimestampMonitorAfterSeconds := 5;
Params.ExtensionForNotExistingTemplate := '.html';
Params.Helpers := TSynMustache.HelpersGetStandardList;
FViews := TMVCViewsMustache.Create(Self.Factory.InterfaceTypeInfo, Params, FRestServer.LogClass);
FMainRunner := TMVCRunOnRestServer.Create(Self, nil, '', FViews, [publishStatic, registerORMTableAsExpressions]);
Offline
>>For instance, didn't you change the ViewTemplateFolder value?
I use default folder "Views" with Default.html
When I debug, (lazarus GDB always abort in some object. eg. fViews)
I find something strange but the GDB abort, It cannot show in depth ---broken then stop dialog.
I find that the result of if length(files) >0 then --> false
so, goto the block to create a new html template
I suspect FindTemplates() cannot get Default.html contents.
where SearchPattern --> Default.*
code:
mormot.rest.mvc
line 1169 files := FindTemplates(SearchPattern);
line 1170 if length(files) > 0 then <-- false
Last edited by Mark (2022-09-28 12:52:16)
Offline
Pages: 1