Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feedback-loop
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
tools
feedback-loop
Commits
9e2d61d3
Commit
9e2d61d3
authored
2 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Fix use of undefined original_from
parent
e850c57a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
feedbackloop/parse.py
+68
-69
68 additions, 69 deletions
feedbackloop/parse.py
with
68 additions
and
69 deletions
feedbackloop/parse.py
+
68
−
69
View file @
9e2d61d3
...
@@ -117,7 +117,13 @@ class MailScanner():
...
@@ -117,7 +117,13 @@ class MailScanner():
def
scan
(
self
,
unseen
,
limit
=
None
):
def
scan
(
self
,
unseen
,
limit
=
None
):
for
uid
,
raw_msg
in
self
.
_scan_mailbox
(
unseen
,
limit
):
for
uid
,
raw_msg
in
self
.
_scan_mailbox
(
unseen
,
limit
):
try
:
try
:
entry
=
self
.
_parse_message
(
raw_msg
)
self
.
_to_delete
.
append
(
uid
)
yield
entry
except
Exception
as
e
:
print
(
f
'
error:
{
e
}
'
)
def
_parse_message
(
self
,
raw_msg
):
# Parse the ARF message body.
# Parse the ARF message body.
msg
=
ARFMessage
(
raw_msg
)
msg
=
ARFMessage
(
raw_msg
)
report_sender
,
_
=
_normalize_addr
(
report_sender
,
_
=
_normalize_addr
(
...
@@ -137,6 +143,7 @@ class MailScanner():
...
@@ -137,6 +143,7 @@ class MailScanner():
hdrs
=
msg
.
get_original_message_headers
()
hdrs
=
msg
.
get_original_message_headers
()
is_list
=
False
is_list
=
False
timestamp
=
datetime
.
now
()
timestamp
=
datetime
.
now
()
original_from
=
None
if
hdrs
:
if
hdrs
:
original_from
=
_hdr
(
hdrs
,
'
From
'
)
original_from
=
_hdr
(
hdrs
,
'
From
'
)
...
@@ -167,28 +174,20 @@ class MailScanner():
...
@@ -167,28 +174,20 @@ class MailScanner():
is_list
=
True
is_list
=
True
if
not
original_from
:
if
not
original_from
:
print
(
'
unable to extract original sender
'
)
raise
Exception
(
'
unable to extract original sender
'
)
continue
original_from
,
maybe_list
=
_normalize_addr
(
original_from
)
original_from
,
maybe_list
=
_normalize_addr
(
original_from
)
if
maybe_list
and
not
is_list
:
if
maybe_list
and
not
is_list
:
is_list
=
maybe_list
is_list
=
maybe_list
entry
=
FeedbackEntry
(
print
(
f
'
original from:
{
original_from
}
, list=
{
is_list
}
'
)
return
FeedbackEntry
(
sender
=
original_from
,
sender
=
original_from
,
reporter
=
report_sender
,
reporter
=
report_sender
,
is_list
=
is_list
,
is_list
=
is_list
,
timestamp
=
timestamp
,
timestamp
=
timestamp
,
message
=
raw_msg
,
)
)
if
not
is_list
:
entry
.
message
=
raw_msg
print
(
f
'
original from:
{
original_from
}
, list=
{
is_list
}
'
)
yield
entry
self
.
_to_delete
.
append
(
uid
)
except
Exception
as
e
:
print
(
f
'
error:
{
e
}
'
)
#print(raw_msg)
def
main
():
def
main
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment