webapp2 python正则表达式在路由中(webapp2 python regex in routing)
我正在尝试使用webapp2处理表单中的URL:
/case/e3627
其中'e3627'可以是任何字母数字字符串
这是我的路由参数:
app = webapp2.WSGIApplication([(r'/case/<:^\w+$>', ViewCase)], debug=True)
但是我的网址出现了404错误
我也试过
<:^[a-zA-Z0-9_]+$>
为正则表达式,但没有运气我的应用程序适用于常规网址,例如
/home
但不适用于正则表达式有任何想法吗?
I'm trying to get webapp2 to handle urls in the form:
/case/e3627
where 'e3627' can be any alphanumeric string
Here is my routing arguments:
app = webapp2.WSGIApplication([(r'/case/<:^\w+$>', ViewCase)], debug=True)
But I get a 404 error for my urls
I also tried
<:^[a-zA-Z0-9_]+$>
for the regex but no luckMy app works fine for regular urls for example
/home
but not for the regexAny ideas?
原文:https://stackoverflow.com/questions/15175910
更新时间:2023-07-17 19:07
最满意答案
使用parent.twonav时适合我
var links = [ 'javascript:\'<button onclick="parent.twonav(1)">Change 2nd frame</button>\'', 'javascript:\'Hello\'' ]; var one, two; window.onload=function() { one = document.getElementById('frameone'); two = document.getElementById('frametwo'); } function onenav(idx) { one.src=links[idx]; } function twonav(idx) { two.src=links[idx]; }
Works for me when using parent.twonav
var links = [ 'javascript:\'<button onclick="parent.twonav(1)">Change 2nd frame</button>\'', 'javascript:\'Hello\'' ]; var one, two; window.onload=function() { one = document.getElementById('frameone'); two = document.getElementById('frametwo'); } function onenav(idx) { one.src=links[idx]; } function twonav(idx) { two.src=links[idx]; }
相关问答
更多-
是的,绝对可以使用jquery这样做。 我不确切知道iframe中的代码是什么样的,但是要按名称选择iframe,例如,你会这样做: $("iframe[name='figher_profile']").contents(); 然后设置它的高度 $("iframe[name='figher_profile']").height($("iframe[name='figher_profile']").contents().find("html").css("height", "100")); //Settin ...
-
您可以将src属性设置为Web服务器上的一个页面,该页面将html作为纯文本输出,而不是HTML格式。 因此,您必须将标题信息内容类型设置为text / plain。 查看此页面,了解它是如何在PHP中完成的: http : //www.jonasjohn.de/snippets/php/headers.htm 没有办法只用html或js来做到这一点。 你需要一些服务器端语言来渲染页面。 当然,可以通过xmlhttprequest从js中的web服务器中检索数据,这个更好的称为AJAX。 You can s ...
-
您在创建要尝试修改的元素的HTML之前有Javascript,因此getElementById()没有找到该元素。 将添加JS的PHP代码移动到HTML的末尾,以便找到ID。 或者将Javascript放在窗口的load处理程序中。 "; echo "window.addEventListener('load', function() {"; echo "d ...
-
在触发任何特定event后,您必须更改src 。 所以试试这种方式, HTML: javaScript: var iframe = document.getElementById("m ...
-
iframe源代码有变量(Iframe source with variable)[2023-05-07]
数据URI方案适用于直接嵌入数据。 data:text/html;base64,aHR0cDovL2V4YW1wbGUuY29t 表示以"http://example.com"为唯一内容的html页面。 你可能想要"http://example.com"作为src The Data URI scheme is for direct embedded data. data:text/html;base64,aHR0cDovL2V4YW1wbGUuY29t Means a html page with "h ... -
如何更改iframe源代码(How to change iframe source)[2022-02-12]
请查看Google Web Designer帮助> iFrame组件 。 Please take a look into Google Web Designer Help > The iFrame component. -
对于iframe中的任何锚标记,请尝试将目标设置为_self。 喜欢这个: Test 我会玩它,但我知道这是旧学校框架的标准。 编辑基于我所做的一些测试,iframe中锚链接的默认操作是在iframe中加载新内容。 target =“_ self”是多余的,除非有其他东西覆盖它。 也许您应该提供有关源代码的更多信息,如果这不是为您解决的话。 我也可以假设您使用javascript遇到了问题。 ...
-
使用parent.twonav时适合我 DEMO var links = [ 'javascript:\'\'', 'javascript:\'Hello\'' ]; var one, two; window.onload=function() { one = document.getElementById('frameone'); two = document.g ...
-
示例:main.php
使用[2021-11-11]
在大多数情况下,由于浏览器/ DOM内置的安全措施,这是不可能的。 clmtrackr需要访问视频文件的像素,为此,它需要直接访问相关文章
更多- JAVA 正则表达式教程(超详细)一
- Java正则表达式
- 关于正则表达式空格的问题.
- RabbitMQ 路由模式(Routing)-使用 direct Exchange
- 快速了解正则表达式
- 揭开正则表达式的神秘面纱
- JAVA 正则表达式教程(超详细)三(续)
- java 中一个简单的正则表达式问题,帮忙看下.
- JAVA 正则表达式教程(超详细)二(续)
- 探索 Python,第 1 部分: Python 的内置数值类型
最新问答
更多- 您如何使用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)