Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wantzel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Brendan Abolivier
wantzel
Commits
d927a2a1
Commit
d927a2a1
authored
Mar 30, 2016
by
okhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #23 let's truncate the tweet
parent
07f3d342
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
wantzel.py
wantzel.py
+10
-2
No files found.
wantzel.py
View file @
d927a2a1
...
...
@@ -561,9 +561,17 @@ class Wantzel(object):
# lesser than future
if
today
<
entry
.
published_parsed
<
now
:
if
self
.
last_entry_published
<
entry
.
published_parsed
:
# Let's see if we can truncate the lenght of the tweet
# We have 5 chars for the language, so max-length is 135
title
=
entry
.
title
.
encode
(
"utf-8"
)
link
=
entry
.
link
.
encode
(
"utf-8"
)
if
len
(
title
)
+
len
(
link
)
>
135
:
# What is the number of chars we need to remove
excess
=
len
(
title
)
+
len
(
link
)
-
135
title
=
''
.
join
([
title
[:
-
(
excess
+
4
)],
u
' ...'
])
tweet
(
messages
[
"tweet_rp_%s"
%
language
]
%
(
entry
.
title
.
encode
(
"utf-8"
)
,
entry
.
link
.
encode
(
"utf-8"
)
title
,
link
))
Utils
.
debug
(
entry
.
published_parsed
)
Utils
.
debug
(
entry
.
title
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment