Increase link string length limit

This commit is contained in:
rubenwardy 2018-06-02 18:32:07 +01:00
parent 70afb94d3b
commit a6f4249afb
No known key found for this signature in database
GPG Key ID: A1E29D52FF81513C
3 changed files with 36 additions and 2 deletions

@ -688,7 +688,7 @@ class KrockForumTopic(db.Model):
ttype = db.Column(db.Integer, nullable=False) ttype = db.Column(db.Integer, nullable=False)
title = db.Column(db.String(200), nullable=False) title = db.Column(db.String(200), nullable=False)
name = db.Column(db.String(30), nullable=True) name = db.Column(db.String(30), nullable=True)
link = db.Column(db.String(50), nullable=True) link = db.Column(db.String(200), nullable=True)
def getType(self): def getType(self):
if self.ttype == 1 or self.ttype == 2: if self.ttype == 1 or self.ttype == 2:

@ -104,7 +104,7 @@ def importKrocksModList():
tags = re.findall("\[([a-z0-9_]+)\]", x["title"]) tags = re.findall("\[([a-z0-9_]+)\]", x["title"])
name = None name = None
for tag in reversed(tags): for tag in reversed(tags):
if len(tag) < 50 and not tag in BANNED_NAMES and \ if len(tag) < 30 and not tag in BANNED_NAMES and \
not re.match("^([a-z][0-9]+)$", tag): not re.match("^([a-z][0-9]+)$", tag):
name = tag name = tag
break break

@ -0,0 +1,34 @@
"""empty message
Revision ID: e9f534df23a8
Revises: adad68a5e370
Create Date: 2018-06-02 18:30:54.234366
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e9f534df23a8'
down_revision = 'adad68a5e370'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('krock_forum_topic', 'link',
existing_type=sa.VARCHAR(length=50),
type_=sa.String(length=200),
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('package_release', 'link',
existing_type=sa.String(length=200),
type_=sa.VARCHAR(length=50),
existing_nullable=False)
# ### end Alembic commands ###