eval

odoo12 基于组的访问控制机制

六眼飞鱼酱① 提交于 2019-11-28 13:15:13
通过组权限来实现权限管理,组是保存在res.groups里的一些记录。菜单的权限可以通过xml中菜单的定义设置组权限。菜单下关联的model也要设置对象级别的访问权限(read, write, create, unlink),并关联到特定组。还有一些model.py里的做权限检查或xml定义中设置field相关的组。 1 <?xml version="1.0" encoding="utf-8" ?> 2 <odoo> 3 <data> 4 <record model="res.groups" id="group_manager"> 5 <field name="name">管理</field> 6 </record> 7 8 <record id="only_responsible_can_modify" model="ir.rule"> 9 <field name="name">只有课程负责人可以编辑课程</field> 10 <field name="model_id" ref="model_odoogoedu_course"/> 11 <field name="groups" eval="[(4, ref('odoogoedu.group_manager'))]"/> 12 <field name="perm_read" eval="0"/> 13 <field name=

Evaluate javascript on a local html file (without browser)

亡梦爱人 提交于 2019-11-28 13:02:48
This is part of a project I am working on for work. I want to automate a Sharepoint site, specifically to pull data out of a database that I and my coworkers only have front-end access to. I FINALLY managed to get mechanize (in python) to accomplish this using Python-NTLM, and by patching part of it's source code to fix a reoccurring error. Now, I am at what I would hope is my final roadblock: Part of the form I need to submit seems to be output of a JavaScript function :| and lo and behold... Mechanize does not support javascript. I don't want to emulate the javascript functionality myself in

eval() does not return the function results

被刻印的时光 ゝ 提交于 2019-11-28 12:57:46
I have a method name that is stored in a column in the DB that looks like this: customs::nicknames($data) This is the related class: class customs extends service { function __construct() { parent::__construct(); } public static function nicknames($data) { return $data; } } When I call it in this way: $merge = eval($error['custom'] . ';'); The contents of the $data variable is not returned. Just to give it a try I tried with echo and it is correctly returning the array to string conversion php error. So the variable $data is read correctly. But why does not it return anything? If I try to call

Get variable from a string

廉价感情. 提交于 2019-11-28 12:43:15
Does anyone know how could I select a variable from a String in JavaScript? Here's what I'm basically trying to achieve: var myLang = "ESP"; var myText_ESP = "Hola a todos!"; var myText_ENG = "Hello everybody!"; console.log(myText_ + myLang); // This should trace "Hola a todos!" Thanks! var hellos = { ESP: 'Hola a todos!', ENG: 'Hello everybody!' }; var myLang = 'ESP'; console.log(hellos[myLang]); I don't like putting everything in global scope, and then string accessing window properties; so here is another way to do it. If your variable is defined in the global context, you may do this :

HyperLink with NavigateUrl with Eval(). Where is the mistake?

痴心易碎 提交于 2019-11-28 11:54:30
First I was changing HyperLink.NavigateUrl in code-behind on Page_Load() . But after I decided to do it in design using Eval() method. <asp:HyperLink runat="server" NavigateUrl='<%# String.Format("~/Refuse.aspx?type={0}&id={1}", Eval("type"), Eval("id")) %>' Text="Refuse" /> or <asp:HyperLink ID="urlRefuse" runat="server" NavigateUrl='<%# String.Format("~/Refuse.aspx?type={0}&id={1}", Request["type"], Request["id"]) %>' Text="Refuse" /> where id and type - are variables from Request . But it doesn't work. Only raw text 'Refuse' is shown. Where is my mistake? Thanks in advance. Hamdy Mohamed

How could I call Java code dynamically?

血红的双手。 提交于 2019-11-28 11:48:49
How could I write Java code that is executed like javascript code used together with the eval function? What I would like to achieve would be something like this: System.execute ("String str = \"test\"; System.out.println(str);"); which would print the word 'test'. (10x dehmann ) A code sample would help a lot. Look into BeanShell or Groovy. Both will give you reasonable solutions--but those solutions rely on my interpretation of your problem, which may be flawed. I've used the JavaScript engine shipped with Java 6 and it works quite well. The performance of the engine is very very decent.

How safe is expression evaluation using eval?

两盒软妹~` 提交于 2019-11-28 11:43:37
I am building a website where I have a need that user should be able to evaluate some expression based from the value in DB tables, instead of using tools like pyparsing etc, I am thinking of using python itself, and have come up with a solution which is sufficient for my purpose. I am basically using eval to evaluate the expression and passing globals dict with empty __builtins__ so that nothing can be accessed and a locals dict for values from DB, if user will need some functions I can pass those too e.g. import datetime def today(): return datetime.datetime.now() expression = """ first_name

How to run a string as a command in VBA

此生再无相见时 提交于 2019-11-28 11:21:40
I have this simple VBA code below, and I don't know why is not working. Sub Run() test = "MsgBox" & """" & "Job Done!" & """" Application.Run test End Sub What I want to do is to put the VBA Command into a variable as text and run it as a command. In this case, I want to run like MsgBox "Job Done!" and print just: Job Done! You may be tempted by adding your own string "Executer": Sub StringExecute(s As String) Dim vbComp As Object Set vbComp = ThisWorkbook.VBProject.VBComponents.Add(1) vbComp.CodeModule.AddFromString "Sub foo()" & vbCrLf & s & vbCrLf & "End Sub" Application.Run vbComp.name & "

Dynamicly creating class with trait binding

天大地大妈咪最大 提交于 2019-11-28 11:00:53
问题 I want to make use of traits in my project, and for multiple inheriance I want to use traits. So I created some traits to use eg: tItem_Epic, tItem_Weapon, Item_Driver When I create new class for Sword, I thought I could use eval to create class: <?php function new_item_class($type) { eval('class Item_'.ucfirst($type).' extends Item_Driver { use tItem_Epic, tItem_Weapon; }'); } ?> This is an example. There are some more parameters that change the course of eval (like: item quality, etc.).

eval in if statement?

眉间皱痕 提交于 2019-11-28 10:45:20
<% if(Eval("SaveDate") != DBNull.Value){ %> do magic <%} %> gives me error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I could write : <%# Eval("SaveDate") != DBNull.Value ? do magic But I need to do lots of html magic in if statement. I know I should add # in order to use Eval, but not sure about correct syntax. One solution is to wrap the content in a runat="server" tag with a Visible value, e.g., <div runat="server" Visible='<%# Eval("SaveDate") != DBNull.Value %>'> do magic </div> div can be any HTML tag, but <asp:Panel>