Skip to content

Commit 5f00667

Browse files
committed
removed files from previous checkout
1 parent 987d27c commit 5f00667

File tree

4 files changed

+1
-48
lines changed

4 files changed

+1
-48
lines changed

pongo2_template_test.go

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -101,27 +101,6 @@ func init() {
101101
pongo2.DefaultSet.Globals["temp_file"] = f.Name()
102102
}
103103

104-
105-
type ParentStruct struct {
106-
name string
107-
/* changing struct to capital letter causing another issue: <main.ChildStruct Value>
108-
https://github.com/flosch/pongo2/issues/206 */
109-
Child *ChildStruct `json:"child"`
110-
}
111-
112-
type ChildStruct struct {
113-
name string
114-
}
115-
116-
func (p *ParentStruct) String() string {
117-
return fmt.Sprintf("<div>%s<div>", p.name)
118-
}
119-
120-
func (c *ChildStruct) String() string {
121-
return fmt.Sprintf("<p>%s<p>", c.name)
122-
}
123-
124-
125104
/*
126105
* End setup sandbox
127106
*/
@@ -254,12 +233,6 @@ Yep!`,
254233
},
255234
},
256235
},
257-
"parent": &ParentStruct{
258-
name: "Parent",
259-
Child: &ChildStruct{
260-
name: "Child",
261-
},
262-
},
263236
}
264237

265238
func TestTemplate_Functions(t *testing.T) {

template_tests/variables.tpl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@
1313
{{ simple.uint|float }}
1414
{{ simple.multiple_item_list.10 }}
1515
{{ simple.multiple_item_list.4 }}
16-
17-
{{ parent }} - {{ parent.name }} - {{ parent.child }} - {{ parent.child.name }}

template_tests/variables.tpl.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ True
1313
8.000000
1414

1515
5
16-
17-
<div>Parent<div> - Parent - <p>Child<p> - Child

variable.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -291,23 +291,7 @@ func (vr *variableResolver) resolve(ctx *ExecutionContext) (*Value, error) {
291291
// Calling a field or key
292292
switch current.Kind() {
293293
case reflect.Struct:
294-
field := current.FieldByName(part.s)
295-
if !field.IsValid() && current.NumField() > 0 {
296-
for i := 0; i < current.NumField(); i++ {
297-
f := current.Type().Field(i)
298-
tag := f.Tag.Get("json")
299-
if tag != "-" {
300-
if idx := strings.Index(tag, ","); idx != -1 {
301-
tag = tag[:idx]
302-
}
303-
}
304-
if tag == part.s {
305-
field = current.FieldByName(f.Name)
306-
break
307-
}
308-
}
309-
}
310-
current = field
294+
current = current.FieldByName(part.s)
311295
case reflect.Map:
312296
current = current.MapIndex(reflect.ValueOf(part.s))
313297
default:

0 commit comments

Comments
 (0)