首页 \ 问答 \ 如何强制vim语法 - 将文件突出显示为html?(How to force vim to syntax-highlight a file as html?)

如何强制vim语法 - 将文件突出显示为html?(How to force vim to syntax-highlight a file as html?)

如何设置vim的语法高亮将文件扩展名作为HTML文件?

我使用ez模板,所以文件的扩展名是.ezt 。 但是很多都是正常的html代码。


How do I set vim's syntax highlighting to treat a file extension as an html file?

I'm using ez template, so the file's extension is .ezt. But a lot of it is normal html code.


原文:https://stackoverflow.com/questions/3853028
更新时间:2023-06-22 19:06

最满意答案

你正在重新装载模块吗? 如果是这样,那可能会解释这个错误。

显然,由于内存引用的更改, isinstance(self,DBAdminConnection)可能会在重新加载模块后变为false。

编辑:如果您在mod_wsgi下运行web.py应用程序,请确保禁用autoreload:

app = web.application(urls, globals(), autoreload=False)

Are you reloading modules somehow in the middle of things? If so, that may explain this error.

isinstance(self,DBAdminConnection) may become false after reloading modules because of the changes to memory references, apparently.

Edit: if you're running your web.py app under mod_wsgi, make sure you're disabling autoreload:

app = web.application(urls, globals(), autoreload=False)

相关问答

更多
  • 在Python 3中引入了super() (无参数): super() -> same as super(__class__, ) 所以这将是新的类的Python 2等价物: super(CurrentClass, self) 对于旧式课程,您可以随时使用: class Classname(OldStyleParent): def __init__(self, *args, **kwargs): OldStyleParent.__init__(s ...
  • super.type只是引用与this.type相同的变量...只涉及一个对象,因此只有一个字段。 当您创建子类的实例时,它不会创建两个单独的对象,一个用于超类,一个用于子类 - 它创建一个对象,可以将其视为超类或子类。 它有一组字段。 在这种情况下,您有一个字段( type ),其最初的值为"f " ,但其值已更改为"c " 。 super.type is just referring to the same variable as this.type... there's only one object ...
  • 对。 ( super比“返回MRO中的下一个基本实例”更复杂一些,但是您了解返回对象上的哪些属性查找,这才是最重要的。) Yup. (super is a bit more complex than "returns the next base instance in MRO", but you understand what attribute lookup on the returned object does, and that's what matters.)
  • 你正在重新装载模块吗? 如果是这样,那可能会解释这个错误。 显然,由于内存引用的更改, isinstance(self,DBAdminConnection)可能会在重新加载模块后变为false。 编辑:如果您在mod_wsgi下运行web.py应用程序,请确保禁用autoreload: app = web.application(urls, globals(), autoreload=False) Are you reloading modules somehow in the middle of thi ...
  • 原因是super()只对新的类进行操作,而在2.x系列中则是从对象扩展的。 The reason is that super() only operates on new-style classes, which in the 2.x series means extending from object: >>> class X(object): def a(self): print 'a' >>> class Y(X): def a(self): ...
  • Python的super()应该被称为“next-in-mro”,因为它不一定向上调用父进程; 相反,它可以调用兄弟姐妹。 检查类结构的方法解析顺序很容易: >>> C.__mro__ (, , , ) 你可以看到B是A之后的下一个班级。 这种设计的原因是它可以让超链接的链条访问链中的每个类不超过一次。 这支持一种称为“合作多重继承”的编程风格,这种编程 ...
  • 是的,我相信作者本可以使用super() 。 super的主要优点是具有多重继承, 这可能会让您感兴趣 Yes, I believe the author could have used super() . The main advantage of super comes with multiple inheritance, this may interest you
  • 在所有情况下, self 仍然是Derived实例 。 super()找到overriden方法并将它绑定到self ,你不会交换类。 super(Derived, self).f2在Base类上找到下一个f2方法,并将其绑定到self 。 当调用then时, self仍然是同一个实例,并且在self上调用f1将调用Derived.f1 。 self in all cases is still the Derived instance. super() finds the overriden method ...
  • super(B,self).do_work() 将调用do_work函数,如B的父类所见 - 即A.do_work 。 super(A,self).do_work() 将调用do_work函数,如A的父类所看到的那样 - 即object.do_work (可能不存在,因此可能引发异常)。 super(B,self).do_work() will call the do_work function as seen by the parent class of B - that is, A.do_work ...
  • super()返回基类的实例,因此self会像任何其他方法调用一样隐式传递给__init__() 。 关于你的第二个问题,这是正确的。 在没有实例的情况下调用super()作为第二个参数将返回对类本身的引用,而不是从子类实例构造的实例。 super() returns an instance of the base class, so self gets implicitly passed to __init__() like in any other method call. With regards t ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)