Developer forum

Forum » Development » Templatev2.Template.GenerateTemplate: Developer mode must be enabled

Templatev2.Template.GenerateTemplate: Developer mode must be enabled

Martin Skov Nielsen
Reply
After an update from DW I get this message on my page: "Templatev2.Template.GenerateTemplate: Developer mode must be enabled"

This is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dynamicweb.Extensibility;
using Dynamicweb;
using System.Data;
using KD.Modules.CompanySearch.Src;

namespace CustomModules.KD.Modules.CompanySearch.Src
{
    [AddInName("CompanySearch")]
    public class CSTemplater : Dynamicweb.ContentModule
    {
        public override string GetContent()
        {
            Dynamicweb.Templatev2.Template t = new Dynamicweb.Templatev2.Template("CompanySearch/Template.html");
           
            Dynamicweb.Templatev2.Template branchOptions = t.GetLoop("BranchList");

            Dynamicweb.Templatev2.Template locationOptions = t.GetLoop("LocationList");

            foreach (var location in Location.GetLocations())
            {
                locationOptions.SetTag("LocationText", location.Name);
                locationOptions.SetTag("LocationValue", location.ID);
                locationOptions.CommitLoop();
            }

            foreach (var branch in Branch.GetBranchs())
            {
                branchOptions.SetTag("BranchText", branch.Name);
                branchOptions.SetTag("BranchValue", branch.ID);
                branchOptions.CommitLoop();
            }
            
            t.GenerateTemplate(false);
            
            return t.Output();
        }
    }
}

What is wrong with that? It worked before??


Replies

 
Pavel Volgarev
Reply
This post has been marked as an answer
Hi Martin,

We made several performance improvements in Template object with the latest release.On of the changes that we introduced was the restriction that doesn't allow the developer to call the methods that are intended for debugging purposes only (and therefore might be very time consuming) without explicitly specifying that those methods can be called.

To fix your problem you need to set the property "DeveloperMode" to "true" before calling "GenerateTemplate":
t.DeveloperMode = true;
t.GenerateTemplate(false);
-- Pavel 
Votes for this answer: 0
 
Nicolai Høeg Pedersen
Reply
And there is absolutely no idea in having t.GenerateTemplate(false); in production mode.

 

You must be logged in to post in the forum